Use only the python.org installer on Windows and Mac, or official repositories on Linux.
Speaking from the MacOS perspective:
Completely deleting such a Python installation involves additional steps to kill the framework and symbolic links
Upgrading minor versions becomes manual, and it's quite tedious if one has multiple Python versions. Eventually, one ends up with outdated ones
One has to set the PATH to each of the interpreters (well, once yet adds routine)
To install things, use pip, and only pip
This is no better than «don't use Python or C, use only bare Assembler»:
Upgrading frozen dependencies becomes a manual task, and people don't like tedious tasks, so some of the deps will stay outdated
requirements.txt usually only contains direct dependencies. Without freezing 2nd-order deps with something like pip-tools or poetry one of those deps of deps will eventually screw up your day when bumped implicitly to a buggy/broken version
So you have two choices. Don't use "-m", and suffer a lot. Use "-m", and suffer a little.
After 10 years, I've freaking no idea what «suffer a lot» they're talking about. With -m one will certainly suffer a little more
Limit yourself to the basics: “pip” and “venv”
I'm not sure here but if they're against make either, then this adds a huge amount of pain by not automating things
the article didn’t say anything about requirements.txt, did it?
Also, not sure why you have a path for each python, it dumps a versioned executable in bin quite reliably.
This article is exactly what I do, and everyone at my job on a team where we need to develop for multiple versions of python - though a few do use asdf for getting diff versions of python, but that’s fine.
Re: make, I don’t think anyone really opposes make - it’s been used to add steps/run targets to packaging forever, and it can just use pip.
I don’t get the hate for -m either, though I will say re:commands/his final step some of his -m examples ignore packages that have a console_scripts option but don’t expose a main - for which I prefer running directly from the bin, I never activate venvs, just run the python executable in them.
I’m also not sure why the whole -m thing or fun paths scares people. Been doing linux professionally for 12 years, using it for longer, and releasing the fear of scary commands and embracing tapping tab with your pinky to speed up typing long paths is key.
I also don’t really care if people prefer other ways as long as at work they’re not becoming unicorns, I’m a big believer in team uniformity, even if the team chooses a system that isn’t my fave.
the article didn’t say anything about requirements.txt, did it?
It did say though about using only pip, I'm not sure not using requirements.txt, setup.py, or pyproject.toml to list dependencies makes any sense – they still usually contain only direct dependencies (unless pip-tools or some sort of make requirements.txt is used)
Also, not sure why you have a path for each python, it dumps a versioned executable in bin quite reliably.
Not on MacOS, there it's a protected directory. On MacOS one has to add all /Library/Frameworks/Python.framework/Versions/3.*/bin to the path
I will say re:commands/his final step some of his -m examples ignore packages that have a console_scripts option but don’t expose a main - for which
Good point, by the way
I also don’t really care if people prefer other ways as long as at work they’re not becoming unicorns, I’m a big believer in team uniformity, even if the team chooses a system that isn’t my fave.
Yeah, fine by me! The OP's article sounds just so… assertive that I couldn't ignore it
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.
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
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).
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»
0
u/eigenein Mar 28 '23
Some of them actually make the pain even worse, not relieved