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
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)
+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)
Last 10 new commits:
3666918 | build/pkgs/stack_data: Update to 0.6.1 |
814a96e | Merge #34795 |
05f186f | sage.arith.long: improve tests and documentation |
3e86d91 | sage.arith.long.integer_check_py: fix for python 3.11 |
ac0105e | Filter out locale DeprecationWarning |
e3de51a | Merge #33842 |
1c37625 | pkgs/sage-setup (pyproject.toml): Convert from setup.cfg using ini2toml-0.11.3 |
e4b6f1c | pkgs/sage-sage-docbuild (pyproject.toml): Convert from setup.cfg using ini2toml-0.11.3 |
546b847 | pkgs/sage-sws2rst (pyproject.toml): Convert from setup.cfg using ini2toml-0.11.3 |
a86ea09 | pkgs/sage-conf (pyproject.toml): Convert from setup.cfg using ini2toml-0.11.3 |
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)Branch pushed to git repo; I updated commit sha1. Last 10 new commits:
88e18d0 | Merge #34855 |
0bd13ac | build/make/Makefile.in: Remove duplicate setting of PYPI_WHEEL_PACKAGES |
f712d67 | Merge #34855 |
5fc1add | build/pkgs/sagemath*/spkg-src: Use build |
1531fda | build/pkgs/sagemath_flint_arb/dependencies: Fix up |
c2b8c9c | Merge #30666 |
4cc8ca1 | pkgs/sagemath-environment (pyproject.toml.m4): Convert from setup.cfg.m4 using ini2toml-0.11.3 |
d20a24e | pkgs/sagemath-environment (pyproject.toml.m4): Fix up |
fa017ec | pkgs/sagemath-objects (pyproject.toml.m4): Convert from setup.cfg.m4 using ini2toml-0.11.3 and fix up |
4b406ce | pkgs/sagemath-objects (pyproject.toml.m4): Fix up |
Branch pushed to git repo; I updated commit sha1. New commits:
ce70804 | pkgs/sagemath-repl (pyproject.toml.m4): Convert from setup.cfg.m4 using ini2toml-0.11.3 and fix up |
bab4cc7 | pkgs/sagemath-repl (pyproject.toml.m4): Fix up |
ce8e456 | pkgs/sagemath-categories (pyproject.toml.m4): Convert from setup.cfg.m4 using ini2toml-0.11.3 and fix up |
5baf5db | pkgs/sagemath-{flint-arb,homfly,giac,gap} (pyproject.toml.m4): Convert from setup.cfg.m4 using ini2toml-0.11.3 and fix up |
0d18b20 | pkgs/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:
f81a0c8 | src, pkgs/sagemath-standard (pyproject.toml.m4): Convert from setup.cfg.m4 using ini2toml-0.11.3 and fix up |
We now how have a functional pyproject.toml in the root.