Live data from Hacker News

My Python Development Environment, 2020 Edition

jacobian.org

21–30 of 241 posts

Re: My Python Development Environment, 2020 Edition

#21
post #11
post #7

Earlier quoted context omitted.

With pipx when you install things they go into isolated environments. With pip you're just installing things globally. This difference is important due to dependencies- if you have two different CLI tools you want to install but they have conflicting dependencies then pip is going to put at least one of them into an unusable state, while pipx will allow them to both coexist on the same system.

You can get this with standard pip by setting the PIP_REQUIRE_VIRTUALENV env variable.

That just gives you a warning. It doesn’t automatically create a virtualenv and link the bin scripts into the path.

Re: My Python Development Environment, 2020 Edition

#23
The Dockerfile that's provided looks like it would be very slow to build. I always try to make Dockerfiles that install deps and then install my python package (usually just copy in the code and set PYTHONPATH) to fully take advantage of the docker build cache. When you have lots of services it really reduces the time it takes to iterate with `docker-compose up -d --build`-like setups.

Re: My Python Development Environment, 2020 Edition

#25
post #13

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

Switched to poetry and couldn't be happier. From my experience, poetry wins hands down. It managed to replace flit, remove duplicate dependencies, and maintain stability across machines. All while using the standard pyproject.toml configuration file.

Re: My Python Development Environment, 2020 Edition

#26
post #13

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

I've used both and recommend Poetry. It's got a larger feature set (it can be used to manage packages _and_ publish packages), it's faster, and it's more actively developed (measured by releases). Pipenv's last release was 2018-11-26, and Poetry has been publishing pre-releases as recently as three days ago to prepare for v1.0.0.

I did a quick comparison here[0], and I'm planning to do an update with the latest version of Poetry.

[0] https://johnfraney.ca/posts/2019/03/06/pipenv-poetry-benchma...

Re: My Python Development Environment, 2020 Edition

#27
> Although Docker meets all these requirements, I don't really like using it. I find it slow, frustrating, and overkill for my purposes.

How so? I've been using Docker for development for years now and haven't experienced this EXCEPT with some slowness I experienced with Docker Compose upon upgrading to MacOS Catalina (which turned out to be bug with PyInstaller, not Docker or Docker Compose). This is on a Mac, btw; I hear that Docker on Linux is blazing fast.

I personally would absolutely leverage Docker for the setup being described here: multiple versions with lots of environmental differences between each other. That's what Docker was made for!

Re: My Python Development Environment, 2020 Edition

#28
post #7
post #6

Why pipx vs just using pip?

With pipx when you install things they go into isolated environments. With pip you're just installing things globally. This difference is important due to dependencies- if you have two different CLI tools you want to install but they have conflicting dependencies then pip is going to put at least one of them into an unusable state, while pipx will allow them to both coexist on the same system.

pip in virtualenv installs in virtualenv, if you add --user option it installs locally, but today I always do developent in virtualenv.

Re: My Python Development Environment, 2020 Edition

#29
post #13

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

Similar to the OP, I found pipenv to be quite unstable. At the time (about a year ago) it was really more interesting beta software than the production-quality software it was advertised as. It was also quite a bit slower than pip.

But what really pushed me away is that installing or upgrading any single package upgraded all dependencies, with no way to disable this behavior. (I believe you can now.) A package manager should help me manage change (and thereby risk), not prevent me from doing so.

Poetry is probably the best of the all-in-one solutions. It does its job well but I've found the documentation lacking.

In the end, I've settled on pyenv-virtualenv to manage my environments and pip-tools to manage dependencies. It's simple and meets my needs.

Re: My Python Development Environment, 2020 Edition

#30

Earlier quoted context omitted.

1. The author of this post helped to create the Django framework and runs a successful Python consultancy. 2. Conda is not used as much as you might think... it's really only used within the data science community.

1. Argument from authority doesn’t mean anything to me. I also don’t believe creating Django or running a Python consultancy endow someone with especially useful opinions of Python packaging tooling. (Not that the author isn’t knowledgeable, just you seem to think there’s an A implies B relationship between those two items and having good opinions about Python packaging, and there’s not). 2. Conda is quite widely use…

> huge banks, government agencies, universities

> large Fortune 500 e-commerce companies

Sorry, but argument from authority doesn't mean anything to me.

In all seriousness though, you literally did not provide any logical reasons to think conda is better.

Post reply on HN