python-constraint2 2.0.3__tar.gz → 2.2.0__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 (29) hide show
  1. {python_constraint2-2.0.3 → python_constraint2-2.2.0}/PKG-INFO +13 -18
  2. {python_constraint2-2.0.3 → python_constraint2-2.2.0}/README.rst +9 -5
  3. {python_constraint2-2.0.3 → python_constraint2-2.2.0}/constraint/__init__.py +1 -0
  4. {python_constraint2-2.0.3 → python_constraint2-2.2.0}/constraint/constraints.c +3368 -2742
  5. {python_constraint2-2.0.3 → python_constraint2-2.2.0}/constraint/constraints.py +10 -0
  6. python_constraint2-2.2.0/constraint/parser.c +19108 -0
  7. python_constraint2-2.2.0/constraint/parser.py +269 -0
  8. {python_constraint2-2.0.3 → python_constraint2-2.2.0}/constraint/problem.c +3977 -1949
  9. {python_constraint2-2.0.3 → python_constraint2-2.2.0}/constraint/problem.py +65 -20
  10. {python_constraint2-2.0.3 → python_constraint2-2.2.0}/constraint/solvers.c +10419 -3504
  11. {python_constraint2-2.0.3 → python_constraint2-2.2.0}/constraint/solvers.py +195 -4
  12. {python_constraint2-2.0.3 → python_constraint2-2.2.0}/cythonize_build.py +1 -1
  13. {python_constraint2-2.0.3 → python_constraint2-2.2.0}/pyproject.toml +30 -26
  14. python_constraint2-2.2.0/tests/benchmarks.py +109 -0
  15. python_constraint2-2.2.0/tests/test_parser.py +85 -0
  16. python_constraint2-2.2.0/tests/test_problem.py +65 -0
  17. {python_constraint2-2.0.3 → python_constraint2-2.2.0}/tests/test_solvers.py +63 -1
  18. python_constraint2-2.2.0/tests/test_util_benchmark.py +148 -0
  19. python_constraint2-2.0.3/tests/test_problem.py +0 -27
  20. {python_constraint2-2.0.3 → python_constraint2-2.2.0}/LICENSE +0 -0
  21. {python_constraint2-2.0.3 → python_constraint2-2.2.0}/constraint/domain.c +0 -0
  22. {python_constraint2-2.0.3 → python_constraint2-2.2.0}/constraint/domain.py +0 -0
  23. {python_constraint2-2.0.3 → python_constraint2-2.2.0}/tests/__init__.py +0 -0
  24. {python_constraint2-2.0.3 → python_constraint2-2.2.0}/tests/setup_teardown.py +0 -0
  25. {python_constraint2-2.0.3 → python_constraint2-2.2.0}/tests/test_compilation.py +0 -0
  26. {python_constraint2-2.0.3 → python_constraint2-2.2.0}/tests/test_constraint.py +0 -0
  27. {python_constraint2-2.0.3 → python_constraint2-2.2.0}/tests/test_doctests.py +0 -0
  28. {python_constraint2-2.0.3 → python_constraint2-2.2.0}/tests/test_some_not_in_set.py +0 -0
  29. {python_constraint2-2.0.3 → python_constraint2-2.2.0}/tests/test_toml_file.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: python-constraint2
3
- Version: 2.0.3
3
+ Version: 2.2.0
4
4
  Summary: python-constraint is a module for efficiently solving CSPs (Constraint Solving Problems) over finite domains.
5
5
  License: BSD-2-Clause
6
6
  Keywords: CSP,constraint solving problems,problem solver,SMT,satisfiability modulo theory,SAT
@@ -8,26 +8,17 @@ Author: Gustavo Niemeyer
8
8
  Author-email: gustavo@niemeyer.net
9
9
  Maintainer: Floris-Jan Willemsen
10
10
  Maintainer-email: fjwillemsen97@gmail.com
11
- Requires-Python: >=3.9,<3.14
12
- Classifier: Development Status :: 4 - Beta
11
+ Requires-Python: >= 3.9
13
12
  Classifier: Environment :: Console
13
+ Classifier: Development Status :: 5 - Production/Stable
14
14
  Classifier: Intended Audience :: Developers
15
- Classifier: Intended Audience :: Education
16
15
  Classifier: Intended Audience :: Science/Research
17
- Classifier: License :: OSI Approved :: BSD License
16
+ Classifier: Intended Audience :: Education
18
17
  Classifier: Natural Language :: English
19
18
  Classifier: Programming Language :: C
20
19
  Classifier: Programming Language :: Cython
21
- Classifier: Programming Language :: Python :: 3
22
- Classifier: Programming Language :: Python :: 3.9
23
- Classifier: Programming Language :: Python :: 3.10
24
- Classifier: Programming Language :: Python :: 3.11
25
- Classifier: Programming Language :: Python :: 3.12
26
- Classifier: Programming Language :: Python :: 3.13
27
20
  Classifier: Topic :: Scientific/Engineering
28
21
  Classifier: Topic :: Software Development
29
- Project-URL: Documentation, http://python-constraint.github.io/python-constraint/
30
- Project-URL: Repository, https://github.com/python-constraint/python-constraint
31
22
  Description-Content-Type: text/x-rst
32
23
 
33
24
  |License| |Build Status| |Docs| |Python Versions| |Downloads| |Status| |Code Coverage|
@@ -44,6 +35,11 @@ python-constraint
44
35
  | For an overview of recent changes, visit the `Changelog <https://github.com/python-constraint/python-constraint/blob/main/CHANGELOG.md>`_.
