• 12 Posts
  • 1.49K Comments
Joined 1 year ago
cake
Cake day: July 7th, 2023

help-circle








  • yeah, all that setup sucks even after being writing python for years.

    Nowadays I’ve been running every project with uv and it’s a much better and faster experience, usually in 3 steps: 1. initialize, 2. add dependencies, 3. run project:

    
    # if the project doesn't already have a pyproject.toml with dependencies, initialize it
    # uv will also install the right interpreter if not present:
    uv init --python 3.13
    
    # anything you would install with pip, use uv add:
    uv add dep1 dep2
    
    # run the project / script
    uv run main.py
    
    

    Then in future runs (as long as you have the pyproject.toml), you can just do uv run main.py (shorthand to uv run python main.py), even when there’s no venv created. No more activating virtual envs. No more long interpreter installations. No more accidentally messing with system’s packages or the PATH variable. With the uv.lock that’s also a lot more reliable to reproduce than requirements.txt and similar.









  • The Python env has been trying this multiple tools approach for decades and consistently delivering a worse experience than languages that pack most things in one tool.

    Rust is a bliss to use, largely thanks to cargo that takes care of build, dependencies, locking, tests, publishing etc. You say do one thing and do it well. In my experience they often do one thing in a mediocre way, while forcing users to understand which and how to combine dozens of possible tools in a development environment that keeps changing. It’s messy, slow, error prone, and requires constant developer attention.