Skip to main content

Portable Python App Framework with isolated venvs via uv

Project description

uvpy - Portable Python App Framework

Version 0.1.0 | Python 3.12

A fully portable, offline-capable CLI framework for modular Python apps.

Features

  • Portable: Bundled Python, no system dependencies
  • Offline: All packages from local pypi/ mirror
  • Isolated: Each app has its own venv (via uv)
  • Secure: Sandbox - localhost only, no telemetry
  • Modular: Apps as plugins in apps/

Dual Mode Operation

uvpy supports two modes:

  1. Portable Mode: With bundled Python, uv binary, and offline packages
  2. Installed Mode: pip install uvpy - uses system Python, apps from ./apps/

Quickstart

Portable Mode

# 1. Install portable Python (once)
curl -LO https://github.com/indygreg/python-build-standalone/releases/download/20240224/cpython-3.12.2+20240224-x86_64-unknown-linux-gnu-install_only.tar.gz
tar xzf cpython-*.tar.gz

# 2. Run an app
./uvpy hello
./uvpy --list-apps

Installed Mode

pip install uvpy
uvpy --list-apps
uvpy hello

Structure

uvpy/
├── uvpy             # Launcher (Linux/macOS)
├── uvpy.bat         # Launcher (Windows)
├── src/uvpy/        # Package source
├── python/          # Portable Python 3.12
├── apps/            # App modules
├── pypi/            # Offline packages (.whl)
└── bin/             # uv binary

Commands

./uvpy --help              # Help
./uvpy --list-apps         # List apps
./uvpy <app>               # Run app

# Portable mode only:
./uvpy venv --list         # Show venv status
./uvpy venv <app>          # Create venv (offline)
./uvpy venv <app> --online # Create venv (online)

./uvpy download --list     # Show packages in pypi/
./uvpy download --online numpy pandas  # Download packages

Creating a New App

mkdir -p apps/myapp

apps/myapp/manifest.json:

{
  "name": "myapp",
  "version": "1.0.0",
  "description": "My application"
}

apps/myapp/pyproject.toml:

[project]
name = "myapp"
version = "1.0.0"
dependencies = ["numpy==1.26.4"]

apps/myapp/main.py:

def register(subparser):
    subparser.add_argument("--name", default="World")

def run(args):
    import numpy as np
    print(f"Hello {args.name}! NumPy version: {np.__version__}")
    return 0
./uvpy venv myapp    # Create venv
./uvpy myapp         # Run app

Security Sandbox

uvpy includes a security sandbox that:

  • Blocks all network connections except localhost
  • Disables telemetry (Streamlit, Matplotlib, etc.)
  • Sets headless backends for GUI libraries
from uvpy import activate_sandbox
activate_sandbox()

License

MIT License - see LICENSE

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

uvpy-0.1.0.tar.gz (19.0 kB view details)

Uploaded Source

Built Distribution

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

uvpy-0.1.0-py3-none-any.whl (20.9 kB view details)

Uploaded Python 3

File details

Details for the file uvpy-0.1.0.tar.gz.

File metadata

  • Download URL: uvpy-0.1.0.tar.gz
  • Upload date:
  • Size: 19.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for uvpy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 dfd2e5e632d5bb8e5dc450b5455e5dafd8a0d4df39fc2354b33288b86e8e94a3
MD5 a761c2f757ab967f4fac70ea9dff4500
BLAKE2b-256 62fe429f282fb8fffa162c4e00e74d709ca4338138f78215aaa118f0e9db47b6

See more details on using hashes here.

File details

Details for the file uvpy-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: uvpy-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 20.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for uvpy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7b5523fb83d0d5dab1b9b60a506a48ec4c253f27eb3314a3ada18ca52b1f171d
MD5 9dd410de280e830acc4282e04df7a283
BLAKE2b-256 04b9fa64eb0564dcfc95e1c51e3e9c3e9b93157a6b30d0ce815d335129234860

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