Python š
I donāt have any issues with Pythonās packaging ecosystem anymore, having settled comfortably into a pyenv+virtualenv+pip-tools as my āstackā after going around the block a few times.
But even so, I must recognise how awful the experience is for new users. Itās taken me years to settle into this system, and it can take half a day to get someone up to speed with these tools if they havenāt used them. - HN / Interview with a Senior Python Developer
- Interview with a Postdoc, Junior Python Developer - target child and Ph.D
# Packaging Mess
# UV ⮺
uv can use pyproject.toml files to describe package to install.
Should I Commit uv.lock or not?
- Yes - in most cases you should commit uv.lock.
- you might not commit it only if your are building libraries
see also UV is the best thing to happen to the Python ecosystem in a decade
- How uv got so fast - The most surprising part of uvās success to me isnāt Rust at all, itās how much speed we āunlockedā just by finally treating Python packaging as a well-specified systems problem instead of a pile of historical accidents.
- That feels like cargo-culting the toolchain - Jokes aside, what you describe is a common pattern. Itās also why Google internally they used to get decent speedups from rewriting some old C++ project in Go for a while: the magic was mostly in the rewrite-with-hindsight.
- You might be interested in pixi, which is roughly to conda as uv is to pip
- Pixi is what FreeCAD is now using. (Along with Rattler). - It makes building FreeCAD pretty trivial, which is a huge deal considering FreeCADās really complex Python and non-python, cross-platform dependencies.
# Poetry
poetry gave us lock files and consistent installs for years. uv is much, much faster however.
# Pip / Conda
- What is the difference between pip and conda?
- What is setup.py? - `$ pip install .
# PyEnv / VirtualEnv
The pyenv project was forked from rbenv and ruby-build, and modified for Python. - Is there a Python alternative to RVM or Rbenv?
pyenv - allows to work with different python version
virtualenv - for same python version, allows tu use different set of installed library. ex: virtualenv -p python3 py-opencv
pyenv-virtualenv - is a plugin for pyenv by the same author as pyenv, to allow you to use pyenv and virtualenv at the same time conveniently.
# virtualenv
$ virtualenv -p python3 mytest # create
$ source mytest/bin/activate # activate in bashFor other shell like Fish use source mytest/bin/activate.fish instead
see also
- error: externally-managed-environment
- How Python virtual environments work - Answer: they donāt
# Conda - see HN comment
Donāt need sudo right to use it.
- Installing on Linux - Anaconda vs. miniconda - Choose Anaconda if you are new to conda or Python - Choose Miniconda if you Just want fast access to Python and the conda commands, and wish to sort out the other programs later
# Fish shell support
Run āconda init fishā and restart your shell.
