Live data from Hacker News

My Python Development Environment, 2020 Edition

jacobian.org

101–110 of 241 posts

Re: My Python Development Environment, 2020 Edition

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

This is why I manage every nontrivial project I do nowadays with Nix (Haskell, Go, Python, C & C++, bash ..anything) Everything is pinned to exact source revisions. You can be relatively sure to be able to git clone and nix-shell and be off to the races. You can even go the extra mile and provide working editor integration in your nix-shell (especially easy with emacs). So you can enable anyone to git clone, nix-shel…

Ditto, roughly.

Re: My Python Development Environment, 2020 Edition

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

This is why I manage every nontrivial project I do nowadays with Nix (Haskell, Go, Python, C & C++, bash ..anything) Everything is pinned to exact source revisions. You can be relatively sure to be able to git clone and nix-shell and be off to the races. You can even go the extra mile and provide working editor integration in your nix-shell (especially easy with emacs). So you can enable anyone to git clone, nix-shel…

Agreed. Super painful to learn and still learning, but once it clicks, it's totally worth it. Amazing tool.

Occasionally I still run into weird non-deterministic issues with builds, though: https://github.com/NixOS/nixpkgs/issues/71178

You'd think "pinning" a python version + channel would avoid this.

Re: My Python Development Environment, 2020 Edition

#103
post #78

Earlier quoted context omitted.

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

So it’s niche.

No. I used it for managing my Mac and Linux environments.

Re: My Python Development Environment, 2020 Edition

#104
post #70

I'll pay anyone who can assist me with my Python setup. Is there a service like this, where one can find a developer on demand?

I have been using a consistent setup that hasn't yet failed me for the past 2 years. 1. Install Anaconda to your home user directory . 2. create environment using (conda create --name myenv python=3.6) . 3. Switch to the environment using (conda activate myenv) . 4. Use (conda install mypackage), (pip install mypackage) in that priority order . 5. Export environment using (conda env export > conda_env.yaml) . 6. Envi…

I can vouch for this. Anaconda is especially good for simulation/data stuff (based on the focus on which packages are included by default).

One pain point though: getting it to work with Sublime Text 3 requires you to set the `CONDA_DLL_SEARCH_MODIFICATION_ENABLE` environment variable to `1` on Windows.

Not a flaw of Anaconda: it just pays attention to how to with multiple Python installations on Windows.

Re: My Python Development Environment, 2020 Edition

#105
post #39

I have never understood the need for all the different tools surrounding Python packaging, development environments, or things like Pipenv. For years, I have used Virtualenv and a script to create a virtual environment in my project folder. It's as simple as a node_modules folder, the confusion around it is puzzling to me. Nowadays, using setuptools to create packages is really easy too, there's a great tutorial on t…

For years, I have used Virtualenv

Isn't this just a variant of what the original comment is critiquing, though? In order to sanely use Python and external dependencies you need some highly stateful, magical tool that does 'environments' for you. The conceptual load of this is quite high. Adding docker only makes it higher - now you're not merely 'virtualizing' a single language runtime but an entire OS as well - just to deal with the fact your language runtime has trouble handling dependencies.

Re: My Python Development Environment, 2020 Edition

#106
post #82
post #39

I have never understood the need for all the different tools surrounding Python packaging, development environments, or things like Pipenv. For years, I have used Virtualenv and a script to create a virtual environment in my project folder. It's as simple as a node_modules folder, the confusion around it is puzzling to me. Nowadays, using setuptools to create packages is really easy too, there's a great tutorial on t…

I'm firmly set on virtualenv with virtualenvwrapper for some convenience functions. Need a new space for a project? mkvirtualenv -p /path/to/python projectname (-p only if I'm not using the default configured in the virtualenv config file, which is rare) From there it's just "workon projectname" and just "deactivate" when I'm done (or "workon otherprojectname") It has been stable and working for ages now. I just don'…

Yup, that's my exact setup. Haven't found a need to do more than that for years.

Re: My Python Development Environment, 2020 Edition

#107
post #34

Earlier quoted context omitted.

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

Pyenv is for installing multiple versions of python. Virtualenvs are a layer beneath that. It’s super useful for maintaining static versions of python, like 2.7, 3.6 and 3.7 when you have many projects that have different python requirements.

I understand how this was needed historically, when using the official installer might overwrite the Python you already had installed. But as far as I know, you can download an installer for a new version, run it, and it doesn't touch your previous installation.

For example I've had 3.7 on my macOS system for a while, installed from the official installer, not through Homebrew. I just installed 3.8, which pointed my python3 to 3.8. But my 3.7 was still there; I created an alias python3.7 to point to that. So I can run or install anything I want against 3.7 or 3.8.

Why do we still need pyenv? I'm not asking that antagonistically, I really don't understand at this point and I'm wondering if I'm missing something.

Re: My Python Development Environment, 2020 Edition

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

And not just Python, try writing a small script in Haskell or Clojure and you'll see how much burden there is to setup their environments.

People hate on Gradle endlessly, but the fact that 99% of my JVM based applications can be successfully launched including entirely self-contained dependencies with

    ./gradlew run
is a huge boon and one of the things that keeps me sticking with the ecosystem.

Re: My Python Development Environment, 2020 Edition

#110
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'm a Java developer and I make fun of Maven and Gradle as much as anyone, but overall it seems like I am better off than I would be in the Python ecosystem for dependency management as well as managing the version of the language I compile and run with.
Post reply on HN