Skip to main content

Easily toggle between development and production packages with uv. Quickly close development packages locally.

Project description

Release Notes Downloads GitHub CI Status License: MIT

Python Uv Development Package Toggler

A utility script for easily switching between local development and published sources for Python packages in your pyproject.toml. Here's the original issue which spawned this project.

Here's a quick video demonstration of how to use the tool:

How to Toggle Between PyPi and Git Package Versions

Features

  • Automatically toggles between local development paths and GitHub sources
  • Preserves TOML file comments and structure
  • Automatically clones repositories when switching to local development
  • Supports branch tracking
  • Falls back to PyPI metadata if direct GitHub repository is not found
  • Integrates with GitHub CLI for username detection
  • Creates necessary TOML structure (tool.uv.sources) if it doesn't exist
  • Automatically runs uv sync --upgrade-package after successful updates

Installation

uv add --dev uv-development-toggle

uv tool install uv-development-toggle

Usage

To toggle a package activemodel:

uv-development-toggle activemodel --local

Then, after you push to a custom branch, reference the branch in your pyproject.toml:

uv-development-toggle activemodel --git

To revert a package to PyPI:

uv-development-toggle activemodel --pypi

This will:

  1. Check if the package exists in your PYTHON_DEVELOPMENT_TOGGLE directory
  2. If switching to local and the repository doesn't exist, clone it automatically (attempts to determine the repo URL from pypi information)
  3. Update your pyproject.toml with the appropriate source configuration (creating the tool.uv.sources structure if needed)
  4. Preserve any existing branch information when toggling
  5. Automatically run uv sync --upgrade-package <package_name> to apply the changes

Arguments

  • MODULE_NAME: The name of the Python module to toggle
  • --local: Force using local development path
  • --git: Force using git source
  • --pypi: Revert to default PyPI source

Environment Variables

  • PYTHON_DEVELOPMENT_TOGGLE: Directory for local development repositories (default: "pypi")

This project was created from iloveitaly/python-package-template

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

uv_development_toggle-0.6.4.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

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

uv_development_toggle-0.6.4-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file uv_development_toggle-0.6.4.tar.gz.

File metadata

  • Download URL: uv_development_toggle-0.6.4.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for uv_development_toggle-0.6.4.tar.gz
Algorithm Hash digest
SHA256 4775322206de45630ba0c3deef8d7e32f545cf3ba2d6b8e0719708be80cc5ed3
MD5 68f29d269a48f9d451b3151a56f42c4b
BLAKE2b-256 99e9c0e3cd4d9110e361d70175609295eb973d4692aa7cb1619d59233716473c

See more details on using hashes here.

File details

Details for the file uv_development_toggle-0.6.4-py3-none-any.whl.

File metadata

  • Download URL: uv_development_toggle-0.6.4-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for uv_development_toggle-0.6.4-py3-none-any.whl
Algorithm Hash digest
SHA256 7d43541964f2dcdd33c6b1d235cd00dd93d0664c3def270d41a35dab1e582b4b
MD5 3a13b995402d276e1a73b3c9d107d22e
BLAKE2b-256 6c507dd1752fde995f4c6a891ca0c1b92aab987fced54644b56782a775e9b051

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