flamapy 2.6.0.dev12__py3-none-any.whl → 2.9.0.dev1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,6 +10,7 @@ from shutil import copytree
10
10
  from typing import Any, List, Tuple, Optional, Union, get_args, get_origin
11
11
  from types import FunctionType
12
12
 
13
+ from flamapy.core.exceptions import FlamaException
13
14
  from flamapy.interfaces.python.flamapy_feature_model import FLAMAFeatureModel
14
15
 
15
16
  # List to store registered commands and their arguments
@@ -57,7 +58,8 @@ def extract_commands(
57
58
  if name.startswith("_"):
58
59
  continue
59
60
  if getattr(method, "_facade_kind", "operation") != "operation":
60
- continue # producers/transformers return models; Python-API only for now
61
+ # producers/transformers return models: Python API and REST (as UVL), not the CLI
62
+ continue
61
63
  docstring: Optional[str] = method.__doc__
62
64
  signature = inspect.signature(method)
63
65
  # Exclude 'self' from parameters
@@ -67,6 +69,53 @@ def extract_commands(
67
69
  return commands
68
70
 
69
71
 
72
+ @command(
73
+ "plan",
74
+ "Shows which backend the query planner would pick for an operation on a model. "
75
+ "The planner is opt-in: run operations with --backend auto (or FLAMAPY_BACKEND=auto) "
76
+ "to actually use it.",
77
+ ("operation", str, "Facade operation name, e.g. configurations_number"),
78
+ ("model_path", str, "Path to the feature model file"),
79
+ )
80
+ def plan_command(args): # type: ignore
81
+ fm = FLAMAFeatureModel(args.model_path)
82
+ try:
83
+ chosen = fm.plan(args.operation)
84
+ except FlamaException as error:
85
+ print(f"No compatible backend: {error}")
86
+ return None
87
+ data = chosen.to_dict(fm.fm_model.get_extension())
88
+ print(f"operation: {args.operation}")
89
+ print(f"chosen backend: {data['plugin']} (extension '{data['backend']}')")
90
+ print(f"transformation chain: {' -> '.join(data['transformation_chain'])}")
91
+ print(f"estimated cost: {data['estimated_cost_ms']} ms (heuristic)")
92
+ print(f"rationale: {data['rationale']}")
93
+ if data['alternatives']:
94
+ print(f"alternatives: {', '.join(data['alternatives'])}")
95
+ return None
96
+
97
+
98
+ @command(
99
+ "cache",
100
+ "Inspects or clears the compilation-artifact cache (opt-in: set FLAMAPY_CACHE=1 to "
101
+ "cache compiled backends such as BDDs across runs).",
102
+ ("action", str, "'info' or 'clear'"),
103
+ )
104
+ def cache_command(args): # type: ignore
105
+ from flamapy.core import cache as artifact_cache # noqa: PLC0415
106
+
107
+ if args.action == "info":
108
+ stats = artifact_cache.info()
109
+ print(f"enabled: {stats['enabled']} (set FLAMAPY_CACHE=1 to enable)")
110
+ print(f"directory: {stats['directory']}")
111
+ print(f"artifacts: {stats['artifacts']} ({stats['size_mb']} MB)")
112
+ elif args.action == "clear":
113
+ removed = artifact_cache.clear()
114
+ print(f"removed {removed} artifact(s)")
115
+ else:
116
+ print(f"Unknown cache action '{args.action}'; use 'info' or 'clear'.")
117
+
118
+
70
119
  @command(
71
120
  "generate_plugin",
72
121
  "Generates a new plugin skeleton to implement your custom operations. "
@@ -108,7 +157,9 @@ def generate_plugin(args): # type: ignore
108
157
  lines = file.readlines()
109
158
  with open(copy_file, "w", encoding="utf-8") as filewrite:
110
159
  for line in lines:
111
- out_line = line.replace("__NAME__", name.capitalize()).replace("__EXT__", ext)
160
+ out_line = (line.replace("__NAME_LOWER__", name)
161
+ .replace("__NAME__", name.capitalize())
162
+ .replace("__EXT__", ext))
112
163
  filewrite.write(out_line)
113
164
 
114
165
  os.rename(
@@ -156,6 +207,12 @@ def setup_dynamic_commands(subparsers, dynamic_commands): # type: ignore
156
207
  default=param.default,
157
208
  help=f"Optional {arg_type.__name__}",
158
209
  )
210
+ subparser.add_argument(
211
+ "-v", "--verbose", action="store_true",
212
+ help="Also print the result's provenance (plugin, backend, exact, wall time)")
213
+ subparser.add_argument(
214
+ "--timeout", type=float, default=None, metavar="SECONDS",
215
+ help="Abort if the operation exceeds this wall-clock time (exit code 124)")
159
216
  subparser.set_defaults(func=method, method_name=name, parameters=parameters)
160
217
 
161
218
 
@@ -168,19 +225,66 @@ def setup_manual_commands(subparsers, manual_commands): # type: ignore
168
225
  subparser.set_defaults(func=func)
169
226
 
170
227
 
228
+ def _run_with_timeout(cls_instance, method_name, command_args, timeout): # type: ignore
229
+ """Run the operation asynchronously and enforce the wall-clock deadline (exit 124)."""
230
+ from flamapy.core.exceptions import OperationTimeout # noqa: PLC0415
231
+
232
+ try:
233
+ job = cls_instance.run_async(method_name, **command_args)
234
+ result = job.result(timeout=timeout)
235
+ except OperationTimeout as error:
236
+ print(f"Timeout: {error}", file=sys.stderr)
237
+ sys.exit(124)
238
+ except FlamaException as error:
239
+ print(f"Error: {error}", file=sys.stderr)
240
+ return None
241
+ cls_instance.last_result = job.envelope()
242
+ return result
243
+
244
+
245
+ def _print_provenance(envelope) -> None: # type: ignore
246
+ print("--- provenance ---", file=sys.stderr)
247
+ print(f"operation: {envelope.operation} plugin: {envelope.plugin} "
248
+ f"backend: {envelope.backend}", file=sys.stderr)
249
+ print(f"exact: {envelope.exact} wall_time: {envelope.wall_time:.6f}s "
250
+ f"cache_hit: {envelope.cache_hit}", file=sys.stderr)
251
+ if envelope.planner is not None:
252
+ print(f"planner: {envelope.planner}", file=sys.stderr)
253
+ print(f"model_hash: {envelope.model_hash}", file=sys.stderr)
254
+
255
+
256
+ def _execute_dynamic(args: argparse.Namespace) -> None:
257
+ cls_instance = FLAMAFeatureModel(args.model_path)
258
+ method_parameters = [param.name for param in args.parameters]
259
+ command_args = {k: v for k, v in vars(args).items() if k in method_parameters}
260
+ descriptor = getattr(
261
+ getattr(type(cls_instance), args.method_name), "_facade_descriptor", None)
262
+ timeout = getattr(args, "timeout", None)
263
+ if timeout is not None:
264
+ result = _run_with_timeout(cls_instance, args.method_name, command_args, timeout)
265
+ elif (getattr(descriptor, "streaming", False)
266
+ and args.method_name == "configurations"
267
+ and command_args.get("backend") == "sat"):
268
+ # Explicitly-chosen streaming backend: print each configuration as the
269
+ # solver produces it (the default bdd output is unchanged).
270
+ for configuration in cls_instance.iter_configurations(backend="sat"):
271
+ print(configuration)
272
+ result = None
273
+ else:
274
+ method = getattr(cls_instance, args.method_name)
275
+ result = method(**command_args)
276
+ if result is not None:
277
+ print(result)
278
+ if getattr(args, "verbose", False) and cls_instance.last_result is not None:
279
+ _print_provenance(cls_instance.last_result)
280
+
281
+
171
282
  def execute_command(args: argparse.Namespace) -> None:
172
283
  try:
173
284
  if hasattr(args, "method_name"):
174
- cls_instance = FLAMAFeatureModel(args.model_path)
175
- method_parameters = [param.name for param in args.parameters]
176
- command_args = {k: v for k, v in vars(args).items() if k in method_parameters}
177
- method = getattr(cls_instance, args.method_name)
178
- result = method(**command_args)
179
- if result is not None:
180
- print(result)
285
+ _execute_dynamic(args)
181
286
  else:
182
287
  func = args.func
183
- command_args = {k: v for k, v in vars(args).items() if k != "func"}
184
288
  result = func(args)
185
289
  if result is not None:
186
290
  print(result)
@@ -5,6 +5,7 @@ This module renders a ``.pyi`` stub from the same OperationDescriptors, giving a
5
5
  mypy the real signatures + return types. Run ``python -m flamapy.interfaces.python._stub`` to
6
6
  regenerate; a test asserts the shipped stub matches this output so it never drifts.
7
7
  """
8
+ import re
8
9
  from typing import Any
9
10
 
10
11
  from flamapy.core.discover import DiscoverMetamodels
@@ -14,8 +15,10 @@ _HEADER = '''\
14
15
  # Auto-generated by flamapy.interfaces.python._stub — do not edit by hand.
15
16
  # Regenerate with: python -m flamapy.interfaces.python._stub
16
17
  from enum import Enum
17
- from typing import Any, Dict, List, Optional, Tuple, Union
18
+ from typing import Any, Dict, List, Optional, Tuple, Union # noqa: F401
18
19
 
20
+ from flamapy.core.operations import OperationResult
21
+ from flamapy.core.planner import Plan
19
22
  from flamapy.metamodels.configuration_metamodel.models import Configuration
20
23
  from flamapy.metamodels.fm_metamodel.models import FeatureModel
21
24
 
@@ -25,13 +28,25 @@ class Backend(str, Enum):
25
28
  BDD = ...
26
29
  Z3 = ...
27
30
  SHARPSAT = ...
31
+ SDD = ...
32
+ DNNF = ...
33
+ AUTO = ...
28
34
 
29
35
 
30
36
  class FLAMAFeatureModel:
31
37
  model_path: str
32
38
  fm_model: FeatureModel
33
39
  backend: Optional[Backend]
34
- def __init__(self, model_path: str, backend: Optional[str] = ...) -> None: ...
40
+ allow_approximate: Optional[bool]
41
+ raise_errors: Optional[bool]
42
+ last_result: Optional[OperationResult[Any]]
43
+ def __init__(self, model_path: str, backend: Optional[str] = ...,
44
+ *, allow_approximate: Optional[bool] = ...,
45
+ raise_errors: Optional[bool] = ...) -> None: ...
46
+ def plan(self, operation: str, *, allow_approximate: Optional[bool] = ...) -> Plan: ...
47
+ def _plan_operation(self, operation_name: str, allow_approximate: bool = ...) -> Plan: ...
48
+ def run_async(self, operation: str, **kwargs: Any) -> Any: ...
49
+ def iter_configurations(self, backend: Optional[str] = ...) -> Any: ...
35
50
  '''
36
51
 
37
52
 
@@ -52,9 +67,16 @@ def _method_signature(descriptor: OperationDescriptor) -> str:
52
67
  params.append(f'{input_spec.name}: {annotation} = ...')
53
68
  if descriptor.selectable_backend:
54
69
  params.append('backend: Optional[str] = ...')
70
+ params.append('*')
71
+ params.append('allow_approximate: Optional[bool] = ...')
55
72
  return ', '.join(params)
56
73
 
57
74
 
75
+ def _return_annotation(descriptor: OperationDescriptor) -> str:
76
+ # Descriptors spell nullable returns 'Union[None, X]'; the stub uses 'Optional[X]'.
77
+ return re.sub(r'^Union\[None, (.*)\]$', r'Optional[\1]', descriptor.returns)
78
+
79
+
58
80
  def render_stub(operations: 'dict[str, OperationDescriptor] | None' = None) -> str:
59
81
  if operations is None:
60
82
  operations = DiscoverMetamodels().available_operations()
@@ -64,7 +86,8 @@ def render_stub(operations: 'dict[str, OperationDescriptor] | None' = None) -> s
64
86
  if descriptor.kind == 'producer':
65
87
  lines.append(' @staticmethod')
66
88
  lines.append(
67
- f' def {name}({_method_signature(descriptor)}) -> {descriptor.returns}: ...')
89
+ f' def {name}({_method_signature(descriptor)}) '
90
+ f'-> {_return_annotation(descriptor)}: ...')
68
91
  return '\n'.join(lines) + '\n'
69
92
 
70
93
 
@@ -10,15 +10,31 @@ per-operation or per-backend code here. Static typing is provided by a generated
10
10
  """
11
11
  import inspect
12
12
  import logging
13
+ import os
14
+ import threading
13
15
  from enum import Enum
14
- from typing import Any, Dict, Optional, Union
16
+ from typing import Any, Dict, Iterator, Optional, Union
15
17
 
18
+ import dataclasses
19
+ import warnings
20
+
21
+ from flamapy.core import cache as artifact_cache
16
22
  from flamapy.core.discover import DiscoverMetamodels
17
- from flamapy.core.exceptions import FlamaException
23
+ from flamapy.core.exceptions import FlamaException, OperationTimeout, PluginNotFound
24
+ from flamapy.core.execution import Interruptible, Job, default_engine, run_and_wrap
18
25
  from flamapy.core.models import VariabilityModel
19
- from flamapy.core.operations import OperationDescriptor
26
+ from flamapy.core.models.language_level import LanguageLevel
27
+ from flamapy.core.operations import (
28
+ OperationDescriptor,
29
+ OperationResult,
30
+ StreamingOperation,
31
+ )
32
+ from flamapy.core.planner import Plan, plan as plan_backend
20
33
  from flamapy.metamodels.configuration_metamodel.models import Configuration
21
34
  from flamapy.metamodels.fm_metamodel.models import FeatureModel
35
+ from flamapy.metamodels.fm_metamodel.operations.fm_language_level import (
36
+ calculate_language_level,
37
+ )
22
38
 
23
39
  logger = logging.getLogger(__name__)
24
40
 
@@ -33,12 +49,83 @@ class Backend(str, Enum):
33
49
  SAT = "sat"
34
50
  BDD = "bdd"
35
51
  Z3 = "z3"
52
+ # Optional backends, installed via the flamapy extras of the same name
53
+ # (e.g. pip install "flamapy[sharpsat]", or "flamapy[all-solvers]" for all three).
36
54
  SHARPSAT = "sharpsat"
55
+ SDD = "sdd"
56
+ DNNF = "dnnf"
57
+ # Opt-in: let the query planner pick the backend per operation, from the plugins'
58
+ # capability manifests (language level, scale, cost). Also enabled process-wide by
59
+ # setting FLAMAPY_BACKEND=auto. Becomes the default in flamapy 3.0.
60
+ AUTO = "auto"
37
61
 
38
62
 
39
63
  # Facade backend name -> fm-to-backend transformation extension (the only non-identity mapping).
40
64
  _BACKEND_ALIAS = {"sat": "pysat"}
41
65
 
66
+ # Operations that ran on a fixed backend in 2.6 and accept ``backend=`` since 2.9. In 2.x only a
67
+ # per-call ``backend=`` changes them: the workspace default and FLAMAPY_BACKEND do not, so code
68
+ # that set a default backend in 2.6 keeps the same results (the default would otherwise move
69
+ # atomic sets from the tree to SAT, or send commonality to a backend without it). 3.0 applies
70
+ # the defaults to them like to every other selectable operation.
71
+ _SELECTABLE_SINCE_2_9 = frozenset({'atomic_sets', 'commonality'})
72
+
73
+ _TRUE_VALUES = ('1', 'true', 'yes', 'on')
74
+
75
+
76
+ def _env_flag(name: str) -> bool:
77
+ return os.environ.get(name, '').strip().lower() in _TRUE_VALUES
78
+
79
+
80
+ def _raise_errors(setting: Optional[bool]) -> bool:
81
+ """The model's ``raise_errors`` when set, else the FLAMAPY_RAISE_ERRORS variable."""
82
+ return setting if setting is not None else _env_flag('FLAMAPY_RAISE_ERRORS')
83
+
84
+
85
+ def _caller_stacklevel() -> int:
86
+ """The ``warnings.warn`` stacklevel, for its caller, of the first frame outside this module:
87
+ the user's call, whichever facade entry point (operation method, iter_configurations) it
88
+ went through."""
89
+ frame = inspect.currentframe()
90
+ frame = frame.f_back if frame is not None else None # the function calling warnings.warn
91
+ level = 1
92
+ while frame is not None and frame.f_globals.get('__name__') == __name__:
93
+ frame = frame.f_back
94
+ level += 1
95
+ return level
96
+
97
+
98
+ @dataclasses.dataclass(frozen=True)
99
+ class _Route:
100
+ """How one call's backend was chosen. It travels with the call (never stored on the
101
+ facade), so concurrent ``run_async`` jobs on one facade cannot see each other's."""
102
+ # The backend name as requested or defaulted; None for an fm-level operation.
103
+ name: Optional[str] = None
104
+ # True when the choice is the query planner's (backend='auto').
105
+ auto: bool = False
106
+ # None (historical default), 'explicit', or 'auto: <planner rationale>'.
107
+ planner: Optional[str] = None
108
+ # Set when the backend ignores part of the model (its manifest does not support the
109
+ # model's language level): the warning to emit; the result is then not exact.
110
+ level_gap: Optional[str] = None
111
+
112
+
113
+ def _stamp(envelope: OperationResult[Any], route: _Route,
114
+ model: VariabilityModel) -> OperationResult[Any]:
115
+ """Record on a result envelope how its backend was chosen and whether it is exact."""
116
+ if route.planner is not None:
117
+ envelope = dataclasses.replace(envelope, planner=route.planner)
118
+ if route.level_gap is not None:
119
+ envelope = dataclasses.replace(envelope, exact=False)
120
+ if getattr(model, '_flamapy_cache_hit', False):
121
+ envelope = dataclasses.replace(envelope, cache_hit=True)
122
+ return envelope
123
+
124
+
125
+ def _warn_level_gap(route: _Route) -> None:
126
+ if route.level_gap is not None:
127
+ warnings.warn(route.level_gap, UserWarning, stacklevel=_caller_stacklevel())
128
+
42
129
 
43
130
  class FLAMAFeatureModel:
44
131
  """A feature model together with the analysis operations discovered from the installed plugins.
@@ -47,18 +134,43 @@ class FLAMAFeatureModel:
47
134
  them as normal methods, e.g. ``FLAMAFeatureModel(path).satisfiable()``.
48
135
  """
49
136
 
50
- def __init__(self, model_path: str, backend: Optional[str] = None) -> None:
137
+ def __init__(self, model_path: str, backend: Optional[str] = None, *,
138
+ allow_approximate: Optional[bool] = None,
139
+ raise_errors: Optional[bool] = None) -> None:
51
140
  """``model_path`` is the filesystem path to the model (UVL, FaMaXML or FeatureIDE).
52
141
 
53
- ``backend`` optionally sets a workspace-wide default backend ("sat", "bdd" or "z3") for
54
- every operation that supports more than one. When left as ``None`` each operation keeps its
55
- historical default, so existing code behaves exactly as before.
142
+ ``backend`` optionally sets a workspace-wide default backend ("sat", "bdd" or "z3",
143
+ plus "sharpsat"/"sdd"/"dnnf" when the corresponding optional flamapy extra is
144
+ installed) for every operation that supports more than one. When left as ``None``
145
+ each operation keeps its historical default, so existing code behaves exactly as
146
+ before. ``atomic_sets`` and ``commonality``, selectable only since 2.9, follow just a
147
+ per-call ``backend=`` in 2.x.
148
+
149
+ ``allow_approximate`` lets the ``'auto'`` backend choose approximate implementations
150
+ (e.g. sharpsat's ApproxMC counting, or the structural core features that ignore
151
+ cross-tree constraints); by default the planner only picks exact ones. It has no
152
+ effect on other backends. ``None`` falls back to ``FLAMAPY_ALLOW_APPROXIMATE=1``; a
153
+ per-call ``allow_approximate=`` overrides both.
154
+
155
+ ``raise_errors`` opts into the 3.0 error contract today: a failing operation raises
156
+ its ``FlamaException`` instead of logging it and returning ``None``. ``None`` falls
157
+ back to ``FLAMAPY_RAISE_ERRORS=1``, which also applies to the producers (e.g.
158
+ ``generate_random_feature_model``).
159
+
160
+ Both flags are keyword-only.
56
161
  """
57
162
  self.model_path = model_path
58
163
  self.discover_metamodel = DiscoverMetamodels()
59
164
  self.fm_model = self._read(model_path)
60
165
  self.backend = Backend(backend) if backend is not None else None
166
+ self.allow_approximate = allow_approximate
167
+ self.raise_errors = raise_errors
61
168
  self._backend_models: Dict[str, VariabilityModel] = {}
169
+ # Provenance envelope of the last executed operation (value, plugin, backend, exact,
170
+ # wall time, model hash). Purely informational in 2.9; methods still return bare
171
+ # values. In 3.0 the envelope becomes the return type.
172
+ self.last_result: Optional[OperationResult] = None
173
+ self._model_language_level: Optional[LanguageLevel] = None
62
174
 
63
175
  def _read(self, model_path: str) -> FeatureModel:
64
176
  return self.discover_metamodel.use_transformation_t2m(model_path, "fm")
@@ -77,62 +189,281 @@ class FLAMAFeatureModel:
77
189
  return Configuration(configuration)
78
190
  return self.discover_metamodel.use_transformation_t2m(configuration, "configuration")
79
191
 
80
- def _model_for(
81
- self, descriptor: OperationDescriptor, backend_arg: Optional[str]
82
- ) -> VariabilityModel:
83
- """Resolve the operation's target model, lazily transforming (and caching) fm->backend.
84
-
85
- The backend is the per-call one > workspace default > the operation's default (for
86
- backend-selectable ops), or simply the fixed default. When it resolves to ``None`` (an
87
- fm-level op, or a selectable op with no backend requested) the operation runs on the feature
88
- model directly. Otherwise the name is mapped to a transformation extension (only
89
- ``sat -> pysat`` differs) and cached per extension.
192
+ def _route(self, descriptor: OperationDescriptor, backend_arg: Optional[str]) -> _Route:
193
+ """Decide which backend a call runs on, without building anything.
194
+
195
+ The backend is the per-call one > workspace default > the ``FLAMAPY_BACKEND``
196
+ environment variable > the operation's default (for backend-selectable ops), or
197
+ simply the fixed default. The value ``'auto'`` (opt-in) hands the choice to the
198
+ query planner; ``None`` (an fm-level op, or a selectable op with no backend
199
+ requested) runs the operation on the feature model directly.
90
200
  """
201
+ defaults_apply = (descriptor.selectable_backend
202
+ and descriptor.name not in _SELECTABLE_SINCE_2_9)
203
+ workspace_default = (self.backend or os.environ.get('FLAMAPY_BACKEND')
204
+ if defaults_apply else None)
91
205
  if descriptor.selectable_backend:
92
- resolved = backend_arg or self.backend or descriptor.default_backend
206
+ resolved = backend_arg or workspace_default or descriptor.default_backend
93
207
  else:
94
208
  resolved = descriptor.default_backend
95
209
  if resolved is None:
96
- return self.fm_model
210
+ return _Route()
97
211
  name = resolved.value if isinstance(resolved, Backend) else str(resolved)
212
+ if name == Backend.AUTO.value and descriptor.selectable_backend:
213
+ return _Route(name=name, auto=True)
214
+ return _Route(
215
+ name=name,
216
+ planner='explicit' if backend_arg or workspace_default else None,
217
+ level_gap=self._level_gap(name, descriptor.selectable_backend))
218
+
219
+ def _level_gap(self, name: str, selectable: bool) -> Optional[str]:
220
+ """The warning for a backend whose manifest does not support the model's language
221
+ level (e.g. sat/bdd ignore arithmetic constraints), or None when it does.
222
+
223
+ In 2.9 this only warns, and the result is marked inexact; flamapy 3.0 raises
224
+ NoCompatibleBackendError instead, like backend='auto' does when no installed plugin
225
+ supports the model.
226
+ """
98
227
  extension = _BACKEND_ALIAS.get(name, name)
228
+ try:
229
+ manifest = self.discover_metamodel.plugins.get_plugin_by_extension(extension).manifest
230
+ except PluginNotFound:
231
+ return None # an unknown backend fails later, when its model is built
232
+ model_level = self._language_level()
233
+ if manifest.supports(model_level):
234
+ return None
235
+ advice = ''
236
+ if selectable and self._z3_supports(model_level) and name != Backend.Z3.value:
237
+ advice = " Use backend='auto' or backend='z3'."
238
+ return (f"The '{name}' backend supports ({manifest.supported_level}), but this model "
239
+ f"is ({model_level}): constraints beyond the backend's level are ignored, so "
240
+ f"the result is not exact.{advice}")
241
+
242
+ def _z3_supports(self, model_level: LanguageLevel) -> bool:
243
+ try:
244
+ plugin = self.discover_metamodel.plugins.get_plugin_by_extension(Backend.Z3.value)
245
+ except PluginNotFound:
246
+ return False
247
+ return plugin.manifest.supports(model_level)
248
+
249
+ def _model_for(
250
+ self, descriptor: OperationDescriptor, route: _Route,
251
+ allow_approximate: Optional[bool] = None,
252
+ ) -> tuple[VariabilityModel, _Route]:
253
+ """Build the route's target model, lazily transforming (and caching) fm->backend.
254
+
255
+ A backend name is mapped to a transformation extension (only ``sat -> pysat``
256
+ differs) and cached per extension. Returns the route too: for ``'auto'`` it now
257
+ carries the planner's rationale.
258
+ """
259
+ if route.name is None:
260
+ return self.fm_model, route
261
+ if route.auto:
262
+ return self._model_via_planner(
263
+ descriptor, route, self._approximate_allowed(allow_approximate))
264
+ return self._backend_model(_BACKEND_ALIAS.get(route.name, route.name)), route
265
+
266
+ def _backend_model(self, extension: str) -> VariabilityModel:
267
+ if extension == self.fm_model.get_extension():
268
+ return self.fm_model
99
269
  if extension not in self._backend_models:
100
270
  self._backend_models[extension] = self.discover_metamodel.use_transformation_m2m(
101
271
  self.fm_model, extension)
102
272
  return self._backend_models[extension]
103
273
 
274
+ def _language_level(self) -> LanguageLevel:
275
+ if self._model_language_level is None:
276
+ self._model_language_level = calculate_language_level(self.fm_model)
277
+ return self._model_language_level
278
+
279
+ def _approximate_allowed(self, per_call: Optional[bool]) -> bool:
280
+ """Per-call flag > the model's setting > the FLAMAPY_ALLOW_APPROXIMATE variable."""
281
+ if per_call is not None:
282
+ return per_call
283
+ if self.allow_approximate is not None:
284
+ return self.allow_approximate
285
+ return _env_flag('FLAMAPY_ALLOW_APPROXIMATE')
286
+
287
+ def _plan_operation(self, operation_name: str, allow_approximate: bool = False) -> Plan:
288
+ """Ask the query planner which backend should run ``operation_name`` on this model.
289
+
290
+ The backend models this facade has already built count as free for the planner.
291
+ """
292
+ edges = [(t.get_source_extension(), t.get_destination_extension())
293
+ for t in self.discover_metamodel.get_transformations_m2m()]
294
+ model_hash = self.fm_model.canonical_hash()
295
+ return plan_backend(
296
+ operation_name,
297
+ source_extension=self.fm_model.get_extension(),
298
+ model_level=self._language_level(),
299
+ n_features=len(self.fm_model.get_features()),
300
+ plugins=self.discover_metamodel.plugins,
301
+ m2m_edges=edges,
302
+ artifact_available=lambda ext: artifact_cache.available_for(model_hash, ext),
303
+ available_models=set(self._backend_models),
304
+ allow_approximate=allow_approximate,
305
+ )
306
+
307
+ def plan(self, operation: str, *, allow_approximate: Optional[bool] = None) -> Plan:
308
+ """Which backend ``backend='auto'`` would run ``operation`` on this model, and why.
309
+
310
+ Returns the planner's :class:`~flamapy.core.planner.Plan` (plugin, target extension,
311
+ transformation chain, rationale, estimated cost in ms, alternatives) without running
312
+ anything. Raises :class:`~flamapy.core.exceptions.NoCompatibleBackendError` when no
313
+ installed plugin can run the operation on this model, and ``FlamaException`` when
314
+ ``operation`` is not a backend-selectable facade operation. ``allow_approximate``
315
+ falls back to the model's setting and the environment, like the operations do.
316
+ """
317
+ method = getattr(type(self), operation, None)
318
+ descriptor = getattr(method, '_facade_descriptor', None)
319
+ if descriptor is None or not descriptor.selectable_backend:
320
+ raise FlamaException(f"'{operation}' is not a backend-selectable facade operation.")
321
+ return self._plan_operation(operation, self._approximate_allowed(allow_approximate))
322
+
323
+ def _model_via_planner(self, descriptor: OperationDescriptor, route: _Route,
324
+ allow_approximate: bool = False) -> tuple[VariabilityModel, _Route]:
325
+ chosen = self._plan_operation(descriptor.name, allow_approximate)
326
+ route = dataclasses.replace(route, planner=f'auto: {chosen.rationale}')
327
+ model = self.fm_model
328
+ for _, destination in chosen.transformation_chain:
329
+ if destination not in self._backend_models:
330
+ self._backend_models[destination] = (
331
+ self.discover_metamodel.use_transformation_m2m(model, destination))
332
+ model = self._backend_models[destination]
333
+ return model, route
334
+
335
+ def _prepare_operation(
336
+ self, descriptor: OperationDescriptor, backend_arg: Optional[str],
337
+ call_kwargs: Dict[str, Any], allow_approximate: Optional[bool] = None,
338
+ route: Optional[_Route] = None,
339
+ ) -> tuple[Any, VariabilityModel, _Route]:
340
+ """Resolve the target model and a fully input-wired operation instance.
341
+
342
+ ``route`` is passed by a caller that already decided it (and warned) on the user's
343
+ thread; otherwise it is decided, and its warning emitted, here.
344
+ """
345
+ if route is None:
346
+ route = self._route(descriptor, backend_arg)
347
+ _warn_level_gap(route)
348
+ model, route = self._model_for(descriptor, route, allow_approximate)
349
+ operation = self.discover_metamodel.get_operation(model, descriptor.operation)
350
+ if descriptor.input_adapter is not None:
351
+ descriptor.input_adapter(operation, self, call_kwargs)
352
+ else:
353
+ for input_spec in descriptor.inputs:
354
+ value = call_kwargs.get(input_spec.name)
355
+ if value is None:
356
+ continue
357
+ if input_spec.kind == 'configuration':
358
+ value = self._as_configuration(value)
359
+ if input_spec.setter is not None:
360
+ getattr(operation, input_spec.setter)(value)
361
+ return operation, model, route
362
+
104
363
  def _run_operation(
105
364
  self, descriptor: OperationDescriptor, call_kwargs: Dict[str, Any]
106
365
  ) -> Any:
107
366
  """Resolve model + operation, wire inputs, execute, and marshal the result.
108
367
 
109
368
  Preserves the facade's historical contract: any :class:`FlamaException` is logged and the
110
- call returns ``None``.
369
+ call returns ``None``, unless ``raise_errors`` (or ``FLAMAPY_RAISE_ERRORS=1``) asks for
370
+ the 3.0 contract, which raises it.
111
371
  """
372
+ self.last_result = None
112
373
  try:
113
374
  backend_arg = call_kwargs.pop('backend', None)
114
- model = self._model_for(descriptor, backend_arg)
115
- operation = self.discover_metamodel.get_operation(model, descriptor.operation)
116
- if descriptor.input_adapter is not None:
117
- descriptor.input_adapter(operation, self, call_kwargs)
118
- else:
119
- for input_spec in descriptor.inputs:
120
- value = call_kwargs.get(input_spec.name)
121
- if value is None:
122
- continue
123
- if input_spec.kind == 'configuration':
124
- value = self._as_configuration(value)
125
- if input_spec.setter is not None:
126
- getattr(operation, input_spec.setter)(value)
127
- operation.execute(model)
128
- result = operation.get_result()
375
+ allow_approximate = call_kwargs.pop('allow_approximate', None)
376
+ operation, model, route = self._prepare_operation(
377
+ descriptor, backend_arg, call_kwargs, allow_approximate)
378
+ # The hash is always the source feature model's (memoized there), whichever
379
+ # backend model the operation actually runs on.
380
+ envelope = run_and_wrap(
381
+ operation, model,
382
+ operation_name=descriptor.name, plugin=self._plugin_name_for(model),
383
+ model_hash=self.fm_model.canonical_hash())
129
384
  if descriptor.result_adapter is not None:
130
- result = descriptor.result_adapter(result)
131
- return result
385
+ envelope = dataclasses.replace(
386
+ envelope, value=descriptor.result_adapter(envelope.value))
387
+ envelope = _stamp(envelope, route, model)
388
+ self.last_result = envelope
389
+ return envelope.value
132
390
  except FlamaException as exception:
391
+ if _raise_errors(self.raise_errors):
392
+ raise
133
393
  logger.error("Error: %s", exception)
394
+ warnings.warn(
395
+ "Returning None on operation errors is deprecated: flamapy 3.0 will raise "
396
+ "the FlamaException instead. Catch FlamaException rather than checking for "
397
+ "None.", DeprecationWarning, stacklevel=3)
398
+ return None
399
+
400
+ def _plugin_name_for(self, model: VariabilityModel) -> Optional[str]:
401
+ try:
402
+ return self.discover_metamodel.plugins.get_plugin_by_variability_model(model).name
403
+ except PluginNotFound:
134
404
  return None
135
405
 
406
+ def run_async(self, operation: str, **kwargs: Any) -> Job:
407
+ """Run a facade operation asynchronously; returns a :class:`Job` immediately.
408
+
409
+ ``operation`` is the facade name (e.g. ``'configurations_number'``); ``kwargs``
410
+ are the same arguments the synchronous method takes (including ``backend=``).
411
+ ``job.result(timeout=...)`` waits for the value, raising ``OperationTimeout`` on
412
+ expiry (after requesting cooperative cancellation) — unlike the 2.x synchronous
413
+ methods, errors are **raised**, not swallowed into ``None``.
414
+
415
+ Everything after choosing the backend runs inside the job — including the
416
+ fm->backend transformation (e.g. BDD compilation, often the expensive step on large
417
+ models) — so the timeout covers it and preparation errors (unknown backend,
418
+ invalid inputs) are raised by ``job.result()``. The envelope (``job.envelope()``)
419
+ carries the same provenance as the synchronous ``last_result``; the warning about a
420
+ backend that ignores part of the model is emitted here, by the call itself.
421
+ """
422
+ method = getattr(type(self), operation, None)
423
+ descriptor = getattr(method, '_facade_descriptor', None)
424
+ if descriptor is None or getattr(method, '_facade_kind', None) != 'operation':
425
+ raise FlamaException(f"'{operation}' is not a facade analysis operation.")
426
+ call_kwargs = dict(kwargs)
427
+ backend_arg = call_kwargs.pop('backend', None)
428
+ allow_approximate = call_kwargs.pop('allow_approximate', None)
429
+ # Decided (and warned about) on the caller's thread: the route belongs to this job
430
+ # alone, and a warning raised from the worker would point into the thread pool.
431
+ route = self._route(descriptor, backend_arg)
432
+ _warn_level_gap(route)
433
+
434
+ def task(interrupt_event: threading.Event) -> OperationResult[Any]:
435
+ prepared, model, job_route = self._prepare_operation(
436
+ descriptor, backend_arg, call_kwargs, allow_approximate, route)
437
+ if interrupt_event.is_set():
438
+ # The deadline expired (or cancel() was called) during preparation: the
439
+ # caller has already given up, so don't start the operation at all.
440
+ raise OperationTimeout(
441
+ f"'{descriptor.name}' was cancelled before execution started.")
442
+ if isinstance(prepared, Interruptible):
443
+ prepared.set_interrupt_event(interrupt_event)
444
+ envelope = run_and_wrap(
445
+ prepared, model,
446
+ operation_name=descriptor.name, plugin=self._plugin_name_for(model),
447
+ model_hash=self.fm_model.canonical_hash())
448
+ return _stamp(envelope, job_route, model)
449
+
450
+ return default_engine().submit_call(task, result_adapter=descriptor.result_adapter)
451
+
452
+ def iter_configurations(self, backend: Optional[str] = None) -> Iterator[Configuration]:
453
+ """Iterate the valid configurations, yielding each as the solver produces it.
454
+
455
+ Unlike :meth:`configurations` (whose historical default is bdd), the backend
456
+ defaults to ``sat`` — the streaming-capable implementation. Non-streaming
457
+ backends fall back to full enumeration first. Same errors contract as
458
+ :meth:`run_async` (raises, never ``None``).
459
+ """
460
+ descriptor = type(self).configurations._facade_descriptor # type: ignore[attr-defined]
461
+ operation, model, _ = self._prepare_operation(descriptor, backend or 'sat', {})
462
+ if isinstance(operation, StreamingOperation):
463
+ return operation.iter_execute(model)
464
+ operation.execute(model)
465
+ return iter(operation.get_result())
466
+
136
467
 
137
468
  # One discovery instance, reused to install the operations and to run producers (which have no
138
469
  # per-facade instance to hold their own).
@@ -143,7 +474,9 @@ def _run_producer(descriptor: OperationDescriptor, call_kwargs: Dict[str, Any])
143
474
  """Run a 'producer' operation — one that *creates* a model instead of analysing one.
144
475
 
145
476
  Producers take no input model, so the operation is instantiated directly and executed with no
146
- model. Same FlamaException -> None contract as :meth:`FLAMAFeatureModel._run_operation`.
477
+ model. Same FlamaException -> None contract as :meth:`FLAMAFeatureModel._run_operation`;
478
+ ``FLAMAPY_RAISE_ERRORS=1`` makes it raise instead (producers have no instance to carry
479
+ ``raise_errors``).
147
480
  """
148
481
  try:
149
482
  operation_class = next(
@@ -161,10 +494,21 @@ def _run_producer(descriptor: OperationDescriptor, call_kwargs: Dict[str, Any])
161
494
  result = descriptor.result_adapter(result)
162
495
  return result
163
496
  except FlamaException as exception:
497
+ if _raise_errors(None):
498
+ raise
164
499
  logger.error("Error: %s", exception)
500
+ warnings.warn(
501
+ "Returning None on operation errors is deprecated: flamapy 3.0 will raise "
502
+ "the FlamaException instead. Catch FlamaException rather than checking for "
503
+ "None.", DeprecationWarning, stacklevel=3)
165
504
  return None
166
505
 
167
506
 
507
+ _SELECTABLE_NOTE = (
508
+ '\n\n``backend`` chooses the plugin that runs the operation (``"auto"`` lets the query '
509
+ 'planner choose); ``allow_approximate`` only has an effect with ``backend="auto"``.')
510
+
511
+
168
512
  def _make_operation_method(descriptor: OperationDescriptor) -> Any:
169
513
  """Build a real callable from a descriptor.
170
514
 
@@ -184,6 +528,10 @@ def _make_operation_method(descriptor: OperationDescriptor) -> Any:
184
528
  parameters.append(inspect.Parameter(
185
529
  'backend', inspect.Parameter.POSITIONAL_OR_KEYWORD, default=None,
186
530
  annotation=Optional[str]))
531
+ # Only meaningful under backend='auto': let the planner pick approximate backends.
532
+ parameters.append(inspect.Parameter(
533
+ 'allow_approximate', inspect.Parameter.KEYWORD_ONLY, default=None,
534
+ annotation=Optional[bool]))
187
535
  signature = inspect.Signature(parameters)
188
536
 
189
537
  def method(*args: Any, **kwargs: Any) -> Any:
@@ -197,7 +545,7 @@ def _make_operation_method(descriptor: OperationDescriptor) -> Any:
197
545
 
198
546
  method.__name__ = descriptor.name
199
547
  method.__qualname__ = f'{FLAMAFeatureModel.__name__}.{descriptor.name}'
200
- method.__doc__ = descriptor.doc
548
+ method.__doc__ = descriptor.doc + (_SELECTABLE_NOTE if descriptor.selectable_backend else '')
201
549
  method.__signature__ = signature # type: ignore[attr-defined]
202
550
  # Let the CLI/REST/tests tell analysis ops from producers/transformers without re-discovering.
203
551
  setattr(method, '_facade_kind', descriptor.kind)
@@ -211,4 +559,10 @@ def _install_operations(cls: type) -> None:
211
559
  setattr(cls, name, staticmethod(method) if descriptor.kind == 'producer' else method)
212
560
 
213
561
 
562
+ # Async/streaming API methods, not descriptor-generated operations: the CLI generator and
563
+ # the descriptor lock test filter on _facade_kind != 'operation'.
564
+ FLAMAFeatureModel.plan._facade_kind = 'api' # type: ignore[attr-defined]
565
+ FLAMAFeatureModel.run_async._facade_kind = 'api' # type: ignore[attr-defined]
566
+ FLAMAFeatureModel.iter_configurations._facade_kind = 'api' # type: ignore[attr-defined]
567
+
214
568
  _install_operations(FLAMAFeatureModel)
@@ -1,8 +1,10 @@
1
1
  # Auto-generated by flamapy.interfaces.python._stub — do not edit by hand.
2
2
  # Regenerate with: python -m flamapy.interfaces.python._stub
3
3
  from enum import Enum
4
- from typing import Any, Dict, List, Optional, Tuple, Union
4
+ from typing import Any, Dict, List, Optional, Tuple, Union # noqa: F401
5
5
 
6
+ from flamapy.core.operations import OperationResult
7
+ from flamapy.core.planner import Plan
6
8
  from flamapy.metamodels.configuration_metamodel.models import Configuration
7
9
  from flamapy.metamodels.fm_metamodel.models import FeatureModel
8
10
 
@@ -12,52 +14,71 @@ class Backend(str, Enum):
12
14
  BDD = ...
13
15
  Z3 = ...
14
16
  SHARPSAT = ...
17
+ SDD = ...
18
+ DNNF = ...
19
+ AUTO = ...
15
20
 
16
21
 
17
22
  class FLAMAFeatureModel:
18
23
  model_path: str
19
24
  fm_model: FeatureModel
20
25
  backend: Optional[Backend]
21
- def __init__(self, model_path: str, backend: Optional[str] = ...) -> None: ...
22
- def all_feature_bounds(self) -> Union[None, Dict[str, Dict[str, Any]]]: ...
23
- def atomic_sets(self) -> Union[None, List[List[Any]]]: ...
24
- def attribute_optimization(self, objectives: Any, backend: Optional[str] = ...) -> Union[None, List[Configuration]]: ...
25
- def average_branching_factor(self) -> Union[None, float]: ...
26
- def backbone(self) -> Union[None, Dict[str, List[Any]]]: ...
27
- def commonality(self, configuration_path: str) -> Union[None, float]: ...
28
- def configuration_conflict(self, configuration_path: str) -> Union[None, List[Any]]: ...
29
- def configuration_repair(self, configuration_path: str) -> Union[None, List[Any]]: ...
30
- def configurations(self, backend: Optional[str] = ...) -> Union[None, List[Configuration]]: ...
31
- def configurations_number(self, backend: Optional[str] = ...) -> Union[None, int]: ...
32
- def configurations_with_n_features(self, n: int) -> Union[None, List[Configuration]]: ...
33
- def conflict(self, configuration_path: str, test_case_path: Optional[str] = ..., max_conflicts: Optional[int] = ...) -> Union[None, List[str]]: ...
34
- def core_features(self, backend: Optional[str] = ...) -> Union[None, List[str]]: ...
35
- def count_leafs(self) -> Union[None, int]: ...
36
- def dead_features(self, backend: Optional[str] = ...) -> Union[None, List[str]]: ...
37
- def diagnosis(self, configuration_path: str, test_case_path: Optional[str] = ..., max_diagnoses: Optional[int] = ...) -> Union[None, List[str]]: ...
38
- def estimated_number_of_configurations(self) -> Union[None, int]: ...
39
- def false_optional_features(self, backend: Optional[str] = ...) -> Union[None, List[str]]: ...
40
- def feature_ancestors(self, feature_name: str) -> Union[None, List[str]]: ...
41
- def feature_bounds(self, variable_name: str) -> Union[None, Dict[str, Any]]: ...
42
- def feature_explanation(self, configuration_path: str, feature_name: str) -> Union[None, List[Any]]: ...
43
- def feature_inclusion_probability(self) -> Union[None, Dict[str, float]]: ...
44
- def filter(self, configuration_path: str) -> Union[None, List[Configuration]]: ...
26
+ allow_approximate: Optional[bool]
27
+ raise_errors: Optional[bool]
28
+ last_result: Optional[OperationResult[Any]]
29
+ def __init__(self, model_path: str, backend: Optional[str] = ...,
30
+ *, allow_approximate: Optional[bool] = ...,
31
+ raise_errors: Optional[bool] = ...) -> None: ...
32
+ def plan(self, operation: str, *, allow_approximate: Optional[bool] = ...) -> Plan: ...
33
+ def _plan_operation(self, operation_name: str, allow_approximate: bool = ...) -> Plan: ...
34
+ def run_async(self, operation: str, **kwargs: Any) -> Any: ...
35
+ def iter_configurations(self, backend: Optional[str] = ...) -> Any: ...
36
+ def all_feature_bounds(self) -> Optional[Dict[str, Dict[str, Any]]]: ...
37
+ def atomic_sets(self, backend: Optional[str] = ..., *, allow_approximate: Optional[bool] = ...) -> Optional[List[List[Any]]]: ...
38
+ def attribute_optimization(self, objectives: Any, backend: Optional[str] = ..., *, allow_approximate: Optional[bool] = ...) -> Optional[List[Configuration]]: ...
39
+ def average_branching_factor(self) -> Optional[float]: ...
40
+ def backbone(self) -> Optional[Dict[str, List[Any]]]: ...
41
+ def commonality(self, configuration_path: str, backend: Optional[str] = ..., *, allow_approximate: Optional[bool] = ...) -> Optional[float]: ...
42
+ def configuration_conflict(self, configuration_path: str) -> Optional[List[Any]]: ...
43
+ def configuration_repair(self, configuration_path: str) -> Optional[List[Any]]: ...
44
+ def configurations(self, backend: Optional[str] = ..., *, allow_approximate: Optional[bool] = ...) -> Optional[List[Configuration]]: ...
45
+ def configurations_number(self, backend: Optional[str] = ..., *, allow_approximate: Optional[bool] = ...) -> Optional[int]: ...
46
+ def configurations_with_n_features(self, n: int) -> Optional[List[Configuration]]: ...
47
+ def conflict(self, configuration_path: str, test_case_path: Optional[str] = ..., max_conflicts: Optional[int] = ...) -> Optional[List[str]]: ...
48
+ def core_features(self, backend: Optional[str] = ..., *, allow_approximate: Optional[bool] = ...) -> Optional[List[str]]: ...
49
+ def count_leafs(self) -> Optional[int]: ...
50
+ def coverage(self, configurations: Any, t: int = ...) -> Optional[float]: ...
51
+ def covering_array(self, t: int = ..., seed: Optional[int] = ...) -> Optional[List[Configuration]]: ...
52
+ def dead_features(self, backend: Optional[str] = ..., *, allow_approximate: Optional[bool] = ...) -> Optional[List[str]]: ...
53
+ def diagnosis(self, configuration_path: str, test_case_path: Optional[str] = ..., max_diagnoses: Optional[int] = ...) -> Optional[List[str]]: ...
54
+ def estimated_number_of_configurations(self) -> Optional[int]: ...
55
+ def explain_dead_feature(self, feature_name: str) -> Optional[List[str]]: ...
56
+ def explain_false_optional(self, feature_name: str) -> Optional[List[str]]: ...
57
+ def explain_void_model(self) -> Optional[List[str]]: ...
58
+ def false_optional_features(self, backend: Optional[str] = ..., *, allow_approximate: Optional[bool] = ...) -> Optional[List[str]]: ...
59
+ def feature_ancestors(self, feature_name: str) -> Optional[List[str]]: ...
60
+ def feature_bounds(self, variable_name: str) -> Optional[Dict[str, Any]]: ...
61
+ def feature_explanation(self, configuration_path: str, feature_name: str) -> Optional[List[Any]]: ...
62
+ def feature_inclusion_probability(self) -> Optional[Dict[str, float]]: ...
63
+ def filter(self, configuration_path: str) -> Optional[List[Configuration]]: ...
45
64
  def generate_random_attribute(self, name: str, min_value: int = ..., max_value: int = ..., only_leaf_features: bool = ...) -> FeatureModel: ...
46
65
  @staticmethod
47
66
  def generate_random_feature_model(num_features: int = ..., max_constraints: int = ..., seed: int = ..., void: bool = ..., language_level: str = ...) -> FeatureModel: ...
48
- def homogeneity(self) -> Union[None, float]: ...
49
- def language_level(self) -> Union[None, Any]: ...
50
- def leaf_features(self) -> Union[None, List[str]]: ...
51
- def max_depth(self) -> Union[None, int]: ...
52
- def metrics(self) -> Union[None, List[Dict[str, Any]]]: ...
53
- def minimum_configuration(self, backend: Optional[str] = ...) -> Union[None, Configuration]: ...
54
- def product_distribution(self) -> Union[None, List[int]]: ...
55
- def pure_optional_features(self) -> Union[None, List[str]]: ...
56
- def sampling(self, size: int, with_replacement: bool = ..., backend: Optional[str] = ...) -> Union[None, List[Configuration]]: ...
57
- def satisfiable(self, backend: Optional[str] = ...) -> Union[None, bool]: ...
58
- def satisfiable_configuration(self, configuration_path: str, full_configuration: bool = ..., backend: Optional[str] = ...) -> Union[None, bool]: ...
59
- def t_wise_sampling(self, t: int = ..., backend: Optional[str] = ...) -> Union[None, List[Configuration]]: ...
60
- def unique_features(self) -> Union[None, List[str]]: ...
61
- def variability(self) -> Union[None, Tuple[float, float]]: ...
62
- def variant_features(self) -> Union[None, List[str]]: ...
63
- def variation_points(self) -> Union[None, Dict[str, List[str]]]: ...
67
+ def homogeneity(self) -> Optional[float]: ...
68
+ def language_level(self) -> Optional[Any]: ...
69
+ def leaf_features(self) -> Optional[List[str]]: ...
70
+ def max_depth(self) -> Optional[int]: ...
71
+ def metrics(self) -> Optional[List[Dict[str, Any]]]: ...
72
+ def minimal_corrections(self, max_corrections: Optional[int] = ...) -> Optional[List[List[str]]]: ...
73
+ def minimum_configuration(self, backend: Optional[str] = ..., *, allow_approximate: Optional[bool] = ...) -> Optional[Configuration]: ...
74
+ def product_distribution(self) -> Optional[List[int]]: ...
75
+ def pure_optional_features(self) -> Optional[List[str]]: ...
76
+ def sample_reduction(self, configurations: Any, t: int = ...) -> Optional[List[Configuration]]: ...
77
+ def sampling(self, size: int, with_replacement: bool = ..., backend: Optional[str] = ..., *, allow_approximate: Optional[bool] = ...) -> Optional[List[Configuration]]: ...
78
+ def satisfiable(self, backend: Optional[str] = ..., *, allow_approximate: Optional[bool] = ...) -> Optional[bool]: ...
79
+ def satisfiable_configuration(self, configuration_path: str, full_configuration: bool = ..., backend: Optional[str] = ..., *, allow_approximate: Optional[bool] = ...) -> Optional[bool]: ...
80
+ def t_wise_sampling(self, t: int = ..., backend: Optional[str] = ..., *, allow_approximate: Optional[bool] = ...) -> Optional[List[Configuration]]: ...
81
+ def unique_features(self) -> Optional[List[str]]: ...
82
+ def variability(self) -> Optional[Tuple[float, float]]: ...
83
+ def variant_features(self) -> Optional[List[str]]: ...
84
+ def variation_points(self) -> Optional[Dict[str, List[str]]]: ...
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flamapy
3
- Version: 2.6.0.dev12
3
+ Version: 2.9.0.dev1
4
4
  Summary: Flamapy feature model is a distribution of the flama framework containing all plugins required to analyze feature models. It also offers a richer API and a complete command line interface and documentation.
5
5
  Author-email: Flamapy <flamapy@us.es>
6
6
  License-Expression: GPL-3.0-or-later
@@ -8,11 +8,21 @@ Project-URL: Homepage, https://github.com/flamapy/flamapy-feature-model
8
8
  Requires-Python: >=3.11
9
9
  Description-Content-Type: text/markdown
10
10
  License-File: LICENSE
11
- Requires-Dist: flamapy-fw~=2.6.0.dev12
12
- Requires-Dist: flamapy-fm~=2.6.0.dev12
13
- Requires-Dist: flamapy-sat~=2.6.0.dev12
14
- Requires-Dist: flamapy-bdd~=2.6.0.dev12
15
- Requires-Dist: flamapy-z3~=2.6.0.dev12
11
+ Requires-Dist: flamapy-fw~=2.9.0.dev1
12
+ Requires-Dist: flamapy-fm~=2.9.0.dev1
13
+ Requires-Dist: flamapy-sat~=2.9.0.dev1
14
+ Requires-Dist: flamapy-bdd~=2.9.0.dev1
15
+ Requires-Dist: flamapy-z3~=2.9.0.dev1
16
+ Provides-Extra: sharpsat
17
+ Requires-Dist: flamapy-sharpsat~=2.9.0.dev1; extra == "sharpsat"
18
+ Provides-Extra: dnnf
19
+ Requires-Dist: flamapy-dnnf~=2.9.0.dev1; extra == "dnnf"
20
+ Provides-Extra: sdd
21
+ Requires-Dist: flamapy-sdd~=2.9.0.dev1; extra == "sdd"
22
+ Provides-Extra: all-solvers
23
+ Requires-Dist: flamapy-sharpsat~=2.9.0.dev1; extra == "all-solvers"
24
+ Requires-Dist: flamapy-dnnf~=2.9.0.dev1; extra == "all-solvers"
25
+ Requires-Dist: flamapy-sdd~=2.9.0.dev1; extra == "all-solvers"
16
26
  Provides-Extra: dev
17
27
  Requires-Dist: pytest; extra == "dev"
18
28
  Requires-Dist: pytest-mock; extra == "dev"
@@ -0,0 +1,11 @@
1
+ flamapy/commands/__init__.py,sha256=DdRS2Xyt37H_k2YaaFWUcE6xfJALzllraerIup1l_OU,14646
2
+ flamapy/interfaces/python/__init__.py,sha256=NVQH1l6O9ElD8YvUVBXJN0Y_ETmu3AbyQBZJJ9qiuoU,86
3
+ flamapy/interfaces/python/_stub.py,sha256=7JMmnmxHFbpC7XHVqozZUooLwPbHS4p1-B8QXH5wQf8,3898
4
+ flamapy/interfaces/python/flamapy_feature_model.py,sha256=XIOEJpK5_Y-u-jAUILGuIzbV5m8t3WCkdF_DCmBM7KU,28743
5
+ flamapy/interfaces/python/flamapy_feature_model.pyi,sha256=u-GtNc1wRslPO1I2sIIsNuOxrdT-dR0GZpqzyskHT34,6189
6
+ flamapy-2.9.0.dev1.dist-info/licenses/LICENSE,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
7
+ flamapy-2.9.0.dev1.dist-info/METADATA,sha256=ePqosWPGhOVWkA8OE5whywSqISBqVnJDYanBWZKA1tE,1731
8
+ flamapy-2.9.0.dev1.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
9
+ flamapy-2.9.0.dev1.dist-info/entry_points.txt,sha256=CS_W4K9LW9xOf-7ymWD58KklNHBnhMHm0RXAZ9JLgVo,57
10
+ flamapy-2.9.0.dev1.dist-info/top_level.txt,sha256=2YBI9dg4GVk28AJuyNu6dldi5Riwt5SP0zpNe2lSU5M,8
11
+ flamapy-2.9.0.dev1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (82.0.1)
2
+ Generator: setuptools (84.2.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,11 +0,0 @@
1
- flamapy/commands/__init__.py,sha256=rajfqLxDAa5E4glNlLfUXQbIl5ZcgkGI6kTBKM9apSM,10144
2
- flamapy/interfaces/python/__init__.py,sha256=NVQH1l6O9ElD8YvUVBXJN0Y_ETmu3AbyQBZJJ9qiuoU,86
3
- flamapy/interfaces/python/_stub.py,sha256=SDlbrXrfQaJpgTzuScY-Q9IrkarGO96ad463NL0RJMY,2822
4
- flamapy/interfaces/python/flamapy_feature_model.py,sha256=sBZffI8CA4NA7Tzg9q7OaTCDKTV-EY-tWKQ8kdEEBkY,9840
5
- flamapy/interfaces/python/flamapy_feature_model.pyi,sha256=VdGtS3KdobqOEQfmvO_HTo2JkCNRB7UOWurKG4Xet64,4336
6
- flamapy-2.6.0.dev12.dist-info/licenses/LICENSE,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
7
- flamapy-2.6.0.dev12.dist-info/METADATA,sha256=-MRGwPu0iqotGx_mCjPPnuIOe5pw2CkOppIpX2lcPjU,1271
8
- flamapy-2.6.0.dev12.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
9
- flamapy-2.6.0.dev12.dist-info/entry_points.txt,sha256=CS_W4K9LW9xOf-7ymWD58KklNHBnhMHm0RXAZ9JLgVo,57
10
- flamapy-2.6.0.dev12.dist-info/top_level.txt,sha256=2YBI9dg4GVk28AJuyNu6dldi5Riwt5SP0zpNe2lSU5M,8
11
- flamapy-2.6.0.dev12.dist-info/RECORD,,