-
Notifications
You must be signed in to change notification settings - Fork 74
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
refactor: attempt to modernise build #294
refactor: attempt to modernise build #294
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.
Perfect! Just one question about the build frontend and we're good to merge
also please rebase to get changes from #293
Also please suggest how to obtain current version, that's what the build error is:
I'm happy to fix that and push to your branch if you don't want to mess with RPM packaging 😁 |
That would be great! I’m off on holiday for a few days, so I won’t be able to do much until I get back. |
First attempt at fixing issue #290.
@grawlinson LGTM from my side, enjoy your vacation! once you're back, let me know if you'd like to do more changes here |
pyproject.toml
Outdated
# setuptools: https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html | ||
# setuptools-scm: https://github.com/pypa/setuptools_scm/#pyprojecttoml-usage | ||
[build-system] | ||
requires = ["setuptools>=61", "setuptools-scm[toml]>=6.2", "wheel"] |
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.
I just tested this PR locally in a fedora:36 container and it worked fine with python3-setuptools-59.6.0-3.fc36.noarch
so I'm thinking that maybe we don't need to pin the version of setuptools
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.
fascinating, even works with a very old setuptools - python3-setuptools-53.0.0-12.el9.noarch
I suspect it's because build
creates a venv and installs new setuptools inside: sadly the output doesn't say which versions
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.
Yes, build creates its own env but you can pass a CLI option to prevent it from managing the env.
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.
Note that ancient setuptools wouldn't know how to read pyproject.toml
.
.packit.yaml
Outdated
get-current-version: | ||
- "python3 setup.py --version" | ||
- "python3 -m setuptools_scm" |
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.
This may need piping through awk
because it may output extra text.
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.
yes, that's possible and it already happened: the build fails then and needs investigation
pyproject.toml
Outdated
# setuptools: https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html | ||
# setuptools-scm: https://github.com/pypa/setuptools_scm/#pyprojecttoml-usage | ||
[build-system] | ||
requires = ["setuptools>=61", "setuptools-scm[toml]>=6.2", "wheel"] |
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.
Note that wheel is not needed here. Setuptools adds it for wheel builds automatically.
requires = ["setuptools>=61", "setuptools-scm[toml]>=6.2", "wheel"] | |
requires = ["setuptools>=61", "setuptools-scm[toml]>=6.2"] |
pyproject.toml
Outdated
# setuptools: https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html | ||
# setuptools-scm: https://github.com/pypa/setuptools_scm/#pyprojecttoml-usage | ||
[build-system] | ||
requires = ["setuptools>=61", "setuptools-scm[toml]>=6.2", "wheel"] |
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.
Yes, build creates its own env but you can pass a CLI option to prevent it from managing the env.
pyproject.toml
Outdated
# setuptools: https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html | ||
# setuptools-scm: https://github.com/pypa/setuptools_scm/#pyprojecttoml-usage | ||
[build-system] | ||
requires = ["setuptools>=61", "setuptools-scm[toml]>=6.2", "wheel"] |
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.
Note that ancient setuptools wouldn't know how to read pyproject.toml
.
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.
Oh, I forgot another important bit: for setuptools-scm to work properly with downloads from GitHub, you must update .git_archival.txt
. See their readme for details, it's pretty straightforward.
* use setuptools_scm directly to get version * use python3-build to create dists Signed-off-by: Tomas Tomecek <[email protected]>
just checked and we already have that set up :) |
@TomasTomecek the file exists but the contents are outdated — there's a newer "match" bit still missing. |
@webknjaz you're correct. I just checked what the option does exactly - luckily it's easy to play with: The usual tags we have here:
Let's do an "ugly" tag:
So the I don't think we need that option but agreed it could prevent odd behaviour in the future. Let's apply it if no one objects. |
Those updates will only work with modern Git, they'll allow installing from non-tagged commits and getting proper intermediate versions. |
new recomentation from setuptools_scm thanks @webknjaz Signed-off-by: Tomas Tomecek <[email protected]>
@webknjaz says setuptools adds it automatically Signed-off-by: Tomas Tomecek <[email protected]>
Signed-off-by: Tomas Tomecek <[email protected]>
I implemented the last bits of feedback. Let's merge after all's green. |
the failing test is a network DNS flake, merging |
This breaks compatibility with EL 9 and Fedora 36. |
I'd recommend implementing this in the same way we did for |
I'm not concerned about EL9 since there are no EPEL9 builds: https://src.fedoraproject.org/rpms/ansible-bender Folks installing from PyPI can upgrade their setuptools. Similarly F36, gonna be EOL within 2 months. It will take a long time before this gets released given my velocity of a sloth. Nevertheless, I'm okay changing the python packaging as long as it works. |
I've submitted #296. @webknjaz and @grawlinson, feel free to take a look as well :). |
First attempt at fixing issue #290.