Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move metadata from src/setup.cfg to src/pyproject.toml #38727

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ci/write-dockerfile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ $ADD Makefile VERSION.txt COPYING.txt condarc.yml README.md bootstrap bootstrap-
$ADD config/config.rpath /new/config/config.rpath
$ADD src/doc/bootstrap /new/src/doc/bootstrap
$ADD src/bin /new/src/bin
$ADD src/Pipfile.m4 src/pyproject.toml src/requirements.txt.m4 src/setup.cfg.m4 src/VERSION.txt /new/src/
$ADD src/Pipfile.m4 src/pyproject.toml src/requirements.txt.m4 src/VERSION.txt /new/src/
$ADD m4 /new/m4
$ADD pkgs /new/pkgs
$ADD build /new/build
Expand Down
1 change: 0 additions & 1 deletion bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ save () {
src/Pipfile \
src/pyproject.toml \
src/requirements.txt \
src/setup.cfg \
build/pkgs/cypari/version_requirements.txt \
build/pkgs/cysignals/version_requirements.txt \
build/pkgs/cython/version_requirements.txt \
Expand Down
2 changes: 1 addition & 1 deletion build/pkgs/typing_extensions/version_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# According to https://github.com/python/typing_extensions/blob/main/CHANGELOG.md,
# version 4.4.0 adds another Python 3.11 typing backport
typing_extensions >= 4.4.0; python_version<'3.11'
typing_extensions >= 4.4.0; python_version<"3.11"
1 change: 0 additions & 1 deletion pkgs/sagemath-standard/setup.cfg

This file was deleted.

1 change: 0 additions & 1 deletion pkgs/sagemath-standard/setup.cfg.m4

This file was deleted.

4 changes: 2 additions & 2 deletions pkgs/sagemath-standard/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
[tox]
envlist =
# Build and test without using the concrete dependencies specified by requirements.txt,
# using the dependencies declared in pyproject.toml and setup.cfg (install-requires) only:
# using the dependencies declared in pyproject.toml (build-system requires, dependencies) only:
# Still use ONLY the wheels built and stored by the Sage distribution (no PyPI).
#
# ./sage -sh -c '(cd pkgs/sagemath-standard && tox -v -v -v -e sagepython-sagewheels-nopypi-norequirements)'
Expand Down Expand Up @@ -58,7 +58,7 @@ envlist =
#
# ./sage -sh -c '(cd pkgs/sagemath-standard && tox -v -v -v -e sagepython-sagewheels-pipenv-dist)'
#
# Build using the dependencies declared in pyproject.toml and setup.cfg (install-requires) only.
# Build using the dependencies declared in pyproject.toml (build-system requires, dependencies) only:
# Use the wheels built and stored by the Sage distribution,
# and additionally allow packages from PyPI.
#
Expand Down
8 changes: 4 additions & 4 deletions src/Pipfile.m4
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]
## We do not list packages that are already declared as install_requires
## in setup.cfg
## We do not list packages that are already declared as dependencies (install_requires)
## in pyproject.toml
pycodestyle = "*"
tox = "*"
pytest = "*"
rope = "*"
six = "*"

[packages]
## We do not list packages that are already declared as install_requires
## in setup.cfg
## We do not list packages that are already declared as dependencies (install_requires)
## in pyproject.toml

[packages.e1839a8]
path = "."
4 changes: 2 additions & 2 deletions src/doc/en/developer/coding_basics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ included in one of the following places:
This practice is deprecated, see :issue:`33037`.

