Skip to main content

Get one-liner commands for faster python environment uv python manager.

Project description

Uvify

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

  • Generates oneliners for setting up python environment from pypi / from soure, and lists the dependencies.
  • It works based on: requirements.txt, pyproject.toml or setup.py, recursively.
  • It's fast!

uv is by far the fastest python and package manager.

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

Command Line: Using uvify CLI locally

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

uv run --with uvify uvify https://github.com/psf/requests | jq
# or:
# uv run --with uvify 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"
]

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

I chose to use GitIngest behind the scenes. Thanks to the UV team and Astral for this amazing tool.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

uvify-0.1.2.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

uvify-0.1.2-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file uvify-0.1.2.tar.gz.

File metadata

  • Download URL: uvify-0.1.2.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.18

File hashes

Hashes for uvify-0.1.2.tar.gz
Algorithm Hash digest
SHA256 ed48d31494b70765c1a571ab482d817739755ee4aeac5b25429f42f10259aa76
MD5 e58665bee2e9f6852955ab1c5725c911
BLAKE2b-256 ab0daf081b5b470228290548136b8d2cf4e0a46ea1345600d3e8fdec257a0a3c

See more details on using hashes here.

File details

Details for the file uvify-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: uvify-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.18

File hashes

Hashes for uvify-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d4e795a58b04fc8680ca498fc792f20c20146988161b6d7fde2a381b12468ebe
MD5 45e8766ce502098f3a3c7801d85c47b9
BLAKE2b-256 c8efba0d6ed9d75b8db6add6f0d705ef59757d0ba7877d80f8c4d3439f621735

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page