flamapy 2.9.0.dev2__tar.gz → 2.9.0.dev3__tar.gz

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.
Files changed (31) hide show
  1. {flamapy-2.9.0.dev2 → flamapy-2.9.0.dev3}/PKG-INFO +12 -12
  2. {flamapy-2.9.0.dev2 → flamapy-2.9.0.dev3}/flamapy/interfaces/python/flamapy_feature_model.py +21 -1
  3. {flamapy-2.9.0.dev2 → flamapy-2.9.0.dev3}/flamapy.egg-info/PKG-INFO +12 -12
  4. {flamapy-2.9.0.dev2 → flamapy-2.9.0.dev3}/flamapy.egg-info/SOURCES.txt +1 -0
  5. flamapy-2.9.0.dev3/flamapy.egg-info/requires.txt +26 -0
  6. {flamapy-2.9.0.dev2 → flamapy-2.9.0.dev3}/pyproject.toml +12 -12
  7. flamapy-2.9.0.dev3/tests/test_imports.py +69 -0
  8. flamapy-2.9.0.dev2/flamapy.egg-info/requires.txt +0 -26
  9. {flamapy-2.9.0.dev2 → flamapy-2.9.0.dev3}/LICENSE +0 -0
  10. {flamapy-2.9.0.dev2 → flamapy-2.9.0.dev3}/README.md +0 -0
  11. {flamapy-2.9.0.dev2 → flamapy-2.9.0.dev3}/flamapy/commands/__init__.py +0 -0
  12. {flamapy-2.9.0.dev2 → flamapy-2.9.0.dev3}/flamapy/interfaces/python/__init__.py +0 -0
  13. {flamapy-2.9.0.dev2 → flamapy-2.9.0.dev3}/flamapy/interfaces/python/_stub.py +0 -0
  14. {flamapy-2.9.0.dev2 → flamapy-2.9.0.dev3}/flamapy/interfaces/python/flamapy_feature_model.pyi +0 -0
  15. {flamapy-2.9.0.dev2 → flamapy-2.9.0.dev3}/flamapy.egg-info/dependency_links.txt +0 -0
  16. {flamapy-2.9.0.dev2 → flamapy-2.9.0.dev3}/flamapy.egg-info/entry_points.txt +0 -0
  17. {flamapy-2.9.0.dev2 → flamapy-2.9.0.dev3}/flamapy.egg-info/top_level.txt +0 -0
  18. {flamapy-2.9.0.dev2 → flamapy-2.9.0.dev3}/setup.cfg +0 -0
  19. {flamapy-2.9.0.dev2 → flamapy-2.9.0.dev3}/setup.py +0 -0
  20. {flamapy-2.9.0.dev2 → flamapy-2.9.0.dev3}/tests/test_2_9_compatibility.py +0 -0
  21. {flamapy-2.9.0.dev2 → flamapy-2.9.0.dev3}/tests/test_async_streaming.py +0 -0
  22. {flamapy-2.9.0.dev2 → flamapy-2.9.0.dev3}/tests/test_backend_level_warning.py +0 -0
  23. {flamapy-2.9.0.dev2 → flamapy-2.9.0.dev3}/tests/test_basic_units.py +0 -0
  24. {flamapy-2.9.0.dev2 → flamapy-2.9.0.dev3}/tests/test_cli_basic_units.py +0 -0
  25. {flamapy-2.9.0.dev2 → flamapy-2.9.0.dev3}/tests/test_descriptors_cover_facade.py +0 -0
  26. {flamapy-2.9.0.dev2 → flamapy-2.9.0.dev3}/tests/test_documentation_examples.py +0 -0
  27. {flamapy-2.9.0.dev2 → flamapy-2.9.0.dev3}/tests/test_fama_suite_bdd.py +0 -0
  28. {flamapy-2.9.0.dev2 → flamapy-2.9.0.dev3}/tests/test_fama_suite_sat.py +0 -0
  29. {flamapy-2.9.0.dev2 → flamapy-2.9.0.dev3}/tests/test_metrics_fanout.py +0 -0
  30. {flamapy-2.9.0.dev2 → flamapy-2.9.0.dev3}/tests/test_optimization_and_sampling.py +0 -0
  31. {flamapy-2.9.0.dev2 → flamapy-2.9.0.dev3}/tests/test_planner_routing.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flamapy
