Skip to main content

venv-patcher

logo

Apply and track patches to packages installed in a Python virtual environment.

Run Tests Docs codecov Quality Gate Status PyPI License: MIT Python 3.9+

📖 Documentation: https://thorsten-klein.github.io/venv-patcher/

What is venv-patcher?

venv-patcher applies patches to packages in your venv. It remembers what it did. So you can list your patches, and undo them at any time.

venv-patcher apply -f patches.yml   # apply your patches
venv-patcher list                   # see what is patched
venv-patcher reset                  # undo all patches

The patches file says which patch goes to which package:

version: 1
patches:
  - package: requests
    path: patches/0001-fix.patch

It can also be TOML, with Python 3.11 or newer. See example.yml and example.toml.

How does it work?

  • The first time, it turns the package folder into a git repository, and commits the files as they are.
  • It applies each patch with git am (or git apply) as a new commit. Names and dates are fixed, so the commits are the same on every run.
  • It records each result in a manifest in the venv's site-packages.
  • reset goes back to the first commit.

Install

Install it into the venv you want to patch:

pip install venv-patcher

Python 3.9 and git are needed. It does not run outside a venv. Do not install it with pipx or uv tool: it would patch that tool's own venv. See Install venv-patcher.

Documentation

The full documentation is in doc/, and online at https://thorsten-klein.github.io/venv-patcher/.

Contributing

Pull requests are welcome. See Development for the setup and the checks. The short version:

uv sync          # install everything
uv run poe all   # every check CI runs

License

MIT. See LICENSE.

Metadata

Release files for venv-patcher 0.2.0

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

Source distribution (sdist)

Source distribution for venv-patcher 0.2.0
File Size Uploaded Provenance Actions
venv_patcher-0.2.0.tar.gz 190.3 kB With provenance Details for venv_patcher-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for venv-patcher 0.2.0
File Interpreter ABI Platform Actions
venv_patcher-0.2.0-py3-none-any.whl Python 3 none any Details for venv_patcher-0.2.0-py3-none-any.whl

Total release size: 204.5 kB

Release files / venv_patcher-0.2.0.tar.gz

Download URL venv_patcher-0.2.0.tar.gz
Size 190.3 kB
Tags Source
SHA-256 checksum
How to use checksums
f2ecbb66deb5eca130e31a916ce7ac026083358c71a712594eeeebf620a8b65c
BLAKE2b-256 checksum
How to use checksums
f2fda54d9c2d39ea587041aea9b87a7cee8c409829d3ac35d72a94e715080cf4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.

Transparency log

Release files / venv_patcher-0.2.0-py3-none-any.whl

Download URL venv_patcher-0.2.0-py3-none-any.whl
Size 14.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b8e61925c59d88d4326d4ad5e869c1a749e0442853f2261738abc0e007d505f4
BLAKE2b-256 checksum
How to use checksums
961b8713cad5735c7dd95793e134462dd8a61e60993a135ee6e6071c41263227
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.

Transparency log

Security for venv-patcher 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for venv_patcher-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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