diff --git a/bootstrap b/bootstrap index 14eb56c9981..f7776186f37 100755 --- a/bootstrap +++ b/bootstrap @@ -232,8 +232,7 @@ save () { src/environment-optional-3.[89].yml src/environment-optional-3.1[0-9].yml \ src/Pipfile \ src/pyproject.toml \ - src/requirements.txt \ - src/setup.cfg + src/requirements.txt # Update version echo "$NEWCONFVERSION" >$PKG/package-version.txt diff --git a/build/bin/write-dockerfile.sh b/build/bin/write-dockerfile.sh index 3c62d6082e4..36cf4862626 100755 --- a/build/bin/write-dockerfile.sh +++ b/build/bin/write-dockerfile.sh @@ -236,7 +236,7 @@ $ADD Makefile VERSION.txt COPYING.txt condarc.yml README.md bootstrap bootstrap- $ADD config/config.rpath config/config.rpath $ADD src/doc/bootstrap src/doc/bootstrap $ADD src/bin src/bin -$ADD src/Pipfile.m4 src/pyproject.toml.m4 src/requirements.txt.m4 src/setup.cfg.m4 src/VERSION.txt src/ +$ADD src/Pipfile.m4 src/pyproject.toml.m4 src/requirements.txt.m4 src/VERSION.txt src/ $ADD m4 ./m4 $ADD pkgs pkgs $ADD build ./build diff --git a/build/pkgs/typing_extensions/version_requirements.txt b/build/pkgs/typing_extensions/version_requirements.txt index e1a912109ed..d10f4dffbd3 100644 --- a/build/pkgs/typing_extensions/version_requirements.txt +++ b/build/pkgs/typing_extensions/version_requirements.txt @@ -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" diff --git a/pkgs/sagemath-standard/setup.cfg b/pkgs/sagemath-standard/setup.cfg deleted file mode 120000 index ba9b315730a..00000000000 --- a/pkgs/sagemath-standard/setup.cfg +++ /dev/null @@ -1 +0,0 @@ -../../src/setup.cfg \ No newline at end of file diff --git a/pkgs/sagemath-standard/setup.cfg.m4 b/pkgs/sagemath-standard/setup.cfg.m4 deleted file mode 120000 index 8934d7b5955..00000000000 --- a/pkgs/sagemath-standard/setup.cfg.m4 +++ /dev/null @@ -1 +0,0 @@ -../../src/setup.cfg.m4 \ No newline at end of file diff --git a/pkgs/sagemath-standard/tox.ini b/pkgs/sagemath-standard/tox.ini index 6aae1ef1bfa..fcd32d0764b 100644 --- a/pkgs/sagemath-standard/tox.ini +++ b/pkgs/sagemath-standard/tox.ini @@ -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)' @@ -45,7 +45,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. # diff --git a/src/Pipfile.m4 b/src/Pipfile.m4 index feca57f7de9..d03a2a12814 100644 --- a/src/Pipfile.m4 +++ b/src/Pipfile.m4 @@ -6,8 +6,8 @@ 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 = "*" @@ -15,8 +15,8 @@ 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 = "." diff --git a/src/doc/en/developer/coding_basics.rst b/src/doc/en/developer/coding_basics.rst index c586b030ed8..b87654b8306 100644 --- a/src/doc/en/developer/coding_basics.rst +++ b/src/doc/en/developer/coding_basics.rst @@ -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.m4` (or the corresponding file of another distribution). Large data files should not be added to the Sage source tree. Instead, it diff --git a/src/doc/en/developer/coding_in_python.rst b/src/doc/en/developer/coding_in_python.rst index 37552e5bcfe..9a325f01e52 100644 --- a/src/doc/en/developer/coding_in_python.rst +++ b/src/doc/en/developer/coding_in_python.rst @@ -14,8 +14,9 @@ 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), ``m4/pyproject_toml_metadata.m4`` (for +the Sage library and 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 diff --git a/src/doc/en/developer/packaging_sage_library.rst b/src/doc/en/developer/packaging_sage_library.rst index 9fbb4271727..a88e33b93ca 100644 --- a/src/doc/en/developer/packaging_sage_library.rst +++ b/src/doc/en/developer/packaging_sage_library.rst @@ -174,8 +174,7 @@ The source directory of a distribution package, such as $ ./sage --fixdistributions --set all --from-egg-info -- `pyproject.toml `_, - `setup.cfg `_, +- `pyproject.toml `_ and `requirements.txt `_ -- standard Python packaging metadata, declaring the distribution name, dependencies, etc. @@ -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 `_. +``pyproject.toml`` (generated from ``pyproject.toml.m4``) as +`[project] dependencies `_ (in the older terminology of ``setup.cfg`` and ``setup.py``, +these dependencies were known as ``install_requires``). *Reducing module-level run-time dependencies:* @@ -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 `_ in ``setup.cfg`` -(generated from ``setup.cfg.m4``). This is a very limited mechanism +such dependencies as `[project.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 @@ -516,7 +519,7 @@ The version information for dependencies comes from the files ``build/pkgs/*/package-version.txt``. We use the `m4 `_ 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 @@ -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 `_ is a configuration diff --git a/src/pyproject.toml.m4 b/src/pyproject.toml.m4 index 7065ba1468c..65e486244cb 100644 --- a/src/pyproject.toml.m4 +++ b/src/pyproject.toml.m4 @@ -1,3 +1,4 @@ +include(`sage_spkg_versions_toml.m4')dnl' -*- conf-toml -*- [build-system] # Minimum requirements for the build system to execute. requires = [ @@ -5,25 +6,156 @@ requires = [ # Some version of sage-conf is required. # Note that PEP517/518 have no notion of optional sage_spkg dependencies: # https://github.com/pypa/pip/issues/6144 - esyscmd(`sage-get-system-packages install-requires-toml \ - sage_conf \ - setuptools \ - wheel \ - sage_setup \ - cypari \ - cysignals \ - cython \ - gmpy2 \ - jinja2 \ - jupyter_core \ - numpy \ - pkgconfig \ - pplpy \ - memory_allocator \ - ')] + SPKG_INSTALL_REQUIRES_sage_conf + SPKG_INSTALL_REQUIRES_setuptools + SPKG_INSTALL_REQUIRES_wheel + SPKG_INSTALL_REQUIRES_sage_setup + SPKG_INSTALL_REQUIRES_cypari + SPKG_INSTALL_REQUIRES_cysignals + SPKG_INSTALL_REQUIRES_cython + SPKG_INSTALL_REQUIRES_gmpy2 + SPKG_INSTALL_REQUIRES_jupyter_core + SPKG_INSTALL_REQUIRES_memory_allocator + SPKG_INSTALL_REQUIRES_numpy + SPKG_INSTALL_REQUIRES_pkgconfig + SPKG_INSTALL_REQUIRES_pplpy +] build-backend = "setuptools.build_meta" +[project] +name = "sagemath-standard" +description = "Sage: Open Source Mathematics Software: Standard Python Library" +dependencies = [ + SPKG_INSTALL_REQUIRES_sage_conf + SPKG_INSTALL_REQUIRES_six +dnl From build/pkgs/sagelib/dependencies + SPKG_INSTALL_REQUIRES_conway_polynomials + SPKG_INSTALL_REQUIRES_cypari + SPKG_INSTALL_REQUIRES_cysignals + SPKG_INSTALL_REQUIRES_cython + SPKG_INSTALL_REQUIRES_gmpy2 + SPKG_INSTALL_REQUIRES_importlib_metadata + SPKG_INSTALL_REQUIRES_importlib_resources + SPKG_INSTALL_REQUIRES_jupyter_core + SPKG_INSTALL_REQUIRES_lrcalc_python + SPKG_INSTALL_REQUIRES_memory_allocator + SPKG_INSTALL_REQUIRES_numpy + SPKG_INSTALL_REQUIRES_pkgconfig + SPKG_INSTALL_REQUIRES_pplpy + SPKG_INSTALL_REQUIRES_primecountpy + SPKG_INSTALL_REQUIRES_requests + SPKG_INSTALL_REQUIRES_typing_extensions +dnl From Makefile.in: SAGERUNTIME + SPKG_INSTALL_REQUIRES_ipython + SPKG_INSTALL_REQUIRES_pexpect +dnl From Makefile.in: DOC_DEPENDENCIES + SPKG_INSTALL_REQUIRES_sphinx + SPKG_INSTALL_REQUIRES_networkx + SPKG_INSTALL_REQUIRES_scipy + SPKG_INSTALL_REQUIRES_sympy + SPKG_INSTALL_REQUIRES_matplotlib + SPKG_INSTALL_REQUIRES_pillow + SPKG_INSTALL_REQUIRES_mpmath + SPKG_INSTALL_REQUIRES_ipykernel + SPKG_INSTALL_REQUIRES_jupyter_client + SPKG_INSTALL_REQUIRES_ipywidgets + SPKG_INSTALL_REQUIRES_fpylll +dnl pycryptosat # Sage distribution installs it as part of cryptominisat. According to its README on https://pypi.org/project/pycryptosat/: "The pycryptosat python package compiles while compiling CryptoMiniSat. It cannot be compiled on its own, it must be compiled at the same time as CryptoMiniSat." +dnl Packages with important upper version bounds + SPKG_INSTALL_REQUIRES_ptyprocess +] +dynamic = ["version"] +include(`pyproject_toml_metadata.m4')dnl' + +[project.optional-dependencies] +R = [ + SPKG_INSTALL_REQUIRES_rpy2 +] + +[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"]} diff --git a/src/setup.cfg.m4 b/src/setup.cfg.m4 deleted file mode 100644 index e2a3330518d..00000000000 --- a/src/setup.cfg.m4 +++ /dev/null @@ -1,133 +0,0 @@ -include(`sage_spkg_versions.m4')dnl' -*- conf-unix -*- -[metadata] -name = sagemath-standard -version = file: VERSION.txt -description = Sage: Open Source Mathematics Software: Standard Python Library -long_description = file: README.rst -long_description_content_type = text/x-rst -license_files = LICENSE.txt -include(`setup_cfg_metadata.m4')dnl' - -[options] -python_requires = >=3.9, <3.13 -install_requires = - SPKG_INSTALL_REQUIRES_sage_conf - SPKG_INSTALL_REQUIRES_six -dnl From build/pkgs/sagelib/dependencies - SPKG_INSTALL_REQUIRES_conway_polynomials - SPKG_INSTALL_REQUIRES_cypari - SPKG_INSTALL_REQUIRES_cysignals - SPKG_INSTALL_REQUIRES_cython - SPKG_INSTALL_REQUIRES_gmpy2 - SPKG_INSTALL_REQUIRES_importlib_metadata - SPKG_INSTALL_REQUIRES_importlib_resources - SPKG_INSTALL_REQUIRES_jupyter_core - SPKG_INSTALL_REQUIRES_lrcalc_python - SPKG_INSTALL_REQUIRES_memory_allocator - SPKG_INSTALL_REQUIRES_numpy - SPKG_INSTALL_REQUIRES_pkgconfig - SPKG_INSTALL_REQUIRES_pplpy - SPKG_INSTALL_REQUIRES_primecountpy - SPKG_INSTALL_REQUIRES_requests - SPKG_INSTALL_REQUIRES_typing_extensions -dnl From Makefile.in: SAGERUNTIME - SPKG_INSTALL_REQUIRES_ipython - SPKG_INSTALL_REQUIRES_pexpect -dnl From Makefile.in: DOC_DEPENDENCIES - SPKG_INSTALL_REQUIRES_sphinx - SPKG_INSTALL_REQUIRES_networkx - SPKG_INSTALL_REQUIRES_scipy - SPKG_INSTALL_REQUIRES_sympy - SPKG_INSTALL_REQUIRES_matplotlib - SPKG_INSTALL_REQUIRES_pillow - SPKG_INSTALL_REQUIRES_mpmath - SPKG_INSTALL_REQUIRES_ipykernel - SPKG_INSTALL_REQUIRES_jupyter_client - SPKG_INSTALL_REQUIRES_ipywidgets - SPKG_INSTALL_REQUIRES_fpylll -dnl pycryptosat # Sage distribution installs it as part of cryptominisat. According to its README on https://pypi.org/project/pycryptosat/: "The pycryptosat python package compiles while compiling CryptoMiniSat. It cannot be compiled on its own, it must be compiled at the same time as CryptoMiniSat." -dnl Packages with important upper version bounds - SPKG_INSTALL_REQUIRES_ptyprocess - -scripts = - # 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 - -[options.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/* - -[options.extras_require] -R = SPKG_INSTALL_REQUIRES_rpy2