[build-system] build-backend = 'mesonpy' # Minimum requirements for the build system to execute. requires = [ 'cypari2 >=2.2.1; sys_platform != "win32"', 'meson-python', # Exclude 1.12.0 because of https://github.com/sagemath/cysignals/issues/212 'cysignals >=1.12.1', 'cython >=3.1.0', 'gmpy2 >=2.1.5', 'jinja2', 'memory_allocator', 'numpy >=2.2.4', ] [tool.meson-python.args] # Prevent meson from trying to install the autoconf subprojects # otherwise we hit https://github.com/mesonbuild/meson-python/issues/598 # The subprojects have to set the rpath to the build directory, which should work as long as # we don't use build isolation. # Also don't install subprojects providing static libraries as per https://mesonbuild.com/meson-python/how-to-guides/shared-libraries.html#static-library-from-subproject # This actually covers all current subprojects; so just don't install any of them. install = ['--skip-subprojects'] # Ensure that ``library`` targets are built as static, and nothing gets installed setup = ['--default-library=static'] [project] authors = [ { email = "sage-support@googlegroups.com", name = "The Sage Developers" }, ] classifiers = [ "Development Status :: 6 - Mature", "Intended Audience :: Education", "Intended Audience :: Science/Research", "Operating System :: MacOS :: MacOS X", "Operating System :: POSIX", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Scientific/Engineering :: Mathematics", ] dependencies = [ 'conway-polynomials >=0.8', 'cypari2 >=2.2.1; sys_platform != "win32"', 'six >=1.15.0', # Exclude 1.12.0 because of https://github.com/sagemath/cysignals/issues/212 'cysignals >=1.12.1', 'cython >=3.1.0', 'fpylll >=0.5.9; sys_platform != "win32"', 'gmpy2 >=2.1.5', 'ipykernel >=5.2.1', 'ipython >=8.9.0', 'ipywidgets >=7.5.1', 'jupyter-client', 'matplotlib >=3.7.0', 'memory_allocator', 'mpmath >=1.1.0', 'networkx >=3.1', 'numpy >=1.25', 'pexpect >=4.8.0', 'pillow >=7.2.0', 'platformdirs', # Issue #30922: pplpy 0.8.4 and earlier do not declare dependencies correctly 'pplpy >=0.8.6; sys_platform != "win32"', 'primecountpy; sys_platform != "win32"', 'ptyprocess > 0.5', 'requests >=2.13.0', 'scipy >=1.11', 'sphinx >=6.2', 'sympy >=1.6, <2.0', # TODO: Remove this once the migration to meson is complete 'pkgconfig', 'traitlets', ] description = "Sage: Open Source Mathematics Software: Standard Python Library" dynamic = ["version"] license = "GPL-2.0-or-later" name = "sagemath" requires-python = ">=3.12, <3.15" urls = { Homepage = "https://www.sagemath.org" } [project.optional-dependencies] R = ['rpy2 >=3.3'] extra = [ 'igraph', 'lrcalc ~=2.1; sys_platform != "win32"', #'p_group_cohomology >=3.3', # Only used in tests, not available on PyPI 'pycosat >=0.6.3', 'pynormaliz >=2.18; platform_machine != "aarch64" and platform_machine != "arm64"', # Not yet available for Linux aarch64 'sage_numerical_backends_coin', 'symengine >= 0.6.1', # Only used in tests ] #giac = ['sagemath_giac'] # Not yet available on PyPI (https://github.com/sagemath/sagemath-giac/issues/3) [project.readme] content-type = "text/markdown" file = "README.md" [project.scripts] sage = "sage.cli.__main__:main" [tool.conda-lock] platforms = ['linux-64', 'linux-aarch64', 'osx-64', 'osx-arm64'] [tool.pytest.ini_options] # sage.libs.giac is a stub to keep the old imports working; all # it does is try to import sagemath_giac. norecursedirs = "local prefix venv build builddir pkgs .git src/doc src/bin src/sage/libs/giac tools subprojects" python_files = "*_test.py" # The "no:warnings" is to stop pytest from capturing warnings so that they are printed to the output of the doctest addopts = "--import-mode importlib -p no:warnings" doctest_optionflags = "NORMALIZE_WHITESPACE ELLIPSIS" # https://docs.pytest.org/en/stable/reference/reference.html#confval-consider_namespace_packages consider_namespace_packages = true # External dependencies in the format proposed by https://peps.python.org/pep-0725 [external] build-requires = [ "pkg:generic/pkg-config", "virtual:compiler/c", "virtual:compiler/cpp", ] host-requires = [ "pkg:generic/boost", "pkg:generic/cddlib", "pkg:generic/cliquer", "pkg:generic/ecl", "pkg:generic/ecm", "pkg:generic/fflas-ffpack", "pkg:generic/flint", "pkg:generic/gap", "pkg:generic/gfan", "pkg:generic/givaro", "pkg:generic/glpk", "pkg:generic/gmp", "pkg:generic/gsl", "pkg:generic/iml", "pkg:generic/lcalc", "pkg:generic/libbraiding", "pkg:generic/libgd", "pkg:generic/libhomfly", "pkg:generic/linbox", "pkg:generic/lrcalc", "pkg:generic/m4ri", "pkg:generic/m4rie", "pkg:generic/maxima", "pkg:generic/mpc", "pkg:generic/mpfi", "pkg:generic/mpfr", "pkg:generic/nauty", "pkg:generic/ntl", "pkg:generic/palp", "pkg:generic/pari", "pkg:generic/pari-elldata", "pkg:generic/pari-galdata", "pkg:generic/pari-seadata", "pkg:generic/planarity", "pkg:generic/primecount", "pkg:generic/primesieve", "pkg:generic/qhull", "pkg:generic/rw", "pkg:generic/singular", "pkg:generic/symmetrica", "pkg:generic/sympow", "virtual:compiler/fortran", "virtual:interface/blas", ] dependencies = [ "pkg:generic/sagemath-elliptic-curves", "pkg:generic/sagemath-graphs", "pkg:generic/sagemath-polytopes-db", "pkg:generic/tachyon", ] [external.optional-host-requires] extra = [ "pkg:generic/bliss", "pkg:generic/brial", "pkg:generic/coxeter3", "pkg:generic/eclib", "pkg:generic/mcqd", "pkg:generic/meataxe", "pkg:generic/sirocco", "pkg:generic/tdlib", ] [external.optional-dependencies] R = ["pkg:generic/r-lattice"] extra = [ "pkg:generic/4ti2", "pkg:generic/benzene", "pkg:generic/buckygen", "pkg:generic/csdp", "pkg:generic/frobby", "pkg:generic/kenzo", "pkg:generic/latte-integrale", "pkg:generic/lrslib", "pkg:generic/plantri", "pkg:generic/qepcad", "pkg:generic/tides", ] # Uncommented for now as most devs probably don't need to run it locally # docs-pdf = [ # "pkg:generic/latexmk", # "pkg:generic/lualatex", # "pkg:fonts/freefonts", # "pkg:generic/xindy", # ] [dependency-groups] dev = [ "cibuildwheel", "conda-lock", "grayskull", "meson", # Duplicate build-system requirement to fix editable installs with uv "meson-python", # Duplicate build-system requirement to fix editable installs with uv "ninja", # Duplicate build-system requirement to fix editable installs with uv "pygithub", "pytest", "python-build", "ruff", "tqdm", "ty >=0.0.12", "uv", 'cypari2 >=2.2.1; sys_platform != "win32"', # Duplicate build-system requirement to fix editable installs with uv 'cysignals >=1.12.1', # Duplicate build-system requirement to fix editable installs with uv 'cython >=3.1.0', # Duplicate build-system requirement to fix editable installs with uv 'gmpy2 >=2.1.5', # Duplicate build-system requirement to fix editable installs with uv 'jinja2', # Duplicate build-system requirement to fix editable installs with uv 'memory_allocator', # Duplicate build-system requirement to fix editable installs with uv 'meson-python', # Duplicate build-system requirement to fix editable installs with uv 'numpy >=2.2.4', # Duplicate build-system requirement to fix editable installs with uv ] docs = [ "furo", "jupyter-sphinx", "python-dateutil", "sphinx", "sphinx-copybutton", "sphinx-inline-tabs", ] lint = ["flake8-rst-docstrings", "pycodestyle", "relint", "ruff"] test = ["coverage", "pytest", "pytest-xdist"] [tool.ruff] # https://docs.astral.sh/ruff/configuration # Python 3.12 is the minimum supported version target-version = "py312" exclude = [ # This directory is full of old autogenerated files. # Linting it would just get in the way of adding stricter linter rules # to our actual code. "src/doc/", # This directory handles the build process, # and some parts allow Python versions as old as 2.6, so we don't both linting. "build/", ] [tool.ruff.lint] # Rules that we deliberately do not attempt to follow, either because we # disagree with them or because following them is not currently practical. ignore = [ "E501", # Line too long - hard to avoid in doctests, and better handled by black. # Variable/function names I, O, l - common in math, and not an issue for most monospace fonts "E741", "E743", "PLC2401", # Non-ASCII variables - we deliberately use Greek letters (albeit sparingly) # The following rules are good in spirit but require some common sense, better enforced through code review. "PLR09", # Rules about code complexity - better enforced through code review process. "PLR1714", # Repeated equality comparison - too picky when only doing a couple comparisons. "PLR2004", # Comparison to magic values - better enforced through code review process. "PLW1641", # __eq__ without __hash__ - implementations of equivalence classes may have a well-defined notion of equality without a well-defined canonical representation that can be used to compute a hash # Module level import not at top of file. # ruff is not aware of our lazy_imports, we may be able to remove this ignore after adopting PEP 810 "E402", ] select = [ "C4", # flake8-comprehensions - https://docs.astral.sh/ruff/rules/#flake8-comprehensions-c4 "F", # pyflakes - https://docs.astral.sh/ruff/rules/#pyflakes-f "I", # isort - https://docs.astral.sh/ruff/rules/#isort-i "TC", # flake8-type-checking - https://docs.astral.sh/ruff/rules/#flake8-type-checking-tc "W", # pycodestyle warnings - https://docs.astral.sh/ruff/rules/#pycodestyle-e-w # flake8-pie - https://docs.astral.sh/ruff/rules/#flake8-pie-pie "PIE808", # ruff-specific rules - https://docs.astral.sh/ruff/rules/#ruff-specific-rules-ruf "RUF013", "RUF036", # perflint - https://docs.astral.sh/ruff/rules/#perflint-perf "PERF101", "PERF102", "PERF403", # pyupgrade - https://docs.astral.sh/ruff/rules/#pyupgrade-up "UP004", "UP006", "UP008", "UP010", "UP015", "UP022", "UP034", "UP035", # refurb - https://docs.astral.sh/ruff/rules/#refurb-furb "FURB188", # pycodestyle errors - https://docs.astral.sh/ruff/rules/#error-e # Ideally we would enable (almost) all of the E rules, but too # many of these rules are in preview to trust that something won't change # in ruff itself and cause us headaches. "E101", "E401", "E701", "E702", "E703", "E711", "E712", "E713", "E714", "E721", "E722", "E731", "E742", "E902", # pydocstyle - https://docs.astral.sh/ruff/rules/#pydocstyle-d "D211", # pylint - https://docs.astral.sh/ruff/rules/#pylint-pl # Like with the E rules, this isn't stable enough yet to enable all of PL # pylint convention - https://docs.astral.sh/ruff/rules/#convention-plc "PLC0105", "PLC0131", "PLC0132", "PLC0205", "PLC0206", "PLC0208", "PLC0414", "PLC1802", "PLC2403", "PLC3002", # pylint errors - https://docs.astral.sh/ruff/rules/#error-ple "PLE0100", "PLE0101", "PLE0115", "PLE0116", "PLE0117", "PLE0118", "PLE0237", "PLE0241", "PLE0302", "PLE0303", "PLE0305", "PLE0307", "PLE0308", "PLE0309", "PLE0604", "PLE0605", "PLE0643", "PLE0704", "PLE1132", "PLE1142", "PLE1205", "PLE1206", "PLE1300", "PLE1307", "PLE1310", "PLE1507", "PLE1519", "PLE1520", "PLE1700", "PLE2502", "PLE2510", "PLE2512", "PLE2513", "PLE2514", "PLE2515", # pylint refactor - https://docs.astral.sh/ruff/rules/#refactor-plr "PLR0124", "PLR0133", "PLR0206", "PLR0402", "PLR1704", "PLR1711", "PLR1716", "PLR1722", "PLR1730", "PLR1733", "PLR1736", "PLR2044", "PLR5501", # pylint warning - https://docs.astral.sh/ruff/rules/#warning-plw "PLW0120", "PLW0127", "PLW0128", "PLW0129", "PLW0131", "PLW0133", "PLW0177", "PLW0211", "PLW0245", "PLW0406", "PLW0602", "PLW0603", "PLW0604", "PLW0642", "PLW0711", "PLW1501", "PLW1507", "PLW1508", "PLW1509", "PLW1510", "PLW2101", "PLW2901", "PLW3301", ] [tool.ruff.lint.per-file-ignores] "all.py" = [ "F401", # Unused import - these files are by definition collections of imports. ] "src/sage/algebras/lie_conformal_algebras/examples.py" = [ "F401", # Unused import - reexports for convenience. ] [tool.uv] # Don't use build isolation for sage (it's incompatible with meson-python's editable install) no-build-isolation-package = ["sagemath"]