Skip to content
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

PEP 621: Migrate from setup.py to pyproject.toml #339

Merged
merged 1 commit into from
Nov 3, 2024

Conversation

cclauss
Copy link
Contributor

@cclauss cclauss commented Oct 18, 2024

Fixes #337
Blocked by #338

How

Migrate setup.py to setup.cfg using setuptools-py2cfg plus manual modifications. Use setup-cfg-fmt to format the results.

Migrate settings from setup.cfg into pyproject.toml using ini2toml to do the file conversion and running pyproject-fmt and then validate-pyproject to validate the results.

git checkout -b setuptools-py2cfg
pipx run setuptools-py2cfg > setup.cfg
pipx run ini2toml setup.cfg -o pyproject.toml
git add pyproject.toml
pipx run validate-pyproject pyproject.toml
code pyproject.toml  # Make any suggested changes
pipx run pyproject-fmt pyproject.toml
pipx run validate-pyproject pyproject.toml
git rm --force setup.cfg
git rm setup.py
code makefile .github/workflows/pythonpublish.yml
python3 -m venv .venv
source .venv/bin/activate
pipx run build  # —> Successfully built pyttsx3-2.98.tar.gz and pyttsx3-2.98-py3-none-any.whl
ls dist  # —> pyttsx3-2.98-py3-none-any.whl    pyttsx3-2.98.tar.gz
pip install --editable .
git commit -am"PEP 621: Migrate from setup.py to pyproject.toml"
git push

Why

https://setuptools.pypa.io/en/latest/userguide/quickstart.html#basic-use

We recommend users expose as much as possible configuration in a more declarative way via the pyproject.toml or setup.cfg, and keep the setup.py minimal with only the dynamic parts (or even omit it completely if applicable).

From validate-pyproject README:

With the approval of PEP 517 and PEP 518, the Python community shifted towards a strong focus on standardization for packaging software, which allows more freedom when choosing tools during development and make sure packages created using different technologies can interoperate without the need for custom installation procedures.

This shift became even more clear when PEP 621 was also approved, as a standardized way of specifying project metadata and dependencies.

validate-pyproject was born in this context, with the mission of validating pyproject.toml files, and making sure they are compliant with the standards and PEPs.

@willwade
Copy link
Collaborator

Oh wow. That’s great. I’ll do a pr for #338 after we do this.

@cclauss
Copy link
Contributor Author

cclauss commented Oct 18, 2024

ALWAYS add tests (#338) before making changes (like this PR) instead of vice versa. The before/after test runs can be enlightening.

@cclauss cclauss marked this pull request as draft October 18, 2024 10:38
@nateshmbhat
Copy link
Owner

Ya wud be good to merge the tests first before this PR is merged imo

@cclauss cclauss marked this pull request as ready for review October 25, 2024 22:04
@willwade
Copy link
Collaborator

Now tests are merged is this good to go?

I have a feeling we should do a review of tests once we do #348 it should pass all tests

@cclauss
Copy link
Contributor Author

cclauss commented Oct 27, 2024

Ready for review.

@cclauss
Copy link
Contributor Author

cclauss commented Oct 27, 2024

Can we remove any instances of skipif?!?

@willwade
Copy link
Collaborator

Yep. We should be able to

I think we need to make a change too. Espeak needs to run on all platforms. It's fiddly though as espeak-ng needs to be on all platforms

Not massively important. Linux is the main target

@willwade
Copy link
Collaborator

try removing these skips now.. im hoping this should be ok..

@cclauss cclauss mentioned this pull request Nov 3, 2024
@willwade willwade closed this in c596bae Nov 3, 2024
@willwade willwade reopened this Nov 3, 2024
@willwade willwade merged commit b58e3b4 into nateshmbhat:master Nov 3, 2024
20 checks passed
@cclauss cclauss deleted the setuptools-py2cfg branch November 3, 2024 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

python setup.py and the use of setup.py as a command line tool are deprecated
3 participants