Reuse installed Python packages from existing virtual environments.
Project description
PKGReuse
PKGReuse is an explicit Windows and Linux command-line wrapper that reuses compatible Python distributions already installed in other virtual environments. It can avoid downloading and unpacking a package when a safe local donor is available.
PKGReuse does not replace or intercept ordinary pip and uv commands. Local
reuse is enabled only when you invoke the pkgreuse command.
PKGReuse 0.1 is alpha software. Use it in disposable virtual environments until its behavior has been validated for your workflow.
How resolution works
For a requirement such as filelock>=3,<4, PKGReuse scans its local environment
index, filters locally installed versions against the requirement, and selects
the highest satisfying local version. It delegates the original requirement to
pip or uv only when the complete dependency closure cannot be reused locally.
It does not query PyPI to maximize a locally satisfiable requirement.
Installation
py -m pip install pkgreuse
Run PKGReuse from an active standard Python virtual environment.
Usage
Use pip as the fallback installer:
pkgreuse pip install "requests>=2.31,<3"
Or use uv as the fallback installer:
pkgreuse uv pip install "requests>=2.31,<3"
On the first prefixed installation, PKGReuse automatically creates its local
environment index. It scans every local fixed-drive root on Windows and / on
Linux, while pruning operating-system trees and skipping inaccessible paths.
Manual initialization with narrower roots is optional and can make discovery
faster on very large filesystems:
pkgreuse init C:\Users\you\Desktop
pkgreuse init "$HOME/projects" /opt
Useful diagnostic and planning commands include:
pkgreuse status
pkgreuse find requests
pkgreuse resolve "requests>=2.31,<3"
Safety model
PKGReuse validates the complete local dependency plan before changing the
target. Package content may be hard-linked on the same volume, while
distribution metadata is copied. It rejects stale donors, target conflicts,
unsafe RECORD traversal, executable or donor-specific .pth files, and
editable installations. Donor launchers are not copied. If transfer or final
validation fails, files created by the transaction are rolled back.
Development
py -m venv .venv
.\.venv\Scripts\python.exe -m pip install -e ".[dev]"
.\scripts\check-release.ps1
On Linux, run the equivalent checks directly:
python -m venv .venv
.venv/bin/python -m pip install -e '.[dev]'
.venv/bin/python -m ruff check .
.venv/bin/python -m ruff format --check .
.venv/bin/python -m mypy
.venv/bin/python -m pytest --cov=pkgreuse
The native NumPy check is opt-in because it requires a prepared compatible donor environment:
$env:PKGREUSE_NUMPY_REQUIREMENT = "numpy==2.3.3"
.\.venv\Scripts\python.exe -m pytest -m extended tests\extended\test_numpy_manual.py
See the resolution notes for the solver's local-maximization semantics.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pkgreuse-0.1.1.tar.gz.
File metadata
- Download URL: pkgreuse-0.1.1.tar.gz
- Upload date:
- Size: 50.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9599a8f30196b78352da24226eb4e2e010c0790be3926c3b4c57a518a00aef83
|
|
| MD5 |
f86a607f5e29216d8f627b039332d9eb
|
|
| BLAKE2b-256 |
b78c63f705fb6724805821c9406e1484cb351c1ad8fbdd237be2af820146ac85
|
Provenance
The following attestation bundles were made for pkgreuse-0.1.1.tar.gz:
Publisher:
publish.yml on khalilurehman-masood/pkgreuse
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pkgreuse-0.1.1.tar.gz -
Subject digest:
9599a8f30196b78352da24226eb4e2e010c0790be3926c3b4c57a518a00aef83 - Sigstore transparency entry: 2190458576
- Sigstore integration time:
-
Permalink:
khalilurehman-masood/pkgreuse@9d4e565ed5346ebbaeeb4d23ca5ae113526527d1 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/khalilurehman-masood
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9d4e565ed5346ebbaeeb4d23ca5ae113526527d1 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pkgreuse-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pkgreuse-0.1.1-py3-none-any.whl
- Upload date:
- Size: 48.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60d57cdbb3a3096dc393f56288c0f7faaa41b88eddc54014cb95c8f2b41dd3e5
|
|
| MD5 |
d5978ecf78d5617037d8e958ed60175e
|
|
| BLAKE2b-256 |
9c9ca16ca7f8ddacb91a1c45d14613f96cb9398d958dbb12413f13eacf686780
|
Provenance
The following attestation bundles were made for pkgreuse-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on khalilurehman-masood/pkgreuse
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pkgreuse-0.1.1-py3-none-any.whl -
Subject digest:
60d57cdbb3a3096dc393f56288c0f7faaa41b88eddc54014cb95c8f2b41dd3e5 - Sigstore transparency entry: 2190458585
- Sigstore integration time:
-
Permalink:
khalilurehman-masood/pkgreuse@9d4e565ed5346ebbaeeb4d23ca5ae113526527d1 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/khalilurehman-masood
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9d4e565ed5346ebbaeeb4d23ca5ae113526527d1 -
Trigger Event:
push
-
Statement type: