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.1.tar.gz (19.1 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.1-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: uvpy-0.1.1.tar.gz
  • Upload date:
  • Size: 19.1 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.1.tar.gz
Algorithm Hash digest
SHA256 4f2ae72b04d5e3e5e2fdf3e01335f61a82b05760bf7e710d9052eee1feb72b4d
MD5 0da127104ac01ae8aa0123a1d42f8334
BLAKE2b-256 de9ac2c3c8c1c8dd48286c98f99139522a52159c6787e72366d49515811dab08

See more details on using hashes here.

File details

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

File metadata

  • Download URL: uvpy-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 21.0 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a4ad4f6465770bc173ab90c2bbfb3054959c39f0de1eef1c3671b5778619be93
MD5 55c6056206e981c5324e4305a0fbe968
BLAKE2b-256 ca65b3b52722d67071cd4f831ba986b07b5b2b985af434e406e35036c90d990c

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