Posted on :: 303 Words :: Tags: , , , ,

uv damaging in large doses - yet a beautiful package contribution to the Python ecosystem

As a data professional, managing dependencies efficiently is crucial for productivity. Like the folks at Prefect, I’ve been exploring uv, a cutting-edge Python package manager that revolutionises how to handle dependencies. Previously, I relied on PDM, which served me very well, but I'm excited about the potential uv offers. Here's why:

Why uv Matters

  • Speed: uv is built in Rust, making it significantly faster than traditional package managers like pip. This speed boost can save you a lot of time, especially on large projects (and during deployments and other CI/CD processes).
  • Efficient Dependency Management: It simplifies workflows by providing a unified interface for managing dependencies, environments, and projects.
  • Compatibility: uv is designed to work seamlessly with existing Python tools and workflows, making it easy to integrate into existing projects.

Getting Started with uv

Setting up a new project is straightforward:

mkdir my_new_project && cd my_new_project
`uv` init && rm main.py  # Remove the sample code placeholder

uv init creates essential files like pyproject.toml and README.md. For a more comprehensive setup, you can use options like --lib, --description, and --python to tailor your project.

Key Commands

  • uv init`: Initialises a new project.
  • uv add`: Adds dependencies.
  • uv sync`: Ensures your environment is up-to-date.

Additional Tips

  • Virtual Environments: uv creates a virtual environment automatically when you add dependencies. You still activate it using source .venv/bin/activate.
  • Legacy Compatibility: Need a requirements.txt? Use uv pip compile pyproject.toml -o requirements.txt`.

uv is not just a package manager; it's a game-changer for Python development. Its speed, efficiency, and compatibility make it an excellent choice for both small and large projects.

p.s. I’m also a big fan of Prefect for workflow orchestration.

P.s.s. Hynek - Youtube

https://www.linkedin.com/posts/prefect_what-data-professionals-need-to-know-about-activity-7302442663432110081-MBgH?utm_source=share&utm_medium=member_ios&rcm=ACoAAABm36gBOI8YaSh5aQzOwdCBZvQjmzK-tbE