3
- Version: 2.9.0.dev2
3
+ Version: 2.9.0.dev3
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,21 +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.9.0.dev2
12
- Requires-Dist: flamapy-fm~=2.9.0.dev2
13
- Requires-Dist: flamapy-sat~=2.9.0.dev2
14
- Requires-Dist: flamapy-bdd~=2.9.0.dev2
15
- Requires-Dist: flamapy-z3~=2.9.0.dev2
11
+ Requires-Dist: flamapy-fw~=2.9.0.dev3
12
+ Requires-Dist: flamapy-fm~=2.9.0.dev3
13
+ Requires-Dist: flamapy-sat~=2.9.0.dev3
14
+ Requires-Dist: flamapy-bdd~=2.9.0.dev3
15
+ Requires-Dist: flamapy-z3~=2.9.0.dev3
16
16
  Provides-Extra: sharpsat
17
- Requires-Dist: flamapy-sharpsat~=2.9.0.dev2; extra == "sharpsat"
17
+ Requires-Dist: flamapy-sharpsat~=2.9.0.dev3; extra == "sharpsat"
18
18
  Provides-Extra: dnnf
19
- Requires-Dist: flamapy-dnnf~=2.9.0.dev2; extra == "dnnf"
19
+ Requires-Dist: flamapy-dnnf~=2.9.0.dev3; extra == "dnnf"
20
20
  Provides-Extra: sdd
21
- Requires-Dist: flamapy-sdd~=2.9.0.dev2; extra == "sdd"
21
+ Requires-Dist: flamapy-sdd~=2.9.0.dev3; extra == "sdd"
22
22
  Provides-Extra: all-solvers
23
- Requires-Dist: flamapy-sharpsat~=2.9.0.dev2; extra == "all-solvers"
24
- Requires-Dist: flamapy-dnnf~=2.9.0.dev2; extra == "all-solvers"
25
- Requires-Dist: flamapy-sdd~=2.9.0.dev2; extra == "all-solvers"
23
+ Requires-Dist: flamapy-sharpsat~=2.9.0.dev3; extra == "all-solvers"
24
+ Requires-Dist: flamapy-dnnf~=2.9.0.dev3; extra == "all-solvers"
25
+ Requires-Dist: flamapy-sdd~=2.9.0.dev3; extra == "all-solvers"
26
26
  Provides-Extra: dev
27
27
  Requires-Dist: pytest; extra == "dev"
28
28
  Requires-Dist: pytest-mock; extra == "dev"
