DEV Community

Alejandro FR
Alejandro FR

Posted on

🚀 UV, el nuevo estándar para Python

UV reemplaza pip, virtualenv y pipx con una sola herramienta ultrarrápida. Aprende cómo usarlo y por qué migrar hoy.

🧩 ¿Qué es UV?

uv es una herramienta moderna creada por Astral (los de ruff 🦀) para reemplazar pip, virtualenv, pip-tools y pipx con un solo binario rápido y eficiente.

⚙️ Instalación

# En macOS & Linux.
curl -LsSf https://astral.sh/uv/install.sh | sh
# o con Homebrew
brew install uv

# En Windows.
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
Enter fullscreen mode Exit fullscreen mode

📦 Crea tu entorno en segundos

Antes:

python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
Enter fullscreen mode Exit fullscreen mode

Ahora:

uv venv
uv pip install -r requirements.txt
Enter fullscreen mode Exit fullscreen mode

Modo moderno (recomendado):

uv init myproject
uv add fastapi uvicorn
uv sync
Enter fullscreen mode Exit fullscreen mode

uv crea .venv, pyproject.toml y uv.lock.

⚡ Ejecuta sin activar el entorno

uv run app.py
uv run pytest
Enter fullscreen mode Exit fullscreen mode

🧪 Migrando desde requirements.txt

Compatibilidad:

uv pip install -r requirements.txt
Enter fullscreen mode Exit fullscreen mode

Migración:

uv init
uv add -r requirements.txt
uv sync
Enter fullscreen mode Exit fullscreen mode

Esto genera pyproject.toml y uv.lock

🧹 Limpieza y mantenimiento

Acción Comando
Limpiar caché uv cache clean
Ver deps uv pip list
Actualizar desde requirements.txt uv pip install --upgrade -r requirements.txt

🔚 Conclusión

uv es simple, rápido, compatible y moderno.
Si pensabas que Python necesitaba un mejor gestor de entornos, este es el momento.

Post original en: link

Top comments (0)