Just published an article to understand Python Project Management and Packaging, illustrated with uv
Posted by ReinforcedKnowledge@reddit | Python | View on Reddit | 41 comments
Hey everyone,
I’ve just finished writing the first part of my comprehensive guide on Python project management and packaging. Now that I think about it, I think it's more an article to understand the many concepts of Python packaging and project management more than a guide in and of itself.
The article: A Comprehensive Guide to Python Project Management and Packaging: Concepts Illustrated with uv – Part I
In this first part, I focused on:
- The evolution of Python packaging standards through key PEPs.
- Detailed explanations of the main concepts like `pyproject.toml`, the packaging nomenclature, the dependency groups, locking and syncing etc.
- An introduction to `uv` and how it illustrates essential packaging concepts.
- Practical workflows using `uv` that I use with data science projects.
Mainly what it lacks is a deeper section or paragraph on workspaces, scripts, building and publishing. That's for part 2!
Working on this article was mainly journey for me through the various PEPs that have shaped the current Python packaging standards. I delved into the history and rationale behind these PEPs. I just wanted to understand. I wanted to understand all the discussions around packaging. That's something we deal with daily, so I wanted to deeply understand every concept that's related to Python projects or packages. The PEPs, and my own experience, helped me understand why certain changes were necessary and how they effectively resolved previous issues. It was enlightening to see how the thoughtful decision-making and the understanding of developers' needs. And I gained a deeper appreciation for how PEPs are organized and how they think external stuff like the existing tools and how they leave room for future improvement and standardization and for tools to innovate.
It was a pleasure both writing and reading through the material. I don’t expect everyone to read it in its entirety since it’s quite lengthy, and I’m sure my writing style has room for improvement. However, I believe you can easily pick up valuable bits of information from it. For those who are really interested, I highly recommend diving into the PEPs directly to get the most accurate and detailed insights!
ArchFFY00@reddit
While reading your article, I was confused around your discussion of "editable dependencies".
That essentially just refers to a dependency that has been installed in an "editable" mode. It is not really a thing on its own, and doesn't need to be unless you are talking about tooling that provisions environments.
In your article you do go into environment provisioning, mentioning lockfiles, etc. but you bring these concepts back to areas where they do belong. For example, you mention that there is no standardization for specifying "editable dependencies", hinting that is a missing feature, but that would belong in something like a lockfile format, which is something that isn't standardized.
Within all standardized formats, there's no feature disparity when it comes to "editable dependencies". You are able to specify project/group dependencies, and you are able to install projects in an "editable" mode.
ReinforcedKnowledge@reddit (OP)
Oh no no no please I'm extremely grateful and happy to receive comments and feedback. And you have well put it out together it's not destructive in any way.
You're completely right about "editable dependencies". And I will definitely correct that.
What do you think would be a good format for an article? I would like to write my future articles in a way that all readers can read easily.
And just in case you wanted the context of how I came to put "editable dependencies", I initially started the blog as a way for me to structure my thoughts and retain information. That's why the language is so informal if you have noticed, I write like if I'm talking to myself or to a friend. So naturally when I write and think about if something can be helpful, I think first of my friends, and many of them have basic needs when it comes to Python packaging and didn't even know about editable dependencies. So for me it was more like "I'll include that here so people know that it's possible to install dependencies in an editable mode".
ArchFFY00@reddit
Btw, if you are on twitter: https://x.com/charliermarsh/status/1859376619980534220?s=19 😊
ReinforcedKnowledge@reddit (OP)
Thanks a lot!!! I wouldn't have known about it without you.
I just reinstalled it after using it for 2-3 days when I wanted to ask a researcher some questions, I'm not really into / on social media so 😅
Thanks again!
SignificanceEarly625@reddit
Good job ma boy, Keegan going, it's só amazing and incredible... I appreciate it
ReinforcedKnowledge@reddit (OP)
Thanks! That's very encouraging!
iliasreddit@reddit
Very nice articles! Would be nice to remove the typos and restructure here and there for more readability. Would also be nice to have more of these, perhaps a bit more contained, on specific subparts (e.g. editable dependencies in depth)
ReinforcedKnowledge@reddit (OP)
Thank you for the comment!
I totally agree, there might be many typos and this article definitely needs restructuring for a better read. Also smaller articles would be better as pointed out by user u/ArchFY00 it'd help many readers that are not comfortable with huge dense walls of text.
It'd also be more manageable to read smaller articles when on the commute or something else for example than having this lengthy article where you have to remember where you stopped and where it's a hassle to get back to where you stopped.
I'll try dividing it into many smaller self-contained and target articles, with typos removed and better structure in each sub-article 😁
If you wanted a bit more context on why it is how it is today. Initially, when I wrote the article, also when I started the blog, I did it for myself. I've been reading a lot of documentation, papers, articles, books etc., for almost three years now, and I have noticed that I lost a huge amount of the knowledge that I acquired when reading that material. So I thought of writing as I'd read and explore topics I'm interested in in-depth. There is also this idea of "rubber ducky debugging" in the programming world that inspired me to write articles as if I'm explaining the concepts to myself or to myself. The combination of these two things were the why I wrote these lengthy articles for myself. And since I wrote it, I thought I might as well share that in case it can help one or two people in particular areas (that's why I made that table of topics in case people wanted to skip directly).
But I'll definitely take all of this feedback both for this article and remaking it and for the second part of the article! 😁
jmreagle@reddit
On Safari on an iPad, the main body of prose is light gray text on a white background. Unreadable.
aqjo@reddit
Same with Firefox.
ReinforcedKnowledge@reddit (OP)
Sorry to spam you, can you please tell me if by any chance you have a forced light mode activated in the flags of your browser or something? Or if you don't mind giving me more information so maybe I can dig deeper and try fixing that?
I have tried with a friend's iPad (activated light mode, activate dark mode, auto) on both Safari, Firefox and Brave and I can't replicate this.
aqjo@reddit
I just checked my setting, and I don’t see anything in Safari or Firefox that should do this. My iPad is set to dark mode, and there aren’t any setting like that in either browser.
I did discover that I can turn in Reader Mode in Safari and see light text on a dark background, so it is legible in reader mode.
ReinforcedKnowledge@reddit (OP)
Thanks for the information! I configured some settings on my Wordpress, I hope it fixes this issue. I don't want to bother you more than this, but don't hesitate to tell me if it's not fixed, I'll have to ask on a Wordpress subreddit in that case \^\^'.
aqjo@reddit
Just checked on my phone, looks good in Safari and Firefox!
Desktop here in Firefox on Linux looks good too.
ReinforcedKnowledge@reddit (OP)
I configured some settings I think now it's good on an iPad as well 🤔
u/jmreagle (comments in the same reply thread here) had the same issue as you apparently and confirmed that it's fixed. There might be differences though depending on the OS version etc.
aqjo@reddit
Yep. Looks good on my iPad.
Thanks for sharing this.,
ReinforcedKnowledge@reddit (OP)
I should thank you for reporting the issue and reading!
ReinforcedKnowledge@reddit (OP)
I'll try and fix that, sorry!
ReinforcedKnowledge@reddit (OP)
Sorry to spam you, can you please tell me if by any chance you have a forced light mode activated in the flags of your browser or something? Or if you don't mind giving me more information so maybe I can dig deeper and try fixing that?
I have tried with a friend's iPad (activated light mode, activate dark mode, auto) on both Safari, Firefox and Brave and I can't replicate this.
jmreagle@reddit
Hi, here's a link to what your website looks like on my iPad M2 Air in Safari/Chrome/Brave. I haven't set special flags in the browser. I toggle the iPad night/day mode and that had no effect.
ReinforcedKnowledge@reddit (OP)
Thanks a lot! That's way more than what I could have asked for. I configured some settings on my Wordpress, I hope it fixes this issue. I don't want to bother you more than this, but don't hesitate to tell me if it's not fixed, I'll have to ask on a Wordpress subreddit in that case haha.
jmreagle@reddit
That fixed it. :)
ReinforcedKnowledge@reddit (OP)
Oh that's amazing!!! Thanks a lot for your time!
ReinforcedKnowledge@reddit (OP)
Oh I didn't know about that sorry. I'm quite a noob when it comes to blogging. I started it just as a mean for me to retain information because my memory is aweful and to structure my thoughts because writing inspires deeper questions.
I'll try and fix that! :D
sirfz@reddit
I only recently started using rye but I see uv seems to have caught up with (almost?) all rye features already. Do you have an idea what is/might still be missing?
ReinforcedKnowledge@reddit (OP)
Thank you for the comment!
That's a tough one for me, I have never used `rye` extensively to go beyond the basic features which `uv` has caught up on as you say.
But I think `uv` is supposed to be the successor to `rye`. `rye` will continue being maintained for a while I think (I don't know for how long though) but you can read more (I think you already know the links but I just mention them for the sake of completeness) about that here https://lucumr.pocoo.org/2024/8/21/harvest-season/ and here https://github.com/astral-sh/rye/discussions/1342
If I were you I'd continue with `rye` and decide to switch (or not) to `uv` when it gets its next major release.
Most of these tools build upon similar concepts and ideas and the team at `uv` is making great effort at trying to be easily acomodate users coming from other tools.
And again sorry for not being able to give a real answer to your question \^\^'
sirfz@reddit
Yes that's my understanding as well, I'm planning to try out uv just for the dependency groups support recently introduced which might address one of the problems I currently have with rye.
the_slow_flash@reddit
Really looking forward to reading your article after work! Will forward it to my colleagues that are less familiar with packaging :)
ReinforcedKnowledge@reddit (OP)
Thank you for your comment! Don't hesitate if you have any comment / feedback (even from your colleagues).
And obviously don't hesitate if you have any questions I'd be happy to answer them directly!
PaleontologistBig657@reddit
Just what I wanted to read! Many thanks!
ReinforcedKnowledge@reddit (OP)
Thank you sir!
guaranteed-seed@reddit
UV for the win
ReinforcedKnowledge@reddit (OP)
Yeah I really like it, there are some quirks like the interface between optional and group dependencies can be a little bit confusing for newcomers. I have a lot of friends in the machine learning world that still rely a lot on `requirements.txt` or `env.yaml` and `uv` for the moment doesn't support well these use cases. But it's just going to get better and better. I think just yesterday they released support for `.env` and improved error on upgrades etc. The response time on Github is incredible as well.
Additional-Ordinary2@reddit
Thnx!
ReinforcedKnowledge@reddit (OP)
I should say thank you hahaha
-defron-@reddit
I'm still reading through it (interested in seeing a uv workflow more in detail, I primarily use PDM) but I'm a bit perplexed by the inclusion of
tox
next topoetry
andpdm
. tox does have virtual environment management capabilities but it's more about testing than project management. It feels off being put there. I'd replace it with hatch or pipenv would make more senseReinforcedKnowledge@reddit (OP)
Thank you for the comment. I'll change that. To be honest I didn't give it much thought at the beginning. I didn't think people would read my article so sometimes I took some weird decisions like I'd just think about different tools that I use and mention them even if they don't have the same responsibilities.
iwangbowen@reddit
Looking forward to Part 2
ReinforcedKnowledge@reddit (OP)
Thank you, that's encouraging!
innovatekit@reddit
Great job!
ReinforcedKnowledge@reddit (OP)
Thank you!