In all cases, the files must be listed (explicitly or via wildcards) in
the section ``options.package_data`` of the file
:sage_root:`pkgs/sagemath-standard/setup.cfg.m4` (or the corresponding
the section ``[tool.setuptools.package-data]`` of the file
:sage_root:`SAGE_ROOT/pkgs/sagemath-standard/pyproject.toml` (or the corresponding
file of another distribution).

Large data files should not be added to the Sage source tree. Instead, it
Expand Down
6 changes: 4 additions & 2 deletions src/doc/en/developer/coding_in_python.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ Python language standard

Sage library code needs to be compatible with all versions of Python
that Sage supports. The information regarding the supported versions
can be found in the files ``build/pkgs/python3/spkg-configure.m4`` and
``src/setup.cfg.m4``.
can be found in the files ``build/pkgs/python3/spkg-configure.m4``
(for the Sage distribution), ``src/pyproject.toml`` (for the Sage
library), and ``m4/pyproject_toml_metadata.m4`` (for most other
distribution packages in ``pkgs/``).

Python 3.9 is the oldest supported version. Hence,
all language and library features that are available in Python 3.9 can
Expand Down
25 changes: 14 additions & 11 deletions src/doc/en/developer/packaging_sage_library.rst
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,7 @@ The source directory of a distribution package, such as

$ ./sage --fixdistributions --set all --from-egg-info

- `pyproject.toml <https://pip.pypa.io/en/stable/reference/build-system/pyproject-toml/>`_,
`setup.cfg <https://setuptools.pypa.io/en/latest/userguide/declarative_config.html>`_,
- `pyproject.toml <https://pip.pypa.io/en/stable/reference/build-system/pyproject-toml/>`_
and `requirements.txt <https://pip.pypa.io/en/stable/user_guide/#requirements-files>`_ --
standard Python packaging metadata, declaring the distribution name, dependencies,
etc.
Expand Down Expand Up @@ -288,8 +287,9 @@ modules must be part of the distribution, or provided by another
distribution -- which then must be declared as a run-time dependency.

*Declaring run-time dependencies:* These dependencies are declared in
``setup.cfg`` (generated from ``setup.cfg.m4``) as
`install_requires <https://setuptools.pypa.io/en/latest/userguide/dependency_management.html#declaring-required-dependency>`_.
``pyproject.toml`` (generated from ``pyproject.toml.m4``) as
`[project] dependencies <https://setuptools.pypa.io/en/latest/userguide/dependency_management.html#declaring-required-dependency>`_ (in the older terminology of ``setup.cfg`` and ``setup.py``,
these dependencies were known as ``install_requires``).

*Reducing module-level run-time dependencies:*

Expand Down Expand Up @@ -467,14 +467,17 @@ features, which will only be working if the user also has installed
**sagemath-symbolics**.

*Declaring optional run-time dependencies:* It is possible to declare
such optional dependencies as `extras_require <https://setuptools.pypa.io/en/latest/userguide/dependency_management.html#optional-dependencies>`_ in ``setup.cfg``
(generated from ``setup.cfg.m4``). This is a very limited mechanism
such dependencies as `[project.optional-dependencies] <https://setuptools.pypa.io/en/latest/userguide/dependency_management.html#optional-dependencies>`_ in ``pyproject.toml``
(generated from ``pyproject.toml.m4``).
(In the older terminology of ``setup.cfg`` and ``setup.py``,
these optional dependencies were known as ``extras_require``.)
This is a very limited mechanism
-- in particular it does not affect the build phase of the
distribution in any way. It basically only provides a way to give a
nickname to a distribution that can be installed as an add-on.

In our example, we could declare an ``extras_require`` so that users
could use ``pip install sagemath-coding[symbolics]``.
In our example, we could declare an optional dependency so that users
could use ``pip install "sagemath-coding[symbolics]"``.


Doctest-only dependencies
Expand Down Expand Up @@ -516,7 +519,7 @@ The version information for dependencies comes from the files
``build/pkgs/*/package-version.txt``. We use the
`m4 <https://www.gnu.org/software/m4/manual/html_node/index.html>`_
macro processor to insert the version information in the generated files
``pyproject.toml``, ``setup.cfg``, ``requirements.txt``.
``pyproject.toml`` and ``requirements.txt``.


Hierarchy of distribution packages
Expand Down Expand Up @@ -546,8 +549,8 @@ Hierarchy of distribution packages
sphinx_plot(g, figsize=(8, 4), axes=False)


Solid arrows indicate ``install_requires``, i.e., a declared runtime dependency.
Dashed arrows indicate ``extras_require``, i.e., a declared optional runtime dependency.
Solid arrows indicate declared runtime dependencies (``install_requires``).
Dashed arrows indicate declared optional runtime dependencies (``extras_require``).
Not shown in the diagram are build dependencies and optional dependencies for testing.

- `sage_conf <https://pypi.org/project/sage-conf/>`_ is a configuration
Expand Down
181 changes: 181 additions & 0 deletions src/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,192 @@ requires = [
]
build-backend = "setuptools.build_meta"

[project]
name = "sagemath-standard"
description = "Sage: Open Source Mathematics Software: Standard Python Library"
dependencies = [
'six >=1.15.0',
# From build/pkgs/sagelib/dependencies
'conway-polynomials >=0.8',
'cypari2 >=2.1.1',
'cysignals >=1.10.2',
'cython >=3.0, != 3.0.3, <4.0',
'gmpy2 ~=2.1.b999',
# According to https://pypi.org/project/importlib-metadata/,
# 4.13 provides the features of Python 3.11 importlib.metadata
'importlib_metadata >=4.13; python_version<"3.11"',
# According to https://pypi.org/project/importlib-resources/,
# version 5.7 provides the features of Python 3.11 importlib.resources
'importlib_resources >= 5.7; python_version<"3.11"',
'lrcalc ~=2.1',
'memory_allocator',
'numpy >=1.19',
'pkgconfig',
# Issue #30922: pplpy 0.8.4 and earlier do not declare dependencies correctly
'pplpy >=0.8.6',
'primecountpy',
'requests >=2.13.0',
# According to https://github.com/python/typing_extensions/blob/main/CHANGELOG.md,
# version 4.4.0 adds another Python 3.11 typing backport
'typing_extensions >= 4.4.0; python_version<"3.11"',
# From Makefile.in: SAGERUNTIME
'ipython >=7.13.0',
'pexpect >=4.8.0',
# From Makefile.in: DOC_DEPENDENCIES
'sphinx >=5.2, <9',
'networkx >=2.4',
# 1.8 is known good version.
# Per https://docs.scipy.org/doc/scipy/dev/core-dev/index.html#version-numbering
# and https://docs.scipy.org/doc/scipy/dev/core-dev/index.html#deprecations,
# deprecations cannot be introduced in micro releases.
# SciPy devs wait "at least 6 months", "in practice two (minor) releases"
# from deprecation to removal of a feature.
'scipy >=1.5',
'sympy >=1.6, <2.0',
# Issue #33642: Set lower bound for use of matplotlib color maps introduced in #33491,
# and to suppress deprecation warnings (https://github.com/matplotlib/matplotlib/pull/21073)
'matplotlib >=3.5.1',
'pillow >=7.2.0',
'mpmath >=1.1.0',
'ipykernel >=5.2.1',
'jupyter-client',
'ipywidgets >=7.5.1',
'fpylll >=0.5.9',
'ptyprocess > 0.5',
]
dynamic = ["version"]
# duplicated from m4/pyproject_toml_metadata.m4
license = {text = "GNU General Public License (GPL) v2 or later"}
authors = [{name = "The Sage Developers", email = "sage-support@googlegroups.com"}]
classifiers = [
"Development Status :: 6 - Mature",
"Intended Audience :: Education",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)",
"Operating System :: POSIX",
"Operating System :: MacOS :: MacOS X",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Scientific/Engineering :: Mathematics",
]
urls = {Homepage = "https://www.sagemath.org"}
requires-python = ">=3.9, <3.13"

[project.optional-dependencies]
R = [
'rpy2 >=3.3',
]
bliss = [
'sagemath-bliss',
]
coxeter3 = [
'sagemath-coxeter3',
]
mcqd = [
'sagemath-mcqd',
]
meataxe = [
'sagemath-meataxe',
]
sirocco = [
'sagemath-sirocco',
]
tdlib = [
'sagemath-tdlib',
]

[project.readme]
file = "README.rst"
content-type = "text/x-rst"

[tool.conda-lock]
platforms = [
'osx-64', 'linux-64', 'linux-aarch64', 'osx-arm64'
]

[tool.setuptools]
script-files = [
# The sage script
"bin/sage",
# Other scripts that should be in the path also for OS packaging of sage:
"bin/sage-eval",
# Included because it is useful for doctesting/coverage testing user scripts too:
"bin/sage-runtests",
"bin/sage-fixdoctests",
"bin/sage-coverage",
# The following is deprecated but might still be used in user package install scripts
"bin/sage-cython",
# Helper scripts invoked by sage script
# (they would actually belong to something like libexec)
"bin/sage-cachegrind",
"bin/sage-callgrind",
"bin/sage-massif",
"bin/sage-omega",
"bin/sage-valgrind",
"bin/sage-venv-config",
"bin/sage-version.sh",
"bin/sage-cleaner",
# Only makes sense in sage-the-distribution. TODO: Move to another installation script.
"bin/sage-list-packages",
# Uncategorized scripts in alphabetical order
"bin/math-readline",
"bin/sage-env",
# sage-env-config -- installed by sage_conf
# sage-env-config.in -- not to be installed
"bin/sage-grep",
"bin/sage-grepdoc",
"bin/sage-inline-fortran",
"bin/sage-ipynb2rst",
"bin/sage-ipython",
"bin/sage-notebook",
"bin/sage-num-threads.py",
"bin/sage-preparse",
"bin/sage-python",
"bin/sage-run",
"bin/sage-run-cython",
"bin/sage-startuptime.py",
"bin/sage-update-version",
]
license-files = ["LICENSE.txt"]
include-package-data = false

[tool.setuptools.package-data]
"sage.libs.gap" = ["sage.gaprc"]
"sage.interfaces" = ["sage-maxima.lisp"]
"sage.doctest" = ["tests/*"]
"sage.repl.rich_output" = ["example*"]
sage = [
"ext_data/*",
"ext_data/kenzo/*",
"ext_data/singular/*",
"ext_data/singular/function_field/*",
"ext_data/images/*",
"ext_data/doctest/*",
"ext_data/doctest/invalid/*",
"ext_data/gap/*",
"ext_data/gap/joyner/*",
"ext_data/mwrank/*",
"ext_data/notebook-ipython/*",
"ext_data/nbconvert/*",
"ext_data/graphs/*",
"ext_data/pari/*",
"ext_data/pari/dokchitser/*",
"ext_data/pari/buzzard/*",
"ext_data/pari/simon/*",
"ext_data/magma/*",
"ext_data/magma/latex/*",
"ext_data/magma/sage/*",
"ext_data/valgrind/*",
"ext_data/threejs/*",
]

[tool.setuptools.dynamic]
version = {file = ["VERSION.txt"]}

[external]
# External dependencies in the format proposed by https://peps.python.org/pep-0725
# In the future, sage-the-distribution can read this information
Expand Down
Loading
Loading