Live data from Hacker News

My Python Development Environment, 2020 Edition

jacobian.org

51–60 of 241 posts

Re: My Python Development Environment, 2020 Edition

#51
post #37

For those new or unfamiliar with python, I think the best solution is the simplest: pip and virtualenv

Seriously. The author is bending over backwards to accommodate poetry from every direction, from the stupidest installation instructions I've heard, to "can't transfer from requirements.txt" to "it doesn't work well with docker but doable". Like what exactly does it add that's worth all this complexity? Make you a maitai every hour?

Re: My Python Development Environment, 2020 Edition

#52
I would generally reach for conda instead of this, but they seem quite comparable in aggregate.

And, given that I've been trying NixOS lately and had loads of trouble and failing to get Conda to work, I will definitely give this setup a try.

(I haven't quite embraced the nix-shell everything solution. It still has trouble with some things. My current workaround is a Dockerfile and a requirements.txt file, which does work...)

Re: My Python Development Environment, 2020 Edition

#53
post #34
post #31

Does anyone else think this reflects badly on Python? The fact that the author has to use a bunch of different tools to manage Python versions/projects is intimidating. I don't say this out of negativity for the sake of negativity. Earlier today, I was trying to resurrect an old Python project that was using pipenv. "pipenv install" gave me an error about accepting 1 argument, but 3 were provided. Then I switched to…

I've never quite understood the need for pyenv. Just keep a virtualenv with each project that you want to have an isolated environment.

It manages interpreters, not environments. So one environment can use python 3.5, while another can use 3.8.

Re: My Python Development Environment, 2020 Edition

#54
post #31

Does anyone else think this reflects badly on Python? The fact that the author has to use a bunch of different tools to manage Python versions/projects is intimidating. I don't say this out of negativity for the sake of negativity. Earlier today, I was trying to resurrect an old Python project that was using pipenv. "pipenv install" gave me an error about accepting 1 argument, but 3 were provided. Then I switched to…

I think it really comes down to Python not having a chosen way to handle package management as well as Python being dependent on the underlying C libraries and compilers for the given platform.

Since Python did not prescribe a way to handle it the community has invented multiple competing ways to solve the problem, most of which have shortcomings in one way or another.

To further add to the confusion, most Linux and Unix-based operating systems (Linux, MacOS, etc.) have their own system Python which can easily get fouled up if one is not careful.

This is one place where Java's use of a virtual machine REALLY shines. You can build an uberjar of your application and throw it at a JVM and (barring JNI or non-standard database drivers) it just works. There is also usually no "system Java", so there is nothing to break along those lines.

Re: My Python Development Environment, 2020 Edition

#55
post #34
post #31

Does anyone else think this reflects badly on Python? The fact that the author has to use a bunch of different tools to manage Python versions/projects is intimidating. I don't say this out of negativity for the sake of negativity. Earlier today, I was trying to resurrect an old Python project that was using pipenv. "pipenv install" gave me an error about accepting 1 argument, but 3 were provided. Then I switched to…

I've never quite understood the need for pyenv. Just keep a virtualenv with each project that you want to have an isolated environment.

I suspect, but could be wrong, that the disconnect here is bc devs who are making open source packages need to make sure it runs on multiple different versions of Python.

If you're working on closed-source code or have tight control of your environment, it's enough to develop and run on a single version, rendering pyenv and whatnot unnecessary.

Re: My Python Development Environment, 2020 Edition

#56
post #13

Curious to hear other's experiences with pipenv vs poetry. Has anyone made the switch?

Pipenv has been nearly completely broken for a year without a release. Installing from scratch rarely works without providing a full path to the python you want to reference.

Now that poetry also manages virtual environments it’s far and away the better choice.

Caveat - Heroku doesn’t understand pyproject files yet, so no native poetry integration. Heroku are working on this.

Re: My Python Development Environment, 2020 Edition

#57
post #31

Does anyone else think this reflects badly on Python? The fact that the author has to use a bunch of different tools to manage Python versions/projects is intimidating. I don't say this out of negativity for the sake of negativity. Earlier today, I was trying to resurrect an old Python project that was using pipenv. "pipenv install" gave me an error about accepting 1 argument, but 3 were provided. Then I switched to…

It's admittedly bad, any Python dev who says otherwise isn't being honest.

That said, once you get it down, you're not burdened by it much/at all. You can start and begin work on a new project in seconds, which feels important for a language that prides itself on ease of use.

But yeah, not a great look for newcomers.

Re: My Python Development Environment, 2020 Edition

#58
post #37

For those new or unfamiliar with python, I think the best solution is the simplest: pip and virtualenv

Seriously. The author is bending over backwards to accommodate poetry from every direction, from the stupidest installation instructions I've heard, to "can't transfer from requirements.txt" to "it doesn't work well with docker but doable". Like what exactly does it add that's worth all this complexity? Make you a maitai every hour?

Did you even read the article?

Re: My Python Development Environment, 2020 Edition

#59
post #31

Does anyone else think this reflects badly on Python? The fact that the author has to use a bunch of different tools to manage Python versions/projects is intimidating. I don't say this out of negativity for the sake of negativity. Earlier today, I was trying to resurrect an old Python project that was using pipenv. "pipenv install" gave me an error about accepting 1 argument, but 3 were provided. Then I switched to…

Since you are familiar with nodejs:

poetry == npm

pyenv == nvm

pipx == npx

No big difference, IMO.

Re: My Python Development Environment, 2020 Edition

#60
post #8

Earlier quoted context omitted.

Being in the data science community myself, I prefer straight venv + pip to conda. It’s simpler for me to manage errors. I only use conda when I have to.

Yeah I don't know a single person who chooses to use conda.

Conda is ideal if you need to support Windows environments with large, compiled scientific programming libraries.
Post reply on HN