We have multiple python projects, and are considering converting them to use pyproject.toml
instead of setup.py
.
Is there a simple way to automate this?
We have multiple python projects, and are considering converting them to use pyproject.toml
instead of setup.py
.
Is there a simple way to automate this?
While dealing with some pyproject.toml
issues, I encountered this project:
https://pypi.org/project/ini2toml/
The projects description:
This project is experimental and under active development Issue reports and contributions are very welcome. The original purpose of this project is to help migrating
setup.cfg
files to PEP 621, but by extension it can also be used to convert any compatible.ini/.cfg
file to.toml
.
While this only helps to turn .cfg/.ini
files to PEP 621 .toml
, there is another project that turn setup.py files into cfg files.
https://github.com/gvalkov/setuptools-py2cfg
This script helps convert existing setup.py files to
setup.cfg
in the format expected by setuptools.
Combining these two processes by writing a script you could potentially come up with an automated way to transform the files. I have not tried this as of yet but would be interested if you could make this idea work :)
pdm
supports importing metadata from various existing and older metadata files, including setup.py
.
You can either:
pdm init
on your project root (with the old metadata files) and follow the instructions, orpdm import setup.py
explicitly.See Import project metadata from existing project files for more details.