menu
techminis

A naukri.com initiative

google-web-stories
Home

>

Programming News

>

🐍 Don't N...
source image

Dev

1w

read

292

img
dot

Image Credit: Dev

🐍 Don't Need to Create requirements.txt and .venv Manually [UV]

  • uv is a fast Python package manager and task runner that replaces pip, venv, and parts of poetry.
  • uv simplifies project setup and dependency management without the extra overhead.
  • uv init command sets up a project environment, creating a pyproject.toml and setting up the .venv automatically.
  • uv add command allows instant addition of dependencies like 'rich' to your project.
  • Dependencies are added to pyproject.toml, installed, and updated in uv.lock with uv add command.
  • uv run command automatically runs the app inside the managed environment without manual activation of .venv.
  • After cloning or pulling a UV based project, use 'uv venv' to activate the environment and 'uv sync' to install all packages from pyproject.toml.
  • Additional commands like uv pip, uv pip freeze, uv sync --update offer more functionality.
  • Users can change Python versions or specify a version in .python-version using uv.
  • uv provides a more efficient alternative to traditional package management tools in Python.

Read Full Article

like

17 Likes

For uninterrupted reading, download the app