sagemath/sage

Migrate from setup.cfg to pyproject.toml

Closed this issue · 18 comments

Starting with v61, setuptools (experimentally) support pyproject.toml for configuration, see pypa/setuptools#1688.

setuptools 68.1.0 declared support for pyproject.toml as stable.

Moreover, setup.cfg will eventually be deprecated so it's a good idea to migrate from cfg to toml.

Migration can be done mostly automatically using https://ini2toml.readthedocs.io/en/latest/readme.html:

  (cd pkgs/sage-conf && ini2toml setup.cfg > pyproject.toml && git rm -f setup.cfg && git add pyproject.toml)

  (cd pkgs/sagemath-objects && (echo && echo '[project]' && ini2toml -p setup.cfg setup.cfg.m4 | sed "1,/[[]project/d;s/\"esys/esys/;s/install-requires /install-requires-toml /;s/ *\\\\\\\\\"/\')/;/conf-unix/d;" ) >> pyproject.toml.m4 && git rm -f setup.cfg.m4)

(the conversion of the m4 files loses some install-requires and needs to be fixed up manually.)

This is also preparation for #34630 (migration from setuptools to meson-python)

Depends on #33842
Depends on #30666

CC: @mkoeppe

Component: build

Author: Matthias Koeppe

Branch/Commit: u/mkoeppe/migrate_from_setup_cfg_to_pyproject_toml @ f81a0c8

Issue created by migration from https://trac.sagemath.org/ticket/33577

Changed dependencies from #33566 to none

Description changed:

--- 
+++ 
@@ -1,3 +1,6 @@
 Starting with v61, setuptools (experimentally) support pyproject.toml for configuration, see https://github.com/pypa/setuptools/issues/1688. Moreover, setup.cfg will eventually be deprecated so it's a good idea to migrate from cfg to toml.
 
 Migration can probably be done using https://ini2toml.readthedocs.io/en/latest/readme.html.
+
+This is also preparation for #34630 (migration from setuptools to meson-python)
+

Dependencies: #33842

Description changed:

--- 
+++ 
@@ -1,6 +1,10 @@
 Starting with v61, setuptools (experimentally) support pyproject.toml for configuration, see https://github.com/pypa/setuptools/issues/1688. Moreover, setup.cfg will eventually be deprecated so it's a good idea to migrate from cfg to toml.
 
-Migration can probably be done using https://ini2toml.readthedocs.io/en/latest/readme.html.
+Migration can be done automatically using https://ini2toml.readthedocs.io/en/latest/readme.html:
+
+```
+./sage -sh -c 'cd pkgs/sage-conf && ini2toml setup.cfg > pyproject.toml && git rm -f setup.cfg && git add pyproject.toml'
+```
 
 This is also preparation for #34630 (migration from setuptools to meson-python)
 

Commit: a86ea09

Last 10 new commits:

3666918build/pkgs/stack_data: Update to 0.6.1
814a96eMerge #34795
05f186fsage.arith.long: improve tests and documentation
3e86d91sage.arith.long.integer_check_py: fix for python 3.11
ac0105eFilter out locale DeprecationWarning
e3de51aMerge #33842
1c37625pkgs/sage-setup (pyproject.toml): Convert from setup.cfg using ini2toml-0.11.3
e4b6f1cpkgs/sage-sage-docbuild (pyproject.toml): Convert from setup.cfg using ini2toml-0.11.3
546b847pkgs/sage-sws2rst (pyproject.toml): Convert from setup.cfg using ini2toml-0.11.3
a86ea09pkgs/sage-conf (pyproject.toml): Convert from setup.cfg using ini2toml-0.11.3

Changed dependencies from #33842 to #33842, #30666

Description changed:

