Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Dealing with python environments and packages makes me want to avoid python if at all possible.

I see this a lot, and I don't blame folks for having this stance. It's taken me over a decade to dial in my workflow.

Quick rundown:

- don't use python2. Ever.

- don't use the system python, or brew python for anything other than bootstrapping

- only use `pip install --user` for exactly one thing: `pip install --user pipx` when you don't have brew

- never, ever, ever `sudo pip` anything. No exceptions.

- use pyenv to manage your python versions.

- use `pipx` to install stand-alone CLI tools, like virtualenvmanager, poetry, black, mypy.

- always develop in virtualenvs. No exceptions

- prefer installable python packages over scripty standalone .py files

- using PYTHONPATH is a smell

- poetry is likely the future of tooling, but it's not mature enough to be considered best practice for python beginners just yet. Stick with pip if you are uncertain.

- use lockfiles for writing applications but not writing libraries

- editable installs are a double-edged sword



I think the fact that you feel working with python requires adhering to a specific 12-step programme may go some way to explaining why I've never gotten comfortable with it.


I love Python and the Python 2-3 debacle really soured things for me as well. It was hard to get over that hump and I can understand that many were put off by it forever.


None of that fix the fact that 3 years later, all of your dependencies will have conflicting requirements.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: