-
Notifications
You must be signed in to change notification settings - Fork 201
Proposal: Modernizing Python Dependency Management with uv and pyproject.toml #3791
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
base: main
Are you sure you want to change the base?
Conversation
|
Not a main developer, but Rust does not have CVE tracking or a standards process. Can live with uv if main developers choose to merge this, but hatch or PDM would be much preferred in my opinion. |
|
Using pyproject.toml is good though. |
|
This is because Hatchling is a modern, standards-compliant, and minimal build backend maintained under the PyPA (Python Packaging Authority) umbrella, which aligns well with uv's goals of speed and efficiency.
It's hard to be truly persuasive. The best approach is for people to try it out for at least a month to see if it works for them. |
|
The problem with the long Rust dependency toolchain: Am expecting a stream of incidents such as xz utils is required before Rust developers see the light. |
|
I understand the concern about dependency chains, especially in light of recent incidents like |
|
My 2c: Having a pyproject.toml is great because it's a common standard that several tools can use. If we have concerns about |
|
Thanks so much for taking the time to look into improving Regarding some of the recent discussions, it's important to clarify that CVEs identify vulnerabilities in concrete software implementations, rather than in the programming languages in which they're written. Similarly, package managers like As far as I understand, it doesn't matter which tool you use to create your virtual environment (be it Once the virtual environment is built, you generally don't need the package manager (like You're right, environment setup isn't always the only bottleneck. However, |
|
The problem is that rust packages use specific commits of dependencies. These need not be updated. NPM from javascript does the same, though at least has vulnerability tracking. |
|
For a study in the Android ecosystem see https://media.ccc.de/v/38c3-ultrawide-archaeology-on-android-native-libraries |
|
Thank you so much for this valuable information and for sharing the insightful video – it was indeed very educational! You've highlighted a crucial point regarding dependency management, particularly the use of specific commits. You're absolutely right that in Rust's We actually employ a very similar practice in As you rightly pointed out, when a dependency is pinned to an exact commit, it means that even if a new version of that dependency is released (perhaps with a security fix), your project won't automatically pick it up. You would indeed need to manually update the commit hash in your configuration (whether However, this isn't a challenge exclusive to Your insights are invaluable as we strive to make InkStitch's build process as robust and secure as possible. Thank you again for sparking this important discussion! |
|
We have been trying to reduce dependencies in Ink/stitch. Inkex is developed as part of Inkscape. Some of the newer unreleased features are used in Ink/stitch. The hope is to encourage Inkscape to do minor releases of Inkex between major releases of Inkscape as projects dependent on it often are incompatible with most recent release. In the process of making inkstitch-pyembroidery available on pypi. Colormath2 was forked from colormath as it was not receiving updates and besides its use in Ink/stitch may also find use elsewhere. |
|
That's an excellent summary of our current situation with dependencies, and you've highlighted some key challenges. Indeed, InkStitch's dependency choices are often pragmatic, dictated by the upstream development and release cycles of critical components like Another significant challenge arises with certain packages that depend not just on the operating system but also on the specific OS version, such as The difficulty here is that |
bin/build-distribution-archives
Outdated
| # TODO: use REF_NAME instead of GITHUB_REF | ||
| VERSION="${VERSION:-$(echo ${GITHUB_REF} | sed -e 's|refs/heads/||' -e 's|refs/tags/||' -e 's|/|-|g')}" | ||
| OS="${BUILD:-$(uname)}" | ||
| # if VERSION is not set, use the current branch name (what if detached HEAD?) |
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.
Maybe we could use the commit hash in that case?
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.
Why not? I'll try it.
What OS do you run Ink/Stitch on? It would be nice to have it correctly packaged for Ubuntu. Am doing this for Fedora, so much of the effort can be reused once inkstitch-pyembroidery is available on PyPI. At the moment, many system libraries are distributed with official GNU/Linux releases and expect not everyone will want to use a development installation. There is still the question of what operating systems and operating system versions to support, but this depends on community interest - it is nice that releases are made for Linux, Mac and Windows, but it maybe helpful to know what people are willing to test on as developers can only do so much for operating systems they do not use or use regularly. |
Currently, I'm primarily on Linux Mint Xfce (based on Ubuntu 22.04), with other OS testing done in VirtualBox. I've spent some time with This creates a challenge for dependency management:
My initial thought was to generate One potential workaround is to remove |
Helped create build for 32 Bit Linux Mint Debian edition, so can create an unofficial deb package. Am not a Debian/Ubuntu packager though. Would you consider becoming one?
One can query the operating system and install appropriate packaged library versions. Package managers provide a better user experience though for someone that is not a developer. |
That's a very kind offer, and I truly appreciate you asking! |
bfa5635 to
b9061a3
Compare
|
It seems the |
|
Signing on windows needs manual approval and also we do have a limit. That's why we only sign (beta) releases. On macOS we sign everything, but only notarize on demand or for releases. |
|
Thank you for the explanation. I am entirely unfamiliar with these signing and notarization mechanisms on Windows and macOS, as I have not previously encountered such processes. To summarize the signing processes:
Notes for discussion/reconsideration:
|
ef14230 to
4bd2a14
Compare
|
Just checking in: are there any other aspects that still need to be verified or tested? My aim is to avoid introducing too many new features at this stage, so we can keep close to our existing workflows. |
f21e6ef to
ad5a2ed
Compare
|
I think this needs more work on the documentation. As mentioned above, I'd like to not have a draft file describing the changes, but rather have straight forward guides on how things are done. I guess this is still work in progress, considering the empty PYPROJECT_UV_BUILD file. So I might be a little bit fast with this comment. |
|
You're right. I'm sorry about that! I renamed the original file to |
|
Thanks :) ... Although I still think that we need to improve the documentation here ... I find the pyproject draft file very confusing. I'd really like the description to focus on how things are done and less on what has changed - which won't be interesting after this branch got merged. To have to read through it when you just search for a guide could be a bit annoying as the last headlines become important again (release, release testing). So this makes it harder to find the bits that are relevant for future developers. Also I think this file could use an other name - or even needs to be split up. Still it makes sense to document the changes somewhere. Maybe in this thread. |
|
Thank you so much for the feedback! It’s incredibly helpful, and I completely agree with your points. The Your fresh perspective is exactly what I need. I'm so deep in this that many things seem obvious to me, so a collaborative approach would be most effective. My plan is to first build out a clear guide for developer users based on your feedback. After that's finalized, a separate guide for github action users on creating a release would be next. Ultimately, I will copy the final contents of |
|
What are the files in |
|
Would there be a possibility of considering meson-python instead of uv? The dependencies are on PyPI, so publishing to PyPI when there is a release would be helpful. Some extensions which
PyInstaller builds could the be done weekly and when there is a release rather than on every pull request. |
You can easily install uv pip install meson-pythonand there shouldn't be any conflicts, as |
The files in the bin/msys2 directory are included to simplify the installation process on Windows. They are generic tools (specifically from the MSYS2 environment) that provide a necessary Unix-like build environment for compiling and running native components. I include them so the user doesn't have to manually locate or configure them, as Windows installation is often less straightforward than on Linux or macOS. |
We have a number of non techy users who enjoy to test new features or specific bug fixes. We definitely don't want to exclude them from the testing area. Therefore I think it is actually great to be able to link to a specific branch release and ask for testing and I definitely don't want to lose this possibility. |
Ok. |
Proposal: Modernizing Python Dependency Management with
uvandpyproject.tomlThis pull request introduces a significant enhancement to our Python dependency management, marking a pivotal step towards faster, more reliable, and fully reproducible builds for InkStitch.
What if we were to transition to
uvand formalize our dependency definitions withinpyproject.toml? This initiative holds the promise of leveraginguv's unparalleled speed and robust capabilities, leading to significant improvements in our development and CI/CD workflows.The detailed rationale, implementation specifics, and a comprehensive overview of the architectural changes are meticulously documented within PYPROJECT_DRAFT.md.
Example of cached build: see action
Important Note: The build artifacts generated by these workflows have not yet undergone comprehensive testing. Please perform thorough verification of any generated files.
Your review and insightful feedback on this foundational upgrade are highly valued.