Live data from Hacker News

My Python Development Environment, 2018 Edition

jacobian.org

41–50 of 224 posts

Re: My Python Development Environment, 2018 Edition

#41

I haven't had to write python in awhile but are there reasons to use virtualenv etc. instead of a docker container?

I wish you weren't getting downvoted for this. docker-compose is honestly no more complicated of a thing than virtualenv to use.

That said, main reason to do it is that python is a language of idioms and this is one. It's easier to take the trail than break your own.

Re: My Python Development Environment, 2018 Edition

#42

I haven't had to write python in awhile but are there reasons to use virtualenv etc. instead of a docker container?

Yes: Docker adds an enormous amount of overhead. Instead of your Python code you now have to manage a second operating system for the host (including things like not being able to debug or edit directly, having to debug networking, etc.) and whatever OS + deployment is happening in the actual container.

For deployment, Docker solves a lot of problems but there's a significant cost for local development.

Re: My Python Development Environment, 2018 Edition

#43
post #12

Every time I use Python I miss NPM and package.json.

In what way is NPM and package.json different from using pip and requirements.txt?

npm installs to a local node_modules file by default, whereas you have to set up a virtualenv or something similar to get that from pip

Re: My Python Development Environment, 2018 Edition

#45

I haven't had to write python in awhile but are there reasons to use virtualenv etc. instead of a docker container?

I wish you weren't getting downvoted for this. docker-compose is honestly no more complicated of a thing than virtualenv to use. That said, main reason to do it is that python is a language of idioms and this is one. It's easier to take the trail than break your own.

Agreed. I don’t see how Docker is slower once the compose environment is setup (especially if you’re running Docker in Linux), and proper volume mounts are made to the source files. In fact, I would say developing with Docker will help with deploying to production, because you’ll be able to see how the app will work in production.

I can see Docker being slower if virtualized, but on Linux, it’s just a fancier BSD jail, no?

Re: My Python Development Environment, 2018 Edition

#46

there are way too many python dep/env managers/things pipenv pyenv mkvirtualenv virtualenv pipsi venv pew conda virtualenvwrapper i'm sure i'm forgetting like 5. this is like https://xkcd.com/927/ for the record i use pyenv and virtualenv (although playing with ML i'm using conda)

There is only pip and virtualenv. They go together.

Virtualenv creates an application directory. Pip install the required packages into it.

Re: My Python Development Environment, 2018 Edition

#47
post #15
post #12

Every time I use Python I miss NPM and package.json.

You miss a package manager layered on top of the one already in your OS, one that's seemingly run by people with no clue what they're doing, is rife with security issues and can break your entire system as we saw today? I have no clue why a sane person would run npm.

And yet millions do?

Re: My Python Development Environment, 2018 Edition

#48
post #16
post #13

Earlier quoted context omitted.

As a Python developer, I just stay with pip and virtualenv, but I share the smh/wtf sentiment here. The data science folks enjoy conda but I don't see that being useful to me anywhere else. I feel like every other year someone will invent a new pip env . pyvenv (see comment section, edited) is now deprecated and venv is recommended (shipped as part of Python 3.6 installation) is another confusion. Lest not forget the…

Conda is especially useful if you want to use scientific packages on Windows.

Good point, thank you. I don't do much on Windows anymore. But a little search of VS Studio (I know there are some core envelopers working for MSFT) yields this: https://stackoverflow.com/questions/15185827/can-pip-be-used...

Probably exciting for VS users.

Re: My Python Development Environment, 2018 Edition

#49
post #27

I’m using Anaconda because it was recommended in a step by step tutorial for playing with deep learning. What would be involved in removing it from my system and moving instead to this set of tools? Not necessarily looking for s step by step answer, just for general suggestions. My guess is: find out which python the deep learning tools are using, remove Anaconda, and reinstall the python version needed, using the to…

Just in case you wish to retain anaconda, you could simply remove anaconda path from your PATH variable in .bashrc file (Assuming you are on Linux). If you need anaconda again, you could add the path to the variable, or run `source ~/anaconda3/bin/activate`

Re: My Python Development Environment, 2018 Edition

#50
post #27

I’m using Anaconda because it was recommended in a step by step tutorial for playing with deep learning. What would be involved in removing it from my system and moving instead to this set of tools? Not necessarily looking for s step by step answer, just for general suggestions. My guess is: find out which python the deep learning tools are using, remove Anaconda, and reinstall the python version needed, using the to…

I think you could probably use both, side-by-side (but not at the same time/for the same project).

Anaconda might be nicer if the packages you need are C-based and would need compiling on your platform. Depends on your use-case. For experimentation/playing around, stick with what works for you. But if a project required me to install Anaconda, I wouldn’t take it seriously. And pipenv is pretty easy to use, too. So if you plan on distributing it or open-sourcing it, understanding how most other people manage dependencies ouside of conda is going to be useful.

Post reply on HN