3 ms·
I solve this whole issue by using pyenv + direnv. I can have a project specific .python-version file and upgrade to a newer python version when necessary. Then
by DataDaoDe 7y ago
I solve this whole issue by using pyenv + direnv. I can have a project specific .python-version file and upgrade to a newer python version when necessary. Then I just run python -m venv env once on project creation and have direnv source env/bin/activate and can use pip as usual
The articles arguments against this and for always using python -m pip don't convince me, personally. I never work on windows, so that's a mute point, and b/c I use direnv to automatically activate my env when cd'ing into the directory, I'm never not in the project environment. So basically, its impossible to not be using the correct pip version i.e. I have never once had this problem and I am constantly working on multiple python projects + code bases in various envs and versions.
- josteink 7y agoYou just do around twenty medium involved things manually because they’re not done for you by anyone else or any tool. And then python “just works”. Does your text editor know that? Your colleague? How about your CI-system? What about the deployment story? When are things “unexpectedly” going to break because not everyone knew all these informally applied requirements? Admit it: python is worst in class here. Almost no other popular language or platform forces it’s users into taking these absurd, error-prone steps, just to have basic shit “just working”. Take a look at Node: npm may be a mess for other reasons, but boooy do you have clean per project dependencies. Look at Cargo for something even better. Clojure has Lein. The new dotnet CLI is slick too. At this Python just plain sucks. It’s about time you guys start at least admitting it, or else it will never be fixed.
- DataDaoDe 7y agoYou can have your opinion, but to answer some of your questions, I use vscode and it works amazingly with python, so yes it does know what environment and python version you are using and can show source code, do type checking (if you use the "typing" module, and tons of other nice things that just work out of the box). As far as the CI-system knowing, there is not much difference in installing a particular version of rust/cargo say in a docker container and having a particular version of python installed in a container, so I don't really know what you are getting at. Could it be better? Sure, I do some programming in rust and IMHO the best build tool I've ever used is cargo. But compared to some of the other stuff you mentioned which I've used on projects as well (npm, lein specifically) I would say python is on the same level, and I prefer python over them but that's probably just my bad experience with package-lock/caching and long jvm load times speaking.
- fimbulvetr 7y agoYou're getting downvoted but I wanted to let you know that I emphatically agree with you, but we might be the only two. Whenever a discussion of this comes up, it seems there are always some "just use xyz" patterns, and usually 3 or 4 xyz or some very new thing someone just released and it always seems contradicts python official documentation. For every python packing question, there are 33 answers. I guess the irony is that there is more than one way to do it. Use poetry, use prose, use pip, use venv, use vidtualenv, use conda, use --user, pipenv, pipfile, pipy,pipx,anaconda,miniconda. It really is terrible. Npm gets a lot of flack for having vulnerable packages but do you see how many python fanatics push pip freeze? It allows them to ignore security vulnerabilities. I'm scared of upgrading any dependencies in my python projects because any update is virtually guaranteed to break. I can upgrade npm all day long and rarely encounter an issue. The ecosystem is so radically different.
- roel_v 7y agoThe next time someone tells me 'python is a great language for beginning programmers', I'm going to point them to this comment...
- twunde 7y agoThe language is great for beginners. The ecosystem and especially the tooling lags behind the rest of the mainstream dynamic languages and it shows.
- yjftsjthsd-h 7y agoI would not expect the beginning programmer to hit this particular problem.
- coldtea 7y agoBecause beginner programmers need to know all this?