Skip to content

Commit

Permalink
ENH: upgrade to python-constraint2 (#268)
Browse files Browse the repository at this point in the history
* MAINT: update pip constraints files
  • Loading branch information
redeboer authored May 20, 2024
1 parent e8a55ac commit 6a3b0eb
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 51 deletions.
3 changes: 1 addition & 2 deletions .constraints/py3.10.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ pytest==8.2.1
pytest-cov==5.0.0
pytest-profiling==1.7.0
pytest-xdist==3.6.1
python-constraint==1.4.0
python-constraint2==2.0.0b5
python-dateutil==2.9.0.post0
python-json-logger==2.0.7
python-lsp-jsonrpc==1.1.2
Expand Down Expand Up @@ -165,7 +165,6 @@ sphinxcontrib-htmlhelp==2.0.5
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.7
sphinxcontrib-serializinghtml==1.1.10
sphobjinv==2.3.1
sqlalchemy==2.0.30
stack-data==0.6.3
starlette==0.37.2
Expand Down
3 changes: 1 addition & 2 deletions .constraints/py3.11.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ pytest==8.2.1
pytest-cov==5.0.0
pytest-profiling==1.7.0
pytest-xdist==3.6.1
python-constraint==1.4.0
python-constraint2==2.0.0b5
python-dateutil==2.9.0.post0
python-json-logger==2.0.7
python-lsp-jsonrpc==1.1.2
Expand Down Expand Up @@ -164,7 +164,6 @@ sphinxcontrib-htmlhelp==2.0.5
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.7
sphinxcontrib-serializinghtml==1.1.10
sphobjinv==2.3.1
sqlalchemy==2.0.30
stack-data==0.6.3
starlette==0.37.2
Expand Down
3 changes: 1 addition & 2 deletions .constraints/py3.12.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ pytest==8.2.1
pytest-cov==5.0.0
pytest-profiling==1.7.0
pytest-xdist==3.6.1
python-constraint==1.4.0
python-constraint2==2.0.0b5
python-dateutil==2.9.0.post0
python-json-logger==2.0.7
python-lsp-jsonrpc==1.1.2
Expand Down Expand Up @@ -164,7 +164,6 @@ sphinxcontrib-htmlhelp==2.0.5
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.7
sphinxcontrib-serializinghtml==1.1.10
sphobjinv==2.3.1
sqlalchemy==2.0.30
stack-data==0.6.3
starlette==0.37.2
Expand Down
1 change: 0 additions & 1 deletion .constraints/py3.7.txt
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
sphobjinv==2.3.1
sqlalchemy==1.4.52
tabulate==0.9.0
terminado==0.17.1
Expand Down
3 changes: 1 addition & 2 deletions .constraints/py3.8.txt
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ pytest==8.2.1
pytest-cov==5.0.0
pytest-profiling==1.7.0
pytest-xdist==3.6.1
python-constraint==1.4.0
python-constraint2==2.0.0b5
python-dateutil==2.9.0.post0
python-json-logger==2.0.7
python-lsp-jsonrpc==1.1.2
Expand Down Expand Up @@ -171,7 +171,6 @@ sphinxcontrib-htmlhelp==2.0.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
sphobjinv==2.3.1
sqlalchemy==2.0.30
stack-data==0.6.3
tabulate==0.9.0
Expand Down
3 changes: 1 addition & 2 deletions .constraints/py3.9.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ pytest==8.2.1
pytest-cov==5.0.0
pytest-profiling==1.7.0
pytest-xdist==3.6.1
python-constraint==1.4.0
python-constraint2==2.0.0b5
python-dateutil==2.9.0.post0
python-json-logger==2.0.7
python-lsp-jsonrpc==1.1.2
Expand Down Expand Up @@ -165,7 +165,6 @@ sphinxcontrib-htmlhelp==2.0.5
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.7
sphinxcontrib-serializinghtml==1.1.10
sphobjinv==2.3.1
sqlalchemy==2.0.30
stack-data==0.6.3
starlette==0.37.2
Expand Down
31 changes: 1 addition & 30 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import os
import sys

import sphobjinv as soi
from sphinx_api_relink.helpers import (
get_branch_name,
get_execution_mode,
Expand All @@ -15,34 +14,6 @@
sys.path.insert(0, os.path.abspath("."))
from _extend_docstrings import extend_docstrings # noqa: PLC2701


def create_constraints_inventory() -> None:
inv = soi.Inventory()
inv.project = "constraint"
constraint_object_names = [
"Constraint",
"Domain",
"Problem",
"Solver",
"Variable",
]
for object_name in constraint_object_names:
inv.objects.append(
soi.DataObjStr(
name=f"{inv.project}.{object_name}",
domain="py",
role="class",
priority="1",
uri=f"{inv.project}.{object_name}-class.html",
dispname="-",
)
)
text = inv.data_file(contract=True)
ztext = soi.compress(text)
soi.writebytes("constraint.inv", ztext)


create_constraints_inventory()
extend_docstrings()
set_intersphinx_version_remapping({
"ipython": {
Expand Down Expand Up @@ -250,7 +221,7 @@ def create_constraints_inventory() -> None:
"ampform": ("https://ampform.readthedocs.io/en/stable", None),
"attrs": (f"https://www.attrs.org/en/{pin('attrs')}", None),
"compwa": ("https://compwa.github.io", None),
"constraint": ("https://labix.org/doc/constraint/public", "constraint.inv"),
"constraint": ("https://python-constraint.github.io/python-constraint", None),
"graphviz": ("https://graphviz.readthedocs.io/en/stable", None),
"IPython": (f"https://ipython.readthedocs.io/en/{pin('IPython')}", None),
"jsonschema": ("https://python-jsonschema.readthedocs.io/en/stable", None),
Expand Down
9 changes: 2 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ dependencies = [
"attrs >=20.1.0", # on_setattr and https://www.attrs.org/en/stable/api.html#next-gen
"jsonschema",
"particle",
"python-constraint",
"tqdm >=4.24.0", # autonotebook
'python-constraint2; python_version >="3.8.0"',
'python-constraint; python_version <"3.8.0"',
'typing-extensions; python_version <"3.8.0"', # Literal, Protocol
]
description = "Rule-based particle reaction problem solver on a quantum number level"
Expand Down Expand Up @@ -77,7 +78,6 @@ doc = [
"sphinx-thebe",
"sphinx-togglebutton",
"sphinxcontrib-bibtex >=2",
"sphobjinv",
'sphinx-api-relink >=0.0.4',
'sphinx-pybtex-etal-style',
]
Expand Down Expand Up @@ -114,7 +114,6 @@ types = [
"ipython",
"pydot <2", # problem with pydot.graph_from_dot_data
"pytest",
"sphobjinv",
"types-PyYAML",
"types-setuptools",
'sphinx-api-relink >=0.0.4',
Expand Down Expand Up @@ -200,10 +199,6 @@ module = ["pydot.*"]
ignore_missing_imports = true
module = ["sphinx.*"]

[[tool.mypy.overrides]]
ignore_missing_imports = true
module = ["sphobjinv.*"]

[[tool.mypy.overrides]]
ignore_missing_imports = true
module = ["tqdm.*"]
Expand Down
6 changes: 3 additions & 3 deletions src/qrules/solving.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ class _VariableContainer:
class CSPSolver(Solver):
"""Solver reducing the task to a Constraint Satisfaction Problem.
Solving this done with the python-constraint module.
Solving this done with the :doc:`constraint<constraint:reference>` package.
The variables are the quantum numbers of particles/edges, but also some composite
quantum numbers which are attributed to the interaction nodes (such as angular
Expand Down Expand Up @@ -782,7 +782,7 @@ def rule_passes(self) -> dict[tuple[int, Rule], int]:


class _GraphElementConstraint(Generic[_QNType], Constraint):
"""Wrapper class of the python-constraint Constraint class.
"""Wrapper class of the `~constraints.Constraint` class.
This allows a customized definition of conservation rules, and hence a cleaner user
interface.
Expand Down Expand Up @@ -903,7 +903,7 @@ def __update_variable_lists(
class _ConservationRuleConstraintWrapper(
Constraint # pyright: ignore[reportUntypedBaseClass]
):
"""Wrapper class of the python-constraint Constraint class.
"""Wrapper class of the `~constraints.Constraint` class.
This allows a customized definition of conservation rules, and hence a cleaner user
interface.
Expand Down

0 comments on commit 6a3b0eb

Please sign in to comment.