UV Repositories
This section provides comprehensive documentation for using CloudRepo with UV, the revolutionary ultra-fast Python package installer and resolver written in Rust.
Introduction to UV
What is UV?
UV is a groundbreaking Python package installer and resolver that’s redefining performance standards in the Python ecosystem. Written entirely in Rust by the creators of Ruff, UV delivers unprecedented speed improvements—typically 10-100x faster than pip and pip-tools—while maintaining complete compatibility with existing Python packaging standards.
Key advantages of UV include:
Blazing fast performance: 10-100x faster than pip, often completing in milliseconds what takes pip seconds
Drop-in pip replacement: Compatible with pip’s command-line interface and requirements files
Rust-powered reliability: Memory-safe, parallel execution with minimal overhead
Smart caching: Aggressive caching strategies that minimize network requests
Resolution excellence: Advanced dependency resolver that handles complex scenarios pip struggles with
Global tool management: Install and run Python tools in isolated environments
Lock file generation: Create platform-specific lock files for reproducible builds
Zero configuration: Works out of the box with existing Python projects
Performance Comparison
Real-world benchmarks demonstrate UV’s extraordinary speed advantage:
# Installing Django and dependencies
pip: ~2.5 seconds
uv: ~0.08 seconds (31x faster)
# Installing NumPy, Pandas, Matplotlib
pip: ~8.2 seconds
uv: ~0.15 seconds (54x faster)
# Resolving complex dependency tree (100+ packages)
pip: ~45 seconds
uv: ~0.6 seconds (75x faster)
Why Use UV with CloudRepo?
Combining UV’s lightning-fast performance with CloudRepo’s reliable private repository hosting creates an optimal Python development experience:
Maximized speed: UV’s performance + CloudRepo’s fast CDN = instant package installations
Private package support: Securely distribute internal packages at unprecedented speeds
Cost efficiency: Save up to 90% compared to JFrog Artifactory while getting faster performance
No egress fees: Download packages at UV’s full speed without bandwidth concerns
Simplified configuration: UV’s intuitive configuration works seamlessly with CloudRepo
Reliability at scale: Both UV and CloudRepo are built for enterprise workloads
Support included: CloudRepo’s support team helps optimize your UV workflows
Prerequisites
Before configuring UV to work with CloudRepo, ensure you have:
CloudRepo Account and Repository
An active CloudRepo organization account
A Python repository created in the CloudRepo Admin Portal
A repository user with appropriate permissions (upload/download)
Note
Your admin user cannot directly access repositories for security reasons. Always create a dedicated repository user in the CloudRepo Admin Portal.
If you haven’t completed these steps, please refer to:
Python Installation
Python 3.8 or higher installed on your system
UV can manage Python versions, but an initial Python installation is recommended
Installation
Installing UV
UV offers multiple installation methods. Choose the one that best fits your environment:
Recommended: Standalone Installer
# macOS and Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows (PowerShell)
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
# After installation, restart your shell or run:
source ~/.bashrc # or ~/.zshrc on macOS
Alternative: Install via pip
# Install globally (requires pipx for isolation)
pipx install uv
# Or install in current environment
pip install uv
Alternative: Package Managers
# Homebrew (macOS/Linux)
brew install uv
# MacPorts (macOS)
port install uv
# Arch Linux
pacman -S uv
Verify Installation
Confirm UV is installed correctly:
# Check UV version
uv --version
# Expected output: uv 0.4.x
# View UV help
uv --help
# Check pip compatibility mode
uv pip --version
Configuration
Configuring UV for CloudRepo
UV can be configured to use CloudRepo as your private package index through multiple methods. Choose the approach that best fits your workflow:
Method 1: Environment Variables (Recommended)
Set environment variables for UV to use CloudRepo:
# Set CloudRepo as the primary index
export UV_INDEX_URL="https://[organization-id].mycloudrepo.io/repositories/[repository-id]/simple"
# Set authentication credentials
export UV_INDEX_USERNAME="[repository-user-email]"
export UV_INDEX_PASSWORD="[repository-user-password]"
# Optional: Use PyPI as extra index for public packages
export UV_EXTRA_INDEX_URL="https://pypi.org/simple"
# Add to your shell profile for persistence
echo 'export UV_INDEX_URL="https://[organization-id].mycloudrepo.io/repositories/[repository-id]/simple"' >> ~/.bashrc
echo 'export UV_INDEX_USERNAME="[repository-user-email]"' >> ~/.bashrc
echo 'export UV_INDEX_PASSWORD="[repository-user-password]"' >> ~/.bashrc
Method 2: UV Configuration File
Create a UV configuration file for project-specific or global settings:
# Global UV configuration
[index]
default = "cloudrepo"
[[index.urls]]
name = "cloudrepo"
url = "https://[organization-id].mycloudrepo.io/repositories/[repository-id]/simple"
[[index.urls]]
name = "pypi"
url = "https://pypi.org/simple"
[auth]
[auth.cloudrepo]
username = "[repository-user-email]"
password = "[repository-user-password]"
For project-specific configuration, create a uv.toml file in your project root:
# Project-specific UV configuration
[tool.uv]
index-url = "https://[organization-id].mycloudrepo.io/repositories/[repository-id]/simple"
extra-index-url = ["https://pypi.org/simple"]
[tool.uv.auth]
cloudrepo = { username = "[repository-user-email]", password = "[repository-user-password]" }
Method 3: .netrc Authentication
For better security, use .netrc file for credentials:
machine [organization-id].mycloudrepo.io
login [repository-user-email]
password [repository-user-password]
Set appropriate permissions:
chmod 600 ~/.netrc
Then use UV without inline credentials:
uv pip install --index-url https://[organization-id].mycloudrepo.io/repositories/[repository-id]/simple package-name
Method 4: Keyring Authentication
UV supports system keyring for secure credential storage:
# Install keyring package
uv pip install keyring
# Store CloudRepo credentials
keyring set https://[organization-id].mycloudrepo.io/repositories/[repository-id]/simple [repository-user-email]
# Enter password when prompted
# UV will automatically use keyring for authentication
uv pip install --index-url https://[organization-id].mycloudrepo.io/repositories/[repository-id]/simple package-name
Installing Packages
Basic Package Installation
With UV configured for CloudRepo, installing packages is incredibly fast:
# Install a single package from CloudRepo
uv pip install my-private-package
# Install specific version
uv pip install my-private-package==1.2.3
# Install with extras
uv pip install "my-private-package[dev,test]"
# Install multiple packages
uv pip install package1 package2 package3
# Upgrade packages
uv pip install --upgrade my-private-package
# Install with verbose output to see the speed
uv pip install -v my-private-package
Requirements Files
UV works seamlessly with requirements files:
# Public packages from PyPI
django>=4.2,<5.0
requests==2.31.0
numpy>=1.24.0
# Private packages from CloudRepo
my-company-auth==2.1.0
internal-api-client>=3.0.0
proprietary-ml-lib==1.5.2
# Install all requirements (UV automatically handles multiple indexes)
uv pip install -r requirements.txt
# Install with constraints
uv pip install -r requirements.txt -c constraints.txt
# Sync environment to match requirements exactly
uv pip sync requirements.txt
Using UV pip-compile for Lock Files
UV can generate lock files for reproducible installations:
# Create requirements.in file
cat > requirements.in << EOF
django>=4.2
my-private-package>=1.0
requests
EOF
# Compile to locked requirements
uv pip compile requirements.in -o requirements.lock
# Include hashes for extra security
uv pip compile requirements.in --generate-hashes -o requirements.lock
# Platform-specific compilation
uv pip compile requirements.in --platform linux --python-version 3.11 -o requirements-linux.lock
# Install from lock file
uv pip sync requirements.lock
Virtual Environment Management
UV provides ultra-fast virtual environment creation:
# Create a new virtual environment (instant!)
uv venv
# Create with specific Python version
uv venv --python 3.11
# Create with custom name
uv venv .venv
# Activate the environment
source .venv/bin/activate # Linux/macOS
# or
.venv\Scripts\activate # Windows
# Install packages in the environment
uv pip install my-private-package
# Sync environment with requirements
uv pip sync requirements.txt
Publishing Packages
While UV excels at package installation, publishing packages to CloudRepo still uses traditional tools like twine. Here’s how to prepare and publish packages that UV users can consume:
Building Packages
Build your Python packages using standard tools:
# Ensure build tools are installed
uv pip install build twine
# Build both wheel and source distributions
python -m build
# This creates:
# dist/your-package-1.0.0-py3-none-any.whl
# dist/your-package-1.0.0.tar.gz
Publishing to CloudRepo
Configure twine for CloudRepo and upload your packages:
[distutils]
index-servers =
cloudrepo
[cloudrepo]
repository = https://[organization-id].mycloudrepo.io/repositories/[repository-id]
username = [repository-user-email]
password = [repository-user-password]
# Upload to CloudRepo
twine upload --repository cloudrepo dist/*
# Verify upload
twine check dist/*
# Upload specific files
twine upload --repository cloudrepo dist/*.whl
Version Management
Follow semantic versioning for packages consumed by UV:
from setuptools import setup
setup(
name="my-private-package",
version="1.2.3", # Semantic versioning
packages=["my_package"],
python_requires=">=3.8",
install_requires=[
"requests>=2.28.0",
"pydantic>=2.0.0",
],
)
[build-system]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "my-private-package"
version = "1.2.3"
requires-python = ">=3.8"
dependencies = [
"requests>=2.28.0",
"pydantic>=2.0.0",
]
Advanced UV Features
Performance Optimization
Maximize UV’s speed with CloudRepo:
# Enable parallel downloads (default in UV)
uv pip install --parallel package1 package2 package3
# Use UV's aggressive caching
uv pip install --cache-dir ~/.uv-cache my-package
# Pre-download packages for offline installation
uv pip download -d ./offline-packages my-package
uv pip install --find-links ./offline-packages --no-index my-package
# Compile requirements with minimal resolution
uv pip compile --no-deps requirements.in -o requirements.lock
Resolution Strategies
UV offers advanced dependency resolution options:
# Prefer newer versions when resolving
uv pip install --upgrade-strategy eager my-package
# Use minimal version selection
uv pip install --resolution lowest my-package
# Ignore specific dependencies
uv pip install --no-deps my-package
# Override dependency versions
uv pip install my-package "dependency-override==2.0.0"
Docker Integration
Optimize Docker builds with UV’s speed:
# Multi-stage build with UV
FROM python:3.11-slim as builder
# Install UV
RUN pip install uv
# Configure CloudRepo credentials
ENV UV_INDEX_URL=https://[organization-id].mycloudrepo.io/repositories/[repository-id]/simple
ARG UV_INDEX_USERNAME
ARG UV_INDEX_PASSWORD
ENV UV_INDEX_USERNAME=$UV_INDEX_USERNAME
ENV UV_INDEX_PASSWORD=$UV_INDEX_PASSWORD
# Copy requirements and install (cached layer)
COPY requirements.txt .
RUN uv venv /opt/venv && \
/opt/venv/bin/uv pip install -r requirements.txt
# Final stage
FROM python:3.11-slim
# Copy virtual environment from builder
COPY --from=builder /opt/venv /opt/venv
# Add venv to PATH
ENV PATH="/opt/venv/bin:$PATH"
# Copy application
COPY . /app
WORKDIR /app
CMD ["python", "app.py"]
version: '3.8'
services:
app:
build:
context: .
args:
UV_INDEX_USERNAME: ${CLOUDREPO_USERNAME}
UV_INDEX_PASSWORD: ${CLOUDREPO_PASSWORD}
environment:
- UV_INDEX_URL=https://[organization-id].mycloudrepo.io/repositories/[repository-id]/simple
Global Tool Management
UV can manage Python tools in isolated environments:
# Install a tool globally with UV
uv tool install ruff
# Install from CloudRepo
UV_INDEX_URL=https://[organization-id].mycloudrepo.io/repositories/[repository-id]/simple \
uv tool install my-internal-cli
# Run tools without installation
uvx ruff check .
# List installed tools
uv tool list
# Update tools
uv tool update ruff
# Uninstall tools
uv tool uninstall ruff
CI/CD Integration
GitHub Actions
Integrate UV with CloudRepo in GitHub Actions for blazing fast CI/CD:
name: Test with UV
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install UV
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Cache UV packages
uses: actions/cache@v3
with:
path: ~/.cache/uv
key: ${{ runner.os }}-uv-${{ hashFiles('requirements.txt') }}
- name: Install dependencies with UV
env:
UV_INDEX_URL: https://${{ secrets.CLOUDREPO_ORG }}.mycloudrepo.io/repositories/${{ secrets.CLOUDREPO_REPO }}/simple
UV_INDEX_USERNAME: ${{ secrets.CLOUDREPO_USERNAME }}
UV_INDEX_PASSWORD: ${{ secrets.CLOUDREPO_PASSWORD }}
run: |
uv venv
source .venv/bin/activate
uv pip install -r requirements.txt
uv pip install pytest pytest-cov
- name: Run tests
run: |
source .venv/bin/activate
pytest tests/ -v --cov=my_package
- name: Build package
run: |
source .venv/bin/activate
uv pip install build
python -m build
- name: Publish to CloudRepo
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
env:
TWINE_USERNAME: ${{ secrets.CLOUDREPO_USERNAME }}
TWINE_PASSWORD: ${{ secrets.CLOUDREPO_PASSWORD }}
run: |
source .venv/bin/activate
uv pip install twine
twine upload --repository-url https://${{ secrets.CLOUDREPO_ORG }}.mycloudrepo.io/repositories/${{ secrets.CLOUDREPO_REPO }} dist/*
GitLab CI
Configure GitLab CI to use UV with CloudRepo:
variables:
UV_INDEX_URL: "https://${CLOUDREPO_ORG}.mycloudrepo.io/repositories/${CLOUDREPO_REPO}/simple"
UV_INDEX_USERNAME: "${CLOUDREPO_USERNAME}"
UV_INDEX_PASSWORD: "${CLOUDREPO_PASSWORD}"
UV_CACHE_DIR: "${CI_PROJECT_DIR}/.uv-cache"
cache:
paths:
- .uv-cache/
before_script:
- curl -LsSf https://astral.sh/uv/install.sh | sh
- export PATH="$HOME/.local/bin:$PATH"
- uv --version
stages:
- test
- build
- deploy
test:
stage: test
image: python:3.11
script:
- uv venv
- source .venv/bin/activate
- uv pip install -r requirements.txt
- uv pip install pytest pytest-cov
- pytest tests/ -v --cov=my_package --junitxml=report.xml
artifacts:
reports:
junit: report.xml
parallel:
matrix:
- PYTHON_VERSION: ["3.9", "3.10", "3.11", "3.12"]
build:
stage: build
image: python:3.11
script:
- uv venv
- source .venv/bin/activate
- uv pip install build
- python -m build
artifacts:
paths:
- dist/
deploy:
stage: deploy
image: python:3.11
only:
- tags
script:
- uv venv
- source .venv/bin/activate
- uv pip install twine
- twine upload --repository-url ${UV_INDEX_URL/simple/} dist/*
Speed Comparison in CI/CD
Real-world CI/CD performance improvements with UV:
GitHub Actions - Installing 50 Dependencies:
─────────────────────────────────────────────
pip (no cache): 2m 15s
pip (with cache): 45s
uv (no cache): 12s
uv (with cache): 3s
Improvement: 7.5x faster (cached), 11.25x faster (uncached)
Docker Build - Python Application:
─────────────────────────────────────────────
pip-based Dockerfile: 3m 20s
uv-based Dockerfile: 28s
Improvement: 7.1x faster
Full CI Pipeline (test + build + deploy):
─────────────────────────────────────────────
pip-based: 5m 45s
uv-based: 1m 05s
Improvement: 5.3x faster
Troubleshooting
Common Issues and Solutions
Authentication Errors
ERROR: HTTP 401 Unauthorized from https://[organization-id].mycloudrepo.io
Solution:
# Verify credentials are correct
curl -u "[username]:[password]" https://[organization-id].mycloudrepo.io/repositories/[repository-id]/simple/
# Check environment variables
echo $UV_INDEX_USERNAME
echo $UV_INDEX_PASSWORD
# Ensure no conflicting configurations
unset PIP_INDEX_URL # UV uses UV_INDEX_URL instead
Index URL Issues
ERROR: Could not find a version that satisfies the requirement my-package
Solution:
# Verify the package exists in CloudRepo
uv pip index packages --index-url $UV_INDEX_URL
# Check if using correct index
uv pip config list
# Force specific index
uv pip install --index-url https://[organization-id].mycloudrepo.io/repositories/[repository-id]/simple my-package
Cache Issues
Using cached my-package-1.0.0 (outdated version)
Solution:
# Clear UV cache
uv cache clean
# Install with no cache
uv pip install --no-cache my-package
# Force reinstall
uv pip install --force-reinstall my-package
SSL/TLS Errors
ERROR: SSL: CERTIFICATE_VERIFY_FAILED
Solution:
# Update certificates
pip install --upgrade certifi
# If behind corporate proxy, configure properly
export HTTPS_PROXY=http://proxy.company.com:8080
export SSL_CERT_FILE=/path/to/corporate-cert.pem
Platform-Specific Issues
ERROR: No matching distribution found for my-package
Solution:
# Check available wheels
uv pip index versions my-package
# Install with platform override
uv pip install --platform linux_x86_64 my-package
# Build from source if needed
uv pip install --no-binary :all: my-package
Debugging UV Operations
Enable verbose output for detailed debugging:
# Maximum verbosity
uv -vvv pip install my-package
# Show resolution process
uv pip install --verbose my-package
# Display configuration
uv pip config debug
# Check index connectivity
uv pip index list --index-url $UV_INDEX_URL
# Verify package availability
uv pip search my-package --index-url $UV_INDEX_URL
Performance Monitoring
Monitor UV’s performance to ensure optimal operation:
# Time package installation
time uv pip install my-package
# Profile with detailed timing
UV_LOG=trace uv pip install my-package 2> uv-trace.log
# Monitor cache effectiveness
du -sh ~/.cache/uv
# Check network performance to CloudRepo
curl -o /dev/null -w "@curl-format.txt" \
https://[organization-id].mycloudrepo.io/repositories/[repository-id]/simple/
Best Practices
Security Recommendations
Never commit credentials
.gitignore - Excluding Sensitive Files# UV configuration with credentials uv.toml .env .netrc # Python *.pyc __pycache__/ .venv/
Use environment variables in CI/CD
Store CloudRepo credentials as encrypted secrets in your CI/CD platform.
Rotate credentials regularly
Update repository user passwords periodically and use API tokens where possible.
Enable package signing
When publishing packages, sign them for additional security:
twine upload --sign --repository cloudrepo dist/*
Performance Best Practices
Leverage UV’s cache aggressively
# Set a large cache directory export UV_CACHE_DIR=/fast/ssd/uv-cache # Pre-populate cache in CI/CD uv pip download -r requirements.txt
Use lock files for reproducibility
# Generate lock file uv pip compile requirements.in -o requirements.lock # Deploy with exact versions uv pip sync requirements.lock
Minimize index requests
# Download once, install many uv pip download -d ./wheels -r requirements.txt uv pip install --find-links ./wheels --no-index -r requirements.txt
Parallel operations where possible
# Install multiple packages in parallel uv pip install package1 package2 package3 --parallel
Workflow Recommendations
Development Workflow
Recommended Development Workflow# Start new project mkdir my-project && cd my-project uv venv source .venv/bin/activate # Install development dependencies uv pip install -e ".[dev]" # Add new dependency uv pip install new-package uv pip freeze > requirements.txt
Production Deployment
Production Deployment Workflow# Generate lock file in development uv pip compile requirements.in --generate-hashes -o requirements.lock # Deploy with locked dependencies uv pip sync requirements.lock --require-hashes
Team Collaboration
Standardize on UV across the team for consistent performance
Share UV configuration templates in project repositories
Document CloudRepo setup in project README files
Use lock files to ensure everyone has identical dependencies
Summary
UV revolutionizes Python package management with its unprecedented speed, and CloudRepo provides the perfect private repository backend to complement UV’s performance. Together, they offer:
10-100x faster installations compared to traditional pip workflows
Cost savings up to 90% compared to enterprise alternatives
Zero configuration complexity with intuitive setup
Enterprise-grade reliability with included support
No egress fees allowing unlimited high-speed downloads
By combining UV’s Rust-powered performance with CloudRepo’s reliable infrastructure, development teams can achieve dramatically faster build times, more responsive CI/CD pipelines, and a superior developer experience.
For additional support or questions about using UV with CloudRepo, please contact our Support Team. We typically respond within a few business hours and are happy to help optimize your UV and CloudRepo setup for maximum performance.
See also
Python Repositories - Traditional pip configuration with CloudRepo
Poetry Repositories - Using Poetry with CloudRepo
Pixi Repositories - Pixi package manager integration
Continuous Integration and Deployment - CI/CD best practices
UV Documentation - Official UV documentation
CloudRepo Python API - CloudRepo Python API reference