--- 
+++ 
@@ -3,7 +3,9 @@
 Migration can be done automatically using https://ini2toml.readthedocs.io/en/latest/readme.html:
 
 ```
-./sage -sh -c 'cd pkgs/sage-conf && ini2toml setup.cfg > pyproject.toml && git rm -f setup.cfg && git add pyproject.toml'
+  (cd pkgs/sage-conf && ini2toml setup.cfg > pyproject.toml && git rm -f setup.cfg && git add pyproject.toml)
+
+  (cd pkgs/sagemath-objects && (echo && echo '[project]' && ini2toml -p setup.cfg setup.cfg.m4 | sed "1,/[[]project/d;s/\"esys/esys/;s/install-requires /install-requires-toml /;s/ *\\\\\\\\\"/\')/;/conf-unix/d;" ) >> pyproject.toml.m4 && git rm -f setup.cfg.m4)
 ```
 
 This is also preparation for #34630 (migration from setuptools to meson-python)

Changed commit from a86ea09 to 4b406ce

Branch pushed to git repo; I updated commit sha1. Last 10 new commits:

88e18d0Merge #34855
0bd13acbuild/make/Makefile.in: Remove duplicate setting of PYPI_WHEEL_PACKAGES
f712d67Merge #34855
5fc1addbuild/pkgs/sagemath*/spkg-src: Use build
1531fdabuild/pkgs/sagemath_flint_arb/dependencies: Fix up
c2b8c9cMerge #30666
4cc8ca1pkgs/sagemath-environment (pyproject.toml.m4): Convert from setup.cfg.m4 using ini2toml-0.11.3
d20a24epkgs/sagemath-environment (pyproject.toml.m4): Fix up
fa017ecpkgs/sagemath-objects (pyproject.toml.m4): Convert from setup.cfg.m4 using ini2toml-0.11.3 and fix up
4b406cepkgs/sagemath-objects (pyproject.toml.m4): Fix up

Changed commit from 4b406ce to 0d18b20

Branch pushed to git repo; I updated commit sha1. New commits:

ce70804pkgs/sagemath-repl (pyproject.toml.m4): Convert from setup.cfg.m4 using ini2toml-0.11.3 and fix up
bab4cc7pkgs/sagemath-repl (pyproject.toml.m4): Fix up
ce8e456pkgs/sagemath-categories (pyproject.toml.m4): Convert from setup.cfg.m4 using ini2toml-0.11.3 and fix up
5baf5dbpkgs/sagemath-{flint-arb,homfly,giac,gap} (pyproject.toml.m4): Convert from setup.cfg.m4 using ini2toml-0.11.3 and fix up
0d18b20pkgs/sagemath-{flint-arb,homfly,giac,gap} (pyproject.toml.m4): Fix up

Author: Matthias Koeppe

Description changed:

--- 
+++ 
@@ -1,12 +1,13 @@
 Starting with v61, setuptools (experimentally) support pyproject.toml for configuration, see https://github.com/pypa/setuptools/issues/1688. Moreover, setup.cfg will eventually be deprecated so it's a good idea to migrate from cfg to toml.
 
-Migration can be done automatically using https://ini2toml.readthedocs.io/en/latest/readme.html:
+Migration can be done mostly automatically using https://ini2toml.readthedocs.io/en/latest/readme.html:
 
 ```
   (cd pkgs/sage-conf && ini2toml setup.cfg > pyproject.toml && git rm -f setup.cfg && git add pyproject.toml)
 
   (cd pkgs/sagemath-objects && (echo && echo '[project]' && ini2toml -p setup.cfg setup.cfg.m4 | sed "1,/[[]project/d;s/\"esys/esys/;s/install-requires /install-requires-toml /;s/ *\\\\\\\\\"/\')/;/conf-unix/d;" ) >> pyproject.toml.m4 && git rm -f setup.cfg.m4)
 ```
+(the conversion of the m4 files loses some install-requires and needs to be fixed up manually.)
 
 This is also preparation for #34630 (migration from setuptools to meson-python)
 

Branch pushed to git repo; I updated commit sha1. New commits:

f81a0c8src, pkgs/sagemath-standard (pyproject.toml.m4): Convert from setup.cfg.m4 using ini2toml-0.11.3 and fix up

Changed commit from 0d18b20 to f81a0c8

We now how have a functional pyproject.toml in the root.