r/Python • • Mar 28 '23

Tutorial Relieving your Python packaging pain

https://bitecode.substack.com/p/relieving-your-python-packaging-pain
1 Upvotes

36 comments sorted by

View all comments

Show parent comments

-1

u/someotherstufforhmm Mar 28 '23

Oh, so you don’t understand pip - according to your first statement anyways.

Requirements.txt is more of a statefile, vs setup.cfg/pp.toml which is a min-to-install type, they both have different purposes.

I agree most people shouldn’t be using requirements.txt. It’s valuable for reproducible deploys, but really shouldn’t be done in isolation and definitely shouldn’t be used locally. We use it at work to preserve a deploys state.

A deploy involves generating requirements.txt, along with hashes for each dependency, from setup.cfg/pp.toml. We also have weekly dependabot stuff checking the cfg/toml.

All that would be way too much for a local package, for local dev we simply use setup.cfg/pp.toml and only list the min things we need - as intended. It makes local dev simple, but also means for any deploy we can reproduce exactly what happened if it needs re-pushing or recreation, meaning lower non-dev teams can use that requirements.txt sitting on the server to “reset” a server (statefil).

As for the rest of your stuff, I use macOS and each version creates a pythonX.Y file in the same bin directory.

My flow is to create a venv by writing python3.9 -m venv folder/blah, then run things from then on via folder/blah/python or folder/blah/python -m pip.

It doesn’t take me that much time, nor does it take newbies who ask how I work (happens at work a lot, I mentor a few people) that much time once I teach them to tap tab, and there is never any confusion about which venv is running what.

It’s an excellent method that also supports linux CLI skill building, as that’s not involved at all lol. We deploy on hundreds of linux hosts minimum for each app, so I expect them to be able to do that at speed seeing as they’ll also be expected to fluently hop around and search logs, involving way longer paths.

Like I said the only thing I disagree with in his post is the way he puts the -m thing. I do support using -m for pip as it means if someone is activating their venvs and using the PATHd python/pip it guarantees the pip is the correct one in case people did some path wonkiness- which they shouldn’t have, but as the guy who helps newbies, they sure do love putting weird shit that shouldn’t be in their path in their path and not checking it ever, so meh.

1

u/eigenein Mar 28 '23

Oh, so you don’t understand pip - according to your first statement anyways.

That's pretty aggressive, you know? We're discussing the specific article, and re-writing «use only pip» section the right way never was my goal (and also my remark regarding pip-tools and make requirements.txt should've hinted at that, but who reads further anyway?). Hence, the rest is nothing new to me, despite the speedy conclusion about my understanding

As for the rest of your stuff, I use macOS and each version creates a pythonX.Y file in the same bin directory.

Okay, you got me here. In the past, I had to modify the PATH – for whatever reason, never mind. Still upgrading via the installers and cleaning up the frameworks and symbolic links hurts way more without Homebrew

0

u/someotherstufforhmm Mar 28 '23

aggressive

It was just the way you said requirements.txt is an automatic use, when most pip users consider it antiquated and recommend against it, it’s far from automatic. My take on using it as a state file is very rare. same with your comments on setup.cfg, they just tell me you don’t actually know much about pip

It’s not aggressive, just commenting. I don’t assign value. I don’t use poetry or like it, but tons of people here do, I don’t really care what people use as long as they learn it - you’ve openly said you don’t prefer vanilla pip, which is fine so I wouldn’t expect you to know it.

I’m not sure why you’re annoyed or sensitive, you said a few outright incorrect things I was correcting, what part of me saying ah you don’t know pip is aggressive or insulting?

Seeing as the context was you criticizing an article which - albeit relatively reductive and I took some issue with - actually stands out in the sea of things bashing pip without actually getting it, I stand by what I wrote. I don’t get mad when someone points out I don’t know much about poetry - I openly stay vanilla piptools based on exacting work standards supported by industry experts (our python team is semi incredible and spends a lot of time on standardizing packaging / approach).

0

u/eigenein Mar 28 '23

I’m not sure why you’re annoyed or sensitive, you said a few outright incorrect things I was correcting, what part of me saying ah you don’t know pip is aggressive or insulting?

Got judged too fast based on too few things said by me – that's why

Anyway, of course, one can use the vanilla pip (that is, without mere pip-tools) but I don't like the assertive tone of the article – no, it wouldn't relieve the pain – it'd make it worse – unless there's already an existing way of working in the team/department or for personal projects. I could start pretty quickly with either vanilla pip, or Poetry, or whatever – because I've been there, but there should be some assumptions made regarding that before saying «do not use X to relieve the pain»

→ More replies (0)