45
36
  | The complete documentation can be found `here <http://python-constraint.github.io/python-constraint/>`_.
46
37
 
38
+ | New: writing constraints in the new string format is preferable over functions and lambdas.
39
+ | These strings, even as compound statements, are automatically parsed to faster built-in constraints, are more concise, and do not require constraint solving familiarity by the user to be efficient.
40
+ | For example, :code:`problem.addConstraint(["50 <= x * y < 100"])` is parsed to :code:`[MinProdConstraint(50, ["x", "y"]), MaxProdConstraint(100, ["x", "y"])]`.
41
+ | This feature is in beta and subject to possible change, please provide feedback.
42
+
47
43
  .. contents::
48
44
  :local:
49
45
  :depth: 1
@@ -72,8 +68,7 @@ This interactive Python session demonstrates basic operations:
72
68
  {'a': 2, 'b': 6}, {'a': 2, 'b': 5}, {'a': 2, 'b': 4},
73
69
  {'a': 1, 'b': 6}, {'a': 1, 'b': 5}, {'a': 1, 'b': 4}]
74
70
 
75
- >>> problem.addConstraint(lambda a, b: a*2 == b,
76
- ("a", "b"))
71
+ >>> problem.addConstraint("a*2 == b") # string constraints are preferable over the black-box problem.addConstraint(lambda a, b: a*2 == b, ("a", "b"))
77
72
  >>> problem.getSolutions()
78
73
  [{'a': 3, 'b': 6}, {'a': 2, 'b': 4}]
79
74
 
@@ -146,6 +141,7 @@ The following solvers are available:
146
141
  - Optimized backtracking solver
147
142
  - Recursive backtracking solver
148
143
  - Minimum conflicts solver
144
+ - Parallel solver
149
145
 
150
146
  .. role:: python(code)
151
147
  :language: python
@@ -200,9 +196,8 @@ For an overview of recent changes, visit the `Changelog <https://github.com/pyth
200
196
 
201
197
  Planned development:
202
198
 
203
- - Add a string parser for constraints
204
- - Add parallel-capable solver
205
- - Add `benchmarking tests <https://pypi.org/project/pytest-benchmark/>`_ automated with `GH actions <https://github.com/benchmark-action/github-action-benchmark>`_
199
+ - Rewrite hotspots in C / Pyx instead of pure python mode
200
+ - Improvements to make the ParallelSolver competitive (experiments reveal the freethreading mode to be promising)
206
201
  - Versioned documentation
207
202
 
208
203
  Contact
@@ -12,6 +12,11 @@ python-constraint
12
12
  | For an overview of recent changes, visit the `Changelog <https://github.com/python-constraint/python-constraint/blob/main/CHANGELOG.md>`_.
13
13
  | The complete documentation can be found `here <http://python-constraint.github.io/python-constraint/>`_.
14
14
 
15
+ | New: writing constraints in the new string format is preferable over functions and lambdas.
16
+ | These strings, even as compound statements, are automatically parsed to faster built-in constraints, are more concise, and do not require constraint solving familiarity by the user to be efficient.
17
+ | For example, :code:`problem.addConstraint(["50 <= x * y < 100"])` is parsed to :code:`[MinProdConstraint(50, ["x", "y"]), MaxProdConstraint(100, ["x", "y"])]`.
18
+ | This feature is in beta and subject to possible change, please provide feedback.
19
+
15
20
  .. contents::
16
21
  :local:
17
22
  :depth: 1
@@ -40,8 +45,7 @@ This interactive Python session demonstrates basic operations:
40
45
  {'a': 2, 'b': 6}, {'a': 2, 'b': 5}, {'a': 2, 'b': 4},
41
46
  {'a': 1, 'b': 6}, {'a': 1, 'b': 5}, {'a': 1, 'b': 4}]
42
47
 
43
- >>> problem.addConstraint(lambda a, b: a*2 == b,
44
- ("a", "b"))
48
+ >>> problem.addConstraint("a*2 == b") # string constraints are preferable over the black-box problem.addConstraint(lambda a, b: a*2 == b, ("a", "b"))
45
49
  >>> problem.getSolutions()
46
50
  [{'a': 3, 'b': 6}, {'a': 2, 'b': 4}]
47
51
 
@@ -114,6 +118,7 @@ The following solvers are available:
114
118
  - Optimized backtracking solver
115
119
  - Recursive backtracking solver
116
120
  - Minimum conflicts solver
121
+ - Parallel solver
117
122
 
118
123
  .. role:: python(code)
119
124
  :language: python
@@ -168,9 +173,8 @@ For an overview of recent changes, visit the `Changelog <https://github.com/pyth
168
173
 
169
174
  Planned development:
170
175
 
171
- - Add a string parser for constraints
172
- - Add parallel-capable solver
173
- - Add `benchmarking tests <https://pypi.org/project/pytest-benchmark/>`_ automated with `GH actions <https://github.com/benchmark-action/github-action-benchmark>`_
176
+ - Rewrite hotspots in C / Pyx instead of pure python mode
177
+ - Improvements to make the ParallelSolver competitive (experiments reveal the freethreading mode to be promising)
174
178
  - Versioned documentation
175
179
 
176
180
  Contact
@@ -31,6 +31,7 @@ from constraint.problem import * # noqa: F403
31
31
  from constraint.domain import * # noqa: F403
32
32
  from constraint.constraints import * # noqa: F403
33
33
  from constraint.solvers import * # noqa: F403
34
+ from constraint.parser import * # noqa: F403
34
35
 
35
36
  if __name__ == "__main__":
36
37
  from tests import test_doctests