-
Notifications
You must be signed in to change notification settings - Fork 62
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
Write version in pyproject toml if available #401
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea!
Most important point: I think a test has to be added? There will be corner cases later on, I fear.
See https://snarky.ca/what-the-heck-is-pyproject-toml/ I probably do not understand enough of this yet...
The writing of the version works, which is the main thing I wanted to fix. But currently zest.releaser only creates an sdist and wheel if there is a `setup.py` file. In that case it runs `python setup.py sdist`, etc. So there is room for improvement. In the new test, I use the tha.example package, remove `setup.cfg` and `setup.py`, and add a `pyproject.toml`. I compiled this file with help from `pdm`. See also https://pdm.fming.dev/latest/usage/cli_reference/#exec-0--import Roughly: - Extract the example.tar and copy it somewhere. - In that directory do git init and commit everything. - Do `pipx install pdm`. - pdm init - pdm add setuptools # otherwise you get an error in the next step - pdm import setup.py - Then you can look at the generated pyproject.toml. It is a basis, but you may need to change stuff. I did not want a big file, so I removed a lot of lines. Easiest way that I found to check the result, is to call `pyroma .` You should first remove `setup.cfg` and `setup.py` of course. Well, you can also combine two or three of these files. I think for a package with only `pyproject.toml` you need at least `setuptools` 61. Just thinking out loud: For Plone projects, and perhaps also zest.releaser, it may be best to: - Translate imperative setup.py to declarative setup.cfg. So keep using setuptools for now. - Add a pyproject.toml and specify setuptools as the build system: ``` [build-system] requires = ["setuptools>=61", "wheel"] build-backend = "setuptools.build_meta" ``` Maybe without minimum version.
Python 3.6 tests fail with: ERROR: No matching distribution found for setuptools>=61 And we do seem to need that in this new test with pyproject.toml only. Python 3.6 is out of support of the Python community anyway. See https://github.com/zestsoftware/zest.releaser/actions/runs/4127226730/jobs/7130170595
In setup.py this used compatibility code for Python 2, and encoding fallbacks, which are ugly, pyproject.toml cannot handle multiple files, as far as I can see. setup.cfg happily does this.
Okay, so I added a test, and it works fine. The message from the commit may be interesting: 1bd1315. Problem: the test does not work on Python 3.6, so I dropped support for that. We will want to make a major release for this. I think the current PR is fine to merge: it enables updating the version when it is in |
I agree. I'll merge it. |
pyproject.toml
and moved most metadata there. "Eat your own dog food." I am not sure if we can get rid of the remaining parts ofsetup.py
.tomli
to the dependencies on Pythons earlier than 3.11. Chances are that you already have this via a different dependency. On 3.11 I use the built-intomllib
.setup.py
or other files.bin/prerelease
updates the version in our ownpyproject.toml
. I did not commit this.This fixes issue #373.