TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

My Python Development Environment, 2020 Edition

393 pointsby surajover 5 years ago

28 comments

marmadaover 5 years ago
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&#x2F;projects is intimidating.<p>I don&#x27;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.<p>&quot;pipenv install&quot; gave me an error about accepting 1 argument, but 3 were provided.<p>Then I switched to Poetry. Poetry kept on detecting my Python2 installation, but not my Python3 installation. It seemed like I had to use pyenv, which I didn&#x27;t want to use, since that&#x27;s another tool to use and setup on different machines.<p>I gave up and started rewriting the project (web scraper) in Node.js with Puppeteer.
评论 #21510874 未加载
评论 #21511089 未加载
评论 #21511330 未加载
评论 #21511231 未加载
评论 #21510779 未加载
评论 #21510794 未加载
评论 #21513105 未加载
评论 #21512935 未加载
评论 #21511117 未加载
评论 #21510789 未加载
评论 #21514227 未加载
评论 #21512694 未加载
评论 #21513072 未加载
评论 #21511826 未加载
评论 #21511237 未加载
评论 #21511080 未加载
评论 #21513589 未加载
评论 #21511008 未加载
评论 #21513064 未加载
评论 #21512988 未加载
评论 #21512574 未加载
评论 #21510855 未加载
评论 #21510799 未加载
评论 #21514079 未加载
评论 #21511123 未加载
评论 #21512680 未加载
评论 #21512857 未加载
评论 #21511070 未加载
madelynover 5 years ago
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&#x27;s as simple as a node_modules folder, the confusion around it is puzzling to me.<p>Nowadays, using setuptools to create packages is really easy too, there&#x27;s a great tutorial on the main Python site. It&#x27;s not as easy as node.js, sure, but there&#x27;s tools like Cookiecutter to remove the boilerplate from new packages.<p>requirements.txt files aren&#x27;t very elegant, but they work well enough.<p>And with docker, all this is is even easier. The python + docker story is really nice.<p>Honestly I just love these basic tools and how they let me do my job without worrying about are they the latest and greatest. My python setup has been stable for years and I am so productive with it.
评论 #21511243 未加载
评论 #21511614 未加载
评论 #21511343 未加载
评论 #21511161 未加载
评论 #21512479 未加载
Evidloover 5 years ago
For those new or unfamiliar with python, I think the best solution is the simplest: pip and virtualenv
评论 #21510999 未加载
评论 #21511247 未加载
评论 #21512805 未加载
评论 #21513657 未加载
评论 #21511104 未加载
评论 #21511205 未加载
评论 #21512585 未加载
评论 #21513165 未加载
f4stjackover 5 years ago
Eeeehhh I think I will be downvoted to hell and back for this but after I read the article I had the feeling of &quot;why are you making this feel more complex than it needs to be?&quot;<p>I mean compared to Java and C# I have a MUCH MORE EASIER time to set up my development environment. Installing Python, if I am on a Windows box I mean, is enough to satisfy a lot of the requirements. I then clone the repo of the project and<p>source venv&#x2F;bin&#x2F;activate<p>pip install -r requirements.txt<p>is enough to get me to start coding.
评论 #21513713 未加载
wp381640over 5 years ago
If you&#x27;re going to be using pyenv + poetry you should be aware of #571 that causes issues with activating the virtualenv<p><a href="https:&#x2F;&#x2F;github.com&#x2F;sdispater&#x2F;poetry&#x2F;issues&#x2F;571" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;sdispater&#x2F;poetry&#x2F;issues&#x2F;571</a><p>the OP himself has a fix for this in his own dotfiles repo:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;jacobian&#x2F;dotfiles&#x2F;commit&#x2F;e7889c5954daacfe0988fc05ff9e8e87eb1241b7" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;jacobian&#x2F;dotfiles&#x2F;commit&#x2F;e7889c5954daacfe...</a>
评论 #21514046 未加载
nunezover 5 years ago
&gt; Although Docker meets all these requirements, I don&#x27;t really like using it. I find it slow, frustrating, and overkill for my purposes.<p>How so? I&#x27;ve been using Docker for development for years now and haven&#x27;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.<p>I personally would absolutely leverage Docker for the setup being described here: multiple versions with lots of environmental differences between each other. That&#x27;s what Docker was made for!
评论 #21514080 未加载
评论 #21510996 未加载
gravypodover 5 years ago
The Dockerfile that&#x27;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.
analog31over 5 years ago
In addition to the popular conda, it&#x27;s worth checking out WinPython for scientific use. Each WinPython installation is an isolated environment that resides in a folder. To move an installation to another computer, just copy the folder. To completely remove it from your system, delete the folder.<p>I find it useful to keep a WinPython installation on a flash drive in my pocket. I can plug it into somebody&#x27;s computer and run my own stuff, without worrying that I&#x27;m going to bollix up their system.
ninetaxover 5 years ago
Curious to hear other&#x27;s experiences with pipenv vs poetry. Has anyone made the switch?
评论 #21510694 未加载
评论 #21510730 未加载
评论 #21511025 未加载
评论 #21510632 未加载
评论 #21511332 未加载
评论 #21511328 未加载
评论 #21510689 未加载
评论 #21512296 未加载
评论 #21510921 未加载
perlgeekover 5 years ago
&gt; On Linux, the system Python is used by the OS itself, so if you hose your Python you can hose your system.<p>I never manged to hose the OS Python on Linux, by sticking to a very simple rule: DON&#x27;T BE ROOT. Don&#x27;t work as root, don&#x27;t run `sudo`.<p>On Linux, I use the system python + virtualenv. Good enough.<p>When I need a different python version, I use docker (or podman, which is an awesome docker replacement in context of development environments) + virtualenv in the container. (Why virtualenv in the container? Because I use them outside the container as well, and IMHO it can&#x27;t hurt to be consistent).
评论 #21512836 未加载
xchaoticover 5 years ago
I love Python syntax, but I still haven&#x27;t found a sufficiently popular way that can deploy my code in the same set of setting s as my dev box (other than literally shipping a VM). So setting up a dev env is one problem, but deploying it so that the prod env is the same and works the same is another.
ausjkeover 5 years ago
<p><pre><code> python -m venv venv source venv&#x2F;bin&#x2F;activate pip install -U pip pip install whatever # &lt;do you stuff here&gt; deactivate </code></pre> no need any third-party tools, venv is built-in the above steps always worked for me out of the box.
评论 #21512307 未加载
评论 #21513274 未加载
Lucasoatoover 5 years ago
This article is great, those are viable solutions for sure. One of the alternatives is conda: it&#x27;s common among data scientists, but many of its features (isolation between environments, you can keep private repository off the internet) meet enterprise needs.
eximiusover 5 years ago
I would generally reach for conda instead of this, but they seem quite comparable in aggregate.<p>And, given that I&#x27;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.<p>(I haven&#x27;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...)
rullopatover 5 years ago
I like Python has a language, but when I see how clean are the tools of other similar languages, for example Ruby, compared to the clusterf<i></i>k of the Python ecosystem, it just make me want to close the terminal. I&#x27;m always wondering how it became the language #1 on StackOverflow.
notusover 5 years ago
I recommend asdf for version management if you use more than one programming language
评论 #21512613 未加载
评论 #21512385 未加载
评论 #21513690 未加载
anonuover 5 years ago
There are two things that I find a bit elusive with Python:<p>1. Highlight to run 2. Remoting into a kernel<p>Both features are somewhat related. I want to be able to fire up a Python Kernel on a remote server. I want to be able to connect to it easily (not having to ssh tunnel over 6 different ports). I want connect my IDE to it and easily send commands and view data objects remotely. Spyder does all this but its not great. You have to run a custom kernel to be able to view variables locally.<p>Finally, I want to be able to connect to a Nameko or Flask instance as I would any remote kernel and hot-swap code out as needed.
luordover 5 years ago
So far using docker and setup.py files is working for me, I&#x27;ve never felt they were particularly slow, so I&#x27;ll keep using them.<p>I gotta give poetry a try, though.
eivarvover 5 years ago
Why not just use conda for envs and deps (or env-specific pip), and install youtube-dl etc. via your platform&#x27;s package manager?
评论 #21513919 未加载
评论 #21514545 未加载
nsomaruover 5 years ago
I’ve been manually deploying my projects for years.<p>Can anyone comment on the Docker learning &amp; troubleshooting story for python?
评论 #21511989 未加载
评论 #21513762 未加载
snorkasaurusover 5 years ago
I like pip-tools for venv requirements management, but I don&#x27;t see it mentioned much.
评论 #21513682 未加载
frou_dhover 5 years ago
My sole use of Python is writing plugins (mostly single-user: me) for Sublime Text.<p>It feels pretty comfy to effectively be on an island and far away from the hustle and bustle of the industrial Python tooling.
dangover 5 years ago
Related from 2018: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=16439270" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=16439270</a>
schainksover 5 years ago
I&#x27;ve moved to ASDF and haven&#x27;t really looked back. It&#x27;s working well with low fuss, and supporting far more than just python on my machine.
kovekover 5 years ago
I&#x27;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?
评论 #21511420 未加载
评论 #21512002 未加载
评论 #21513725 未加载
评论 #21511155 未加载
mrfusionover 5 years ago
Why pipx vs just using pip?
评论 #21510565 未加载
diminotenover 5 years ago
&gt; Governance: the lead of Pipenv was someone with a history of not treating his collaborators well. That gave me some serious concerns about the future of the project, and of my ability to get bugs fixed.<p>Doesn&#x27;t seem fair. You&#x27;re not abandoning requests, are you?
评论 #21511302 未加载
评论 #21511198 未加载
mlthoughts2018over 5 years ago
This is so painful to see compared to using conda.
评论 #21510543 未加载
评论 #21510534 未加载
评论 #21510539 未加载
评论 #21510572 未加载