Live data from Hacker News

My Python Development Environment, 2020 Edition

jacobian.org

151–160 of 241 posts

Re: My Python Development Environment, 2020 Edition

#151
post #37

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

I would actually recommend conda, it solves the "multiple version" issue and is compatible with virtualenv/pip so you can keep using them as usual.

Re: My Python Development Environment, 2020 Edition

#152

> On Linux, the system Python is used by the OS itself, so if you hose your Python you can hose your system. I never manged to hose the OS Python on Linux, by sticking to a very simple rule: DON'T BE ROOT. Don't work as root, don't run `sudo`. On Linux, I use the system python + virtualenv. Good enough. When I need a different python version, I use docker (or podman, which is an awesome docker replacement in context…

apparently in the 2020s and the age of containers it needs a perlgeek to explain basic principles of workstation usage since the 2000s to all the hip kids on the block.

Re: My Python Development Environment, 2020 Edition

#153
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…

Yes. As a non-Python programmer, I sometime had to make software or dependencies in Python works. It was always a long steps of installing some package manager, setting up virtual environment, running another package manager, etc. And of course, it failed at some point before the all thing was working.

On the contrary, I seldom had these kind of issues with projects coded in C#, C or C++: most of the time the few steps to compile the project succeeded and produced a usable binary.

Re: My Python Development Environment, 2020 Edition

#154
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…

Old virtualenv works. Pip works. This post reads most to me as fad. It is an opinion, you would most likely bail out.

We've stuck to virtualenv and pip mainly for the reason that we've got plumbing that works and we'd rather be doing other things than finding new plumbing.

Very few issues arise from our choice of build tooling. Not enough to consider switching at the moment. I suspect I'll try pyenv next time I have a new dev maching to set up but only as it seems fairly painless to switch from virtualenv.

Re: My Python Development Environment, 2020 Edition

#156
post #38

Earlier quoted context omitted.

Yes. As someone who has never dove deep into python, but has had some contact with it: the package manager ecosystem is the #1 thing keeping me away from it. npm sucks and all, but at least it just works and doesn't get in my way as much.

Coming the opposite way: having started programming on python and only started doing node.js stuff recently, npm is awesome.

100% agree.

Coming from the scientific computing realm, I've only ever done "real" code in Python until a couple of weeks ago when I was forced to do some work in Typescript. Once I got over the initial worries about the best method to install npm to avoid Python-esque problems and gave nvm a try, I was very pleasantly surprised by the package management process and was able to just get on with the work.

I've tried various Python env management solutions in the past (mostly leaning towards conda), but had recently settled on just using separate LXC/LXD containers for each project.

Re: My Python Development Environment, 2020 Edition

#157

Earlier quoted context omitted.

Old virtualenv works. Pip works. This post reads most to me as fad. It is an opinion, you would most likely bail out.

We've stuck to virtualenv and pip mainly for the reason that we've got plumbing that works and we'd rather be doing other things than finding new plumbing. Very few issues arise from our choice of build tooling. Not enough to consider switching at the moment. I suspect I'll try pyenv next time I have a new dev maching to set up but only as it seems fairly painless to switch from virtualenv.

There's a lot of "shiny new toy syndrome" where people want to try the latest tool that is "allegedly" better but it's a pain in multiple other factors.

Pip works, virtualenv works. They might not be great tools, but they do the job.

I don't want to worry to much about my environment, that's why I'm skeptical about new tools. Because they might break when you least expect

Re: My Python Development Environment, 2020 Edition

#158
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 never had any issue myself, but I guess that is because I use the standard tools:

python3 -m venv /tmp/foo

/tmp/foo/bin/pip -U pip wheel

/tmp/foo/bin/pip -r requirements.txt

I understand some might not like it, but really, it's simple and it works.

Re: My Python Development Environment, 2020 Edition

#159
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…

The big gap is management of the full dependency tree. With yarn I can get a package.lock which pretty well ensures I'll have the same exact version of everything, with no unexpected changes, every time I run yarn install. I get the same thing in the Rust world with Cargo. In Python it's a mess. Some packages specify their deps in setup.py; some in a requirements file, which may or may not be read in by their setup.p…

> With yarn I can get a package.lock

pipenv generates a Pipfile.lock - if it can, I've used it primarily for Airflow, and some packages within Airflow have incompatible version ranges for the same dependency, which means it can't generate the lock file.

Re: My Python Development Environment, 2020 Edition

#160
post #112

Earlier quoted context omitted.

npm is equivalent to combining pip and virtualenv into a single tool. This gives better ergonomics when switching between projects since you never have to "activate" your environment, it's always activated when standing in the project directory.

Isn't this what Pipenv does? What has been a downer for me is that many of the cloud providers do not support pipfiles in their serverless app services (Elastic Beanstalk, App Engine etc.)

Yep, correct. Unfortunately I had quite a few issues with pipenv - mainly around its relationship with pip.
Post reply on HN