Skip to content

Convert setup.py to pyproject.toml #5

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

Merged

Conversation

hugovk
Copy link
Contributor

@hugovk hugovk commented Nov 7, 2023

Fixes #4.

I used two tools for this:

I used the first to convert setup.py to setup.cfg, and the second from setup.cfg to pyproject.toml, something like this:

pip install setuptools-py2cfg ini2toml
setuptools-py2cfg setup.py > setup.cfg
ini2toml setup.cfg > pyproject.toml
rm setup.*

Next, I added a few more pre-commit hooks, one to format pyproject.toml to make it easy to compare against other projects, and some others to check TOML and YAML files.

Then to check the output is okay, I ran:

pip install build
python -m build

Which creates an sdist and wheel in the dist directory. I compared the output from master and from this branch, and there were no unexpected differences.

We're still using setuptools here as the "build backend", which is just fine. We can also easily change it to others too. I tend to use hatchling, but it doesn't make too much difference.

@egeakman
Copy link
Member

egeakman commented Nov 7, 2023

Thanks Hugo!

@egeakman egeakman added the enhancement New feature or request label Nov 7, 2023
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
@egeakman egeakman merged commit 4f8193f into python-docs-translations:master Nov 8, 2023
@hugovk hugovk deleted the setup.py-to-pyproject.toml branch November 8, 2023 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use the latest packaging method instead of setup.py
2 participants