-
Notifications
You must be signed in to change notification settings - Fork 277
Update package metadata #1896
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
Update package metadata #1896
Conversation
before you spend more time on implementation details, let's discuss if this is something we want. I mentioned this in the in-toto issue:
You provided a comprehensive comment that explains really well why you are building your project: I am convinced new build tools are a good idea. I'm not convinced there are enough advantages for python-tuf to migrate:
I want to support cool python infrastructure work but I also take build pipeline choices seriously. |
Declarative yes, but not in the standard format, and therefore no support for new standards like licensing.
Since we use it at Datadog for shipping business critical things, our CI would be the first to yell at me if something goes awry 😄 We also were the first to use tuf + in-toto at scale, which I assume has contributed to their current stability.
As mentioned in the comment you linked, I rebased; would you mind triggering the CI with that button below again? |
Pull Request Test Coverage Report for Build 2004983729
💛 - Coveralls |
Thanks for the proposal @ofek. For context: our most recent round of changes to package metadata were to bring it inline with what is recommended in the Python Packaging User Guide, specifically Packaging and distributing projects. That tutorial does suggest considering alternatives, but does not motivate why one should. I appreciate your related remarks here and in the linked in-toto issue comparing alternatives. We did briefly look at flit in the past, but ultimately didn't feel the need to switch away from setuptools yet. One reason to consider alternatives is our desire to have verifiably reproducible build artefacts (#1269). Aside from discussion of switching packaging tool, which I'll defer to more active maintainers on, there are some good unrelated fixes in this PR (tox isolated builds, gitignore fixes, redundant comment about version in tuf/init.py). @ofek would you mind if I pull those out into separate patches and credit you with |
Sure!
Hatchling does that by default https://ofek.dev/hatch/latest/config/build/#reproducible-builds, including everything mentioned in that linked issue like file ordering |
Now this is interesting and a reason to consider this, thanks. |
A quick glance at the source code tells me that includes producing reproducible sdist. Nice! |
I updated the branch.
Yup you can test here by doing:
|
Thanks for your efforts, @ofek! Hatch/hatchling looks really cool and getting reproducible builds for free is quite a compelling argument. I admit that I share the reservations @jku and @joshuagl have expressed, wrt preferring a more "established" tool. But this patch is simple enough to revert (or migrate to another PEP 621 compatible build system) if needed, which makes the bus factor of your project less worrisome. And the integrations you mentioned along with the lightweightness of the hatchling builders, make me confident that issues are detected and probably also fixed swiftly. So I lean towards giving this a try. |
Agreed, potentially reproducible builds is a game changer, something I'm willing to take a bit of risk for. Merging this doesn't get us quite to reproducible builds (doesn't pin the hatch/hatchling version we use for official builds for a start) but getting that right does not need to happen in this PR. |
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.
Looks good overall: left a question and a few specific comments in source.
- Are the readthedocs.yaml changes unrelated?
- If you could rebase (so we don't end up with merge commits in this branch), that would be nice
Actually one more question: since we have the setup.py workaround (for dependabot), how does it even work?
...but we no longer depend on setuptools? Or is it so that we know that nothing in the build/install pipeline ever runs setup.py -- it just needs to exist for dependabot? |
329c65d
to
2297156
Compare
Signed-off-by: Ofek Lev <[email protected]>
2297156
to
98db711
Compare
Addressed and rebased!
Yes because by default it does
Yes it's just for dependabot for now dependabot/dependabot-core#3290 |
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 can't think of anything else to add:
- I suppose we could make the dummy setup.py error out (to make sure no-one is running it by accident)... but that does not have to be in this PR
- thinking the reproducible build aspect through (e.g. do we want to pin the build tools) is important but again not required for this PR
Thanks for pushing the issue here ofek, I'm looking forward to trying out build reproducibility.
Approving. I wouldn't mind if another maintainer wants to have a look at the build results before merging.
Background
Hello there! This was requested in in-toto/in-toto#490 (comment)
The Python packaging ecosystem has standardized on the interface for build backends (PEP 517/PEP 660) and the format for metadata declaration (PEP 621/PEP 631). As a result, the use of
setup.py
files is now heavily discouraged.So, I'm spending my free time updating important projects so that they are modernized and set an example for others 😄
Summary of changes
This implements PEP 621, obviating the need for
setup.cfg
andMANIFEST.in
. Support has not landed insetuptools
, so builds will now usehatchling
. It is quite stable and actively maintained, the only reason the version is 0.x is because 1.0.0 will drop support for Python 2. It's also on the major distribution channels such as conda-forge, Debian, Fedora, etc.I've done this for such projects as pipx, all Datadog Agent integrations, etc.
Notes
setup.py
remains for Dependabot