Python notes

Run Python REPL with uv with specific dependencies. No need to create separate venv

uv run --python 3.12 --with pandas python

Create new uv venv and project

uv venv --python=3.12
source .venv/bin/activate.fish
uv init
uv add pandas

For single file scripts you can define dependencies and Python version in the script itself:

# /// script
# requires-python = ">=3.12"
# dependencies = ["pandas", "pyarrow"]
# [tool.uv]
# exclude-newer = "2025-01-10T00:00:00Z"
# ///
print("Hello world")

To run the script

uv run test.py