@@ -32,6 +32,7 @@ from flamapy.core.operations import (
32
32
  from flamapy.core.planner import Plan, plan as plan_backend
33
33
  from flamapy.metamodels.configuration_metamodel.models import Configuration
34
34
  from flamapy.metamodels.fm_metamodel.models import FeatureModel
35
+ from flamapy.metamodels.fm_metamodel.transformations import FlatFM
35
36
  from flamapy.metamodels.fm_metamodel.operations.fm_language_level import (
36
37
  calculate_language_level,
37
38
  )
@@ -175,6 +176,16 @@ class FLAMAFeatureModel:
175
176
  self.model_path = model_path
176
177
  self.discover_metamodel = DiscoverMetamodels()
177
178
  self.fm_model = self._read(model_path)
179
+ # The backends identify a feature by its name, so two features with one name are
180
+ # analysed as a single feature: no result on such a model can be trusted. The result
181
+ # envelopes still say exact=True, which only tells whether the backend approximates.
182
+ repeated = self._repeated_names()
183
+ if repeated:
184
+ warnings.warn(
185
+ f"The model has {len(repeated)} feature name(s) used by more than one "
186
+ f"feature ({', '.join(repeated)}). Features are identified by name, so the "
187
+ "analysis results on this model cannot be guaranteed.",
188
+ UserWarning, stacklevel=2)
178
189
  self.backend = Backend(backend) if backend is not None else None
179
190
  self.allow_approximate = allow_approximate
180
191
  self.raise_errors = raise_errors
@@ -186,7 +197,16 @@ class FLAMAFeatureModel:
186
197
  self._model_language_level: Optional[LanguageLevel] = None
187
198
 
188
199
  def _read(self, model_path: str) -> FeatureModel:
189
- return self.discover_metamodel.use_transformation_t2m(model_path, "fm")
200
+ model = self.discover_metamodel.use_transformation_t2m(model_path, "fm")
201
+ if getattr(model, 'imports', None):
202
+ # The analyses work on one tree: without this the imported models would count
203
+ # as leaf features, and their features and constraints would be ignored.
204
+ model = FlatFM(model).transform()
205
+ return model
206
+
207
+ def _repeated_names(self) -> list[str]:
208
+ names = [feature.name for feature in self.fm_model.get_features()]
209
+ return sorted({name for name in names if names.count(name) > 1})
190
210
 
191
211
  def _as_configuration(
192
212
  self, configuration: Union[str, Dict[str, Any], Configuration]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flamapy
3
- Version: 2.9.0.dev2
3
+ Version: 2.9.0.dev3
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,21 +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.9.0.dev2
12
- Requires-Dist: flamapy-fm~=2.9.0.dev2
13
- Requires-Dist: flamapy-sat~=2.9.0.dev2
14
- Requires-Dist: flamapy-bdd~=2.9.0.dev2
15
- Requires-Dist: flamapy-z3~=2.9.0.dev2
11
+ Requires-Dist: flamapy-fw~=2.9.0.dev3
12
+ Requires-Dist: flamapy-fm~=2.9.0.dev3
13
+ Requires-Dist: flamapy-sat~=2.9.0.dev3
14
+ Requires-Dist: flamapy-bdd~=2.9.0.dev3
15
+ Requires-Dist: flamapy-z3~=2.9.0.dev3
16
16
  Provides-Extra: sharpsat
17
- Requires-Dist: flamapy-sharpsat~=2.9.0.dev2; extra == "sharpsat"
17
+ Requires-Dist: flamapy-sharpsat~=2.9.0.dev3; extra == "sharpsat"
18
18
  Provides-Extra: dnnf
19
- Requires-Dist: flamapy-dnnf~=2.9.0.dev2; extra == "dnnf"
19
+ Requires-Dist: flamapy-dnnf~=2.9.0.dev3; extra == "dnnf"
20
20
  Provides-Extra: sdd
21
- Requires-Dist: flamapy-sdd~=2.9.0.dev2; extra == "sdd"
21
+ Requires-Dist: flamapy-sdd~=2.9.0.dev3; extra == "sdd"
22
22
  Provides-Extra: all-solvers
23
- Requires-Dist: flamapy-sharpsat~=2.9.0.dev2; extra == "all-solvers"
24
- Requires-Dist: flamapy-dnnf~=2.9.0.dev2; extra == "all-solvers"
25
- Requires-Dist: flamapy-sdd~=2.9.0.dev2; extra == "all-solvers"
23
+ Requires-Dist: flamapy-sharpsat~=2.9.0.dev3; extra == "all-solvers"
24
+ Requires-Dist: flamapy-dnnf~=2.9.0.dev3; extra == "all-solvers"
25
+ Requires-Dist: flamapy-sdd~=2.9.0.dev3; extra == "all-solvers"
26
26
  Provides-Extra: dev
27
27
  Requires-Dist: pytest; extra == "dev"
28
28
  Requires-Dist: pytest-mock; extra == "dev"
@@ -22,6 +22,7 @@ tests/test_descriptors_cover_facade.py
22
22
  tests/test_documentation_examples.py
23
23
  tests/test_fama_suite_bdd.py
24
24
  tests/test_fama_suite_sat.py
25
+ tests/test_imports.py
25
26
  tests/test_metrics_fanout.py
26
27
  tests/test_optimization_and_sampling.py
27
28
  tests/test_planner_routing.py
@@ -0,0 +1,26 @@
1
+ flamapy-fw~=2.9.0.dev3
2
+ flamapy-fm~=2.9.0.dev3
3
+ flamapy-sat~=2.9.0.dev3
4
+ flamapy-bdd~=2.9.0.dev3
5
+ flamapy-z3~=2.9.0.dev3
6
+
7
+ [all-solvers]
8
+ flamapy-sharpsat~=2.9.0.dev3
9
+ flamapy-dnnf~=2.9.0.dev3
10
+ flamapy-sdd~=2.9.0.dev3
11
+
12
+ [dev]
13
+ pytest
14
+ pytest-mock
15
+ prospector
16
+ mypy
17
+ coverage
18
+
19
+ [dnnf]
20
+ flamapy-dnnf~=2.9.0.dev3
21
+
22
+ [sdd]
23
+ flamapy-sdd~=2.9.0.dev3
24
+
25
+ [sharpsat]
26
+ flamapy-sharpsat~=2.9.0.dev3
@@ -4,30 +4,30 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "flamapy"
7
- version = "2.9.0.dev2"
7
+ version = "2.9.0.dev3"
8
8
  description = "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."
9
9
  readme = "README.md"
10
10
  license = "GPL-3.0-or-later"
11
11
  authors = [{ name = "Flamapy", email = "flamapy@us.es" }]
12
12
  requires-python = ">=3.11"
13
13
  dependencies = [
14
- "flamapy-fw~=2.9.0.dev2",
15
- "flamapy-fm~=2.9.0.dev2",
16
- "flamapy-sat~=2.9.0.dev2",
17
- "flamapy-bdd~=2.9.0.dev2",
18
- "flamapy-z3~=2.9.0.dev2",
14
+ "flamapy-fw~=2.9.0.dev3",
15
+ "flamapy-fm~=2.9.0.dev3",
16
+ "flamapy-sat~=2.9.0.dev3",
17
+ "flamapy-bdd~=2.9.0.dev3",
18
+ "flamapy-z3~=2.9.0.dev3",
19
19
  ]
20
20
 
21
21
  [project.optional-dependencies]
22
22
  # Optional solver backends: not part of the default install, selectable per call
23
23
  # (e.g. backend='sharpsat') or per model (FLAMAFeatureModel(path, backend=...)).
24
- sharpsat = ["flamapy-sharpsat~=2.9.0.dev2"]
25
- dnnf = ["flamapy-dnnf~=2.9.0.dev2"]
26
- sdd = ["flamapy-sdd~=2.9.0.dev2"]
24
+ sharpsat = ["flamapy-sharpsat~=2.9.0.dev3"]
25
+ dnnf = ["flamapy-dnnf~=2.9.0.dev3"]
26
+ sdd = ["flamapy-sdd~=2.9.0.dev3"]
27
27
  all-solvers = [
28
- "flamapy-sharpsat~=2.9.0.dev2",
29
- "flamapy-dnnf~=2.9.0.dev2",
30
- "flamapy-sdd~=2.9.0.dev2",
28
+ "flamapy-sharpsat~=2.9.0.dev3",
29
+ "flamapy-dnnf~=2.9.0.dev3",
30
+ "flamapy-sdd~=2.9.0.dev3",
31
31
  ]
32
32
  dev = [
33
33
  "pytest",
@@ -0,0 +1,69 @@
1
+ """Models with imports are analysed as one tree: the imported models used to count as leaf
2
+ features, so their features and constraints were ignored (flamapy/fm_metamodel#110)."""
3
+ import warnings
4
+
5
+ import pytest
6
+
7
+ from flamapy.interfaces.python.flamapy_feature_model import FLAMAFeatureModel
8
+
9
+ SPIRITS = ('features\n Spirits\n alternative\n Gin\n Rum\n'
10
+ ' optional\n Ice\nconstraints\n Rum => Ice\n')
11
+ BACKENDS = ['sat', 'bdd', 'z3']
12
+
13
+
14
+ def _model(tmp_path, main: str, **files: str) -> FLAMAFeatureModel:
15
+ for name, text in {'Spirits': SPIRITS, 'Mix': main, **files}.items():
16
+ (tmp_path / f'{name}.uvl').write_text(text)
17
+ return FLAMAFeatureModel(str(tmp_path / 'Mix.uvl'), raise_errors=True)
18
+
19
+
20
+ def _two_parents(imports: str, first: str, second: str) -> str:
21
+ return (f'imports\n{imports}features\n Mix\n optional\n'
22
+ f' Three\n mandatory\n {first}.Spirits\n'
23
+ f' Two\n mandatory\n {second}.Spirits\n')
24
+
25
+
26
+ @pytest.mark.parametrize('backend', BACKENDS)
27
+ def test_imported_features_and_constraints_are_analysed(tmp_path, backend):
28
+ fm = _model(tmp_path, 'imports\n Spirits as S\nfeatures\n Mix\n optional\n'
29
+ ' S.Spirits\n')
30
+ # Mix alone, or with Spirits: Gin (with or without Ice) or Rum (which requires Ice).
31
+ assert fm.configurations_number(backend=backend) == 4
32
+ assert fm.last_result.exact is True
33
+
34
+
35
+ @pytest.mark.parametrize('backend', BACKENDS)
36
+ def test_the_same_model_under_two_aliases_gives_independent_subtrees(tmp_path, backend):
37
+ fm = _model(tmp_path, _two_parents(' Spirits as S\n Spirits as T\n', 'S', 'T'))
38
+ assert fm.configurations_number(backend=backend) == 16 # (1 + 3) * (1 + 3)
39
+
40
+
41
+ @pytest.mark.parametrize('backend', BACKENDS)
42
+ def test_nested_imports_reached_through_two_models(tmp_path, backend):
43
+ fm = _model(
44
+ tmp_path,
45
+ 'imports\n B as B\n C as C\nfeatures\n Mix\n optional\n'
46
+ ' B.B\n C.C\n',
47
+ B='imports\n Spirits as S\nfeatures\n B\n mandatory\n S.Spirits\n',
48
+ C='imports\n Spirits as S\nfeatures\n C\n mandatory\n S.Spirits\n')
49
+ assert fm.configurations_number(backend=backend) == 16
50
+
51
+
52
+ def test_a_model_without_imports_or_repeated_names_does_not_warn(tmp_path):
53
+ with warnings.catch_warnings():
54
+ warnings.simplefilter('error', UserWarning)
55
+ _model(tmp_path, 'features\n Mix\n optional\n A\n B\n')
56
+
57
+
58
+ @pytest.mark.parametrize('main', [
59
+ _two_parents(' Spirits as S\n', 'S', 'S'), # the model of flamapy/fm_metamodel#110
60
+ 'features\n Mix\n optional\n Three\n mandatory\n'
61
+ ' Sp\n Two\n mandatory\n Sp\n',
62
+ ])
63
+ def test_repeated_feature_names_warn(tmp_path, main):
64
+ with pytest.warns(UserWarning, match='cannot be guaranteed') as record:
65
+ fm = _model(tmp_path, main)
66
+ assert record[0].filename == __file__
67
+ # The backend does not approximate anything: the warning is the only signal.
68
+ fm.satisfiable(backend='sat')
69
+ assert fm.last_result.exact is True
@@ -1,26 +0,0 @@
1
- flamapy-fw~=2.9.0.dev2
2
- flamapy-fm~=2.9.0.dev2
3
- flamapy-sat~=2.9.0.dev2
4
- flamapy-bdd~=2.9.0.dev2
5
- flamapy-z3~=2.9.0.dev2
6
-
7
- [all-solvers]
8
- flamapy-sharpsat~=2.9.0.dev2
9
- flamapy-dnnf~=2.9.0.dev2
10
- flamapy-sdd~=2.9.0.dev2
11
-
12
- [dev]
13
- pytest
14
- pytest-mock
15
- prospector
16
- mypy
17
- coverage
18
-
19
- [dnnf]
20
- flamapy-dnnf~=2.9.0.dev2
21
-
22
- [sdd]
23
- flamapy-sdd~=2.9.0.dev2
24
-
25
- [sharpsat]
26
- flamapy-sharpsat~=2.9.0.dev2
File without changes
File without changes
File without changes
File without changes