Hasty Briefsbeta

You're probably using uv wrong

13 days ago
  • #Python
  • #Package Management
  • #Development Tools
  • uv is a fast, Rust-based Python package manager that replaces pip, pyenv, and virtual environments.
  • Using uv correctly involves working within a 'project' context, avoiding direct use of pip, pyenv, or venv.
  • A uv project is defined by a pyproject.toml file, which specifies project metadata and dependencies.
  • uv init creates a new project with Git integration, .gitignore, .python-version, and a skeleton main.py.
  • Running code with uv run ensures consistency with the project's Python version and dependencies.
  • Dependencies are added with uv add, which updates pyproject.toml and handles installation automatically.
  • The uv.lock file ensures reproducible environments by locking exact package versions and dependencies.