diff --git a/pyproject.toml b/pyproject.toml index 9e2ab7c..4dd49d1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,6 +25,18 @@ dev = [ "sphinx>=7,<8", ] +[project.optional-dependencies] +passagemath = [ + "passagemath-graphs", + "passagemath-polyhedra", + "passagemath-singular", + "passagemath-symbolics", + "passagemath-repl", +] +macaulay2 = [ + "passagemath-macaulay2", +] + [build-system] requires = ["hatchling"] build-backend = "hatchling.build" diff --git a/sage_acsv/settings.py b/sage_acsv/settings.py index 3351479..3eee31e 100644 --- a/sage_acsv/settings.py +++ b/sage_acsv/settings.py @@ -4,8 +4,6 @@ from enum import Enum -from sage.interfaces.macaulay2 import Macaulay2 - from sage_acsv.debug import acsv_logger @@ -100,7 +98,7 @@ class ACSVSettings: _default_output_format = DEFAULT_OUTPUT_FORMAT _default_kronecker_backend = DEFAULT_KRONECKER_BACKEND _default_groebner_backend = DEFAULT_GROEBNER_BACKEND - _m2 = Macaulay2() + _m2 = None MAX_MIN_CRIT_RETRIES = 5 # Maximum number of retries for critical point detection @@ -212,9 +210,13 @@ def set_macaulay2_path(cls, path: str | None) -> None: * ``path`` -- a filepath string or `None` to run from anywhere """ + from sage.interfaces.macaulay2 import Macaulay2 cls._m2 = Macaulay2(command=path) @classmethod def get_macaulay2(cls) -> KroneckerBackend: """Get the Macaulay2 installation path.""" + if cls._m2 is None: + from sage.interfaces.macaulay2 import Macaulay2 + _m2 = Macaulay2() return cls._m2 diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..7bc29bf --- /dev/null +++ b/tox.ini @@ -0,0 +1,17 @@ +[tox] +envlist = passagemath + +[testenv:passagemath] +usedevelop = True + +extras = passagemath + +allowlist_externals = + bash + +passenv = + HOME + GITHUB_ACTIONS + +commands = + bash -c "PYTHONPATH={toxinidir} sage -t -p --force-lib $([ -n \"$GITHUB_ACTIONS\" ] && echo \"--format github\") --environment=sage.all__sagemath_symbolics --optional=sage sage_acsv/"