Skip to main content

Uvify

PyPI version

Turn python repositories to uv environments and oneliners, without diving into the code.

  • Generates oneliners for quick python environment setup
  • Helps with migration to uv for faster builds in CI/CD
  • It works on existing projects based on: requirements.txt, pyproject.toml or setup.py, recursively.
    • Supports local directories.
    • Supports GitHub links using Git Ingest.
  • It's fast!

Prerequisites

| uv

Demo

https://huggingface.co/spaces/avilum/uvify

Star History Chart

uv is by far the fastest python and package manager.

Source: https://github.com/astral-sh/uv

You can run uvify with uv.
Let's generate oneliners for a virtual environment that has requests installed, using PyPi or from source:

# Run on a local directory
uvx uvify . | jq

# Run on requests
uvx uvify https://github.com/psf/requests | jq
# or:
# uvx uvify psf/requests | jq

[
  ...
  {
    "file": "setup.py",
    "fileType": "setup.py",
    "oneLiner": "uv run --python '>=3.8.10' --with 'certifi>=2017.4.17,charset_normalizer>=2,<4,idna>=2.5,<4,urllib3>=1.21.1,<3,requests' python -c 'import requests; print(requests)'",
    "uvInstallFromSource": "uv run --with 'git+https://github.com/psf/requests' --python '>=3.8.10' python",
    "dependencies": [
      "certifi>=2017.4.17",
      "charset_normalizer>=2,<4",
      "idna>=2.5,<4",
      "urllib3>=1.21.1,<3"
    ],
    "packageName": "requests",
    "pythonVersion": ">=3.8",
    "isLocal": false
  }
]

Parse all python artifacts in repository:

uvify psf/requests
uvify https://github.com/psf/requests

Parse specific fields in the response

uvify psf/black | jq '.[] | {file: .file, pythonVersion: .pythonVersion, dependencies: .dependencies, packageName: .packageName}'

Use existing python repos with 'uv':

uvify psf/requests | jq '.[0].oneLiner'
"uv run --with 'git+https://github.com/psf/requests' --python '3.11' python"

Install a repository with 'uv' from github sources:

uvify psf/requests | jq '.[0].dependencies'

List the dependencies.

uvify psf/requests | jq '.[].dependencies'
[
  "certifi>=2017.4.17",
  "charset_normalizer>=2,<4",
  "idna>=2.5,<4",
  "urllib3>=1.21.1,<3"
]

Filtering Options

Uvify supports filtering which files to analyze using include and exclude patterns with glob syntax.

Exclude directories from analysis

Skip test directories and any paths matching the pattern:

uvify --exclude "tests/*" --exclude "test_*" my-project/

Include only specific directories

Analyze only files in the src/ directory:

uvify --include "src/*" my-project/

Analyze only a specific subdirectory:

uvify --include "src/my_app/*" my-project/

Combine include and exclude patterns

Include everything in src/ but exclude test files:

uvify --include "src/*" --exclude "*/test_*" --exclude "*/tests/*" my-project/

GitHub repositories with filtering

The filtering also works with GitHub repositories:

# Exclude test directories from a GitHub repo
uvify --exclude "tests/*" psf/requests

# Only analyze specific subdirectories  
uvify --include "src/*" --include "lib/*" myorg/myrepo

Pattern Examples

  • tests/* - Excludes any directory named "tests" and all its contents
  • test_* - Excludes any file or directory starting with "test_"
  • */tests/* - Excludes "tests" directories at any depth
  • src/my_app/* - Includes only files within the "src/my_app/" directory
  • *.py - Includes only Python files

Note: By default, uvify scans all directories for requirements.txt, pyproject.toml, and setup.py files. The include/exclude patterns filter which of these files to analyze based on their path.

Uvify HTTP Server: Using uvify with client/server architecture instead of SDK

First, install uvify with the optional API dependencies:

uv add uvify[api]
# or with pip:
# pip install uvify[api]

Then run the server:

# Run the server using the built-in serve command
uvify serve --host 0.0.0.0 --port 8000

# Or using uvicorn directly
uv run uvicorn src.uvify:api --host 0.0.0.0 --port 8000

# Using curl
curl http://0.0.0.0:8000/psf/requests | jq

# Using wget
wget -O-  http://0.0.0.0:8000/psf/requests | jq

Developing

# Install dependencies (including optional API dependencies)
uv venv
uv sync --dev --extra api
uv run pytest

# Run linter before PR 
./lint.sh

# Install editable version locally
uv run pip install --editable .
uv run python -m src.uvify --help
uv run python -m src.uvify psf/requests

# Run the HTTP API with reload
uv run uvicorn src.uvify:api --host 0.0.0.0 --port 8000 --reload 
# Or use the built-in serve command:
# uv run python -m src.uvify serve --host 0.0.0.0 --port 8000

curl http://0.0.0.0:8000/psf/requests | jq

Special Thanks

Thanks to the UV team and Astral for this amazing tool.

Metadata

Release files for uvify 0.1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for uvify 0.1.7
File Size Uploaded
uvify-0.1.7.tar.gz 10.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for uvify 0.1.7
File Interpreter ABI Platform
uvify-0.1.7-py3-none-any.whl Python 3 none any Details

Total release size: 22.2 kB

Release files / uvify-0.1.7.tar.gz

Download URL uvify-0.1.7.tar.gz
Size 10.6 kB
Tags Source
SHA-256 checksum
How to use checksums
1e2655041bfb228aaa3c0e661412bba08c15cd3ca80110594649f28ccc3447d6
BLAKE2b-256 checksum
How to use checksums
bceff6ea07af98a1162bdf9affbb5395424e3aeae29c7f707fa02cee9b0686e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release files / uvify-0.1.7-py3-none-any.whl

Download URL uvify-0.1.7-py3-none-any.whl
Size 11.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8479ecfc273116416643305e0a43702980f41ee404119ac9d7506583f9e603a5
BLAKE2b-256 checksum
How to use checksums
e826cc19acd25d9a9ff4d23b3263426cb4efe5faeb674f2f44760bacdd233edf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release history Release notifications | RSS feed

This release

0.1.7 This release

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page