venvsnap
Snapshot a Python virtual environment into a lockfile, then restore it from a local cache. Once the wheels are cached, restoring an env doesn't touch PyPI.
Install
Once published to PyPI:
pip install venvsnap
Until then, install straight from GitHub:
pip install git+https://github.com/VKSFY/venvsnap.git
Requires Python 3.9 or newer.
Usage
In a working venv:
venvsnap snapshot
This walks pip list, looks each package up on PyPI to find a wheel matching
the current platform, and writes the result to venvsnap.lock (TOML). Check
the lockfile in.
On another machine, in CI, or in a fresh clone:
venvsnap restore
This reads the lockfile, downloads any wheels that aren't already in
~/.venvsnap/cache/, creates .venv if needed, and installs everything with
pip install --no-deps --no-index. After the first run for a given lockfile,
no network is involved.
The cache is shared across projects. The first time requests-2.31.0-py3-none-any.whl
gets downloaded, every other project that pins the same wheel reuses the same file.
Other commands
venvsnap verify compare a venv against a lockfile, report drift
venvsnap cache info show the cache path and size
venvsnap cache clean delete every wheel from the cache
--help on any command lists its flags.
Lockfile
venvsnap.lock is plain TOML. A two-package example:
version = 1
python_version = "3.11.7"
platform = "linux-x86_64"
created_at = "2026-04-25T12:34:56Z"
[[package]]
name = "requests"
version = "2.31.0"
sha256 = "58cd2187c01e70e6e26505bca751777aa9f2ee0b7f4300988b709f44e013003f"
wheel_filename = "requests-2.31.0-py3-none-any.whl"
wheel_url = "https://files.pythonhosted.org/packages/.../requests-2.31.0-py3-none-any.whl"
requires_python = ">=3.7"
[[package]]
name = "rich"
version = "13.7.0"
...
Diffs are readable: a dependency bump shows up as one version/sha256/wheel_url
change.
Cache layout
~/.venvsnap/cache/wheels/<aa>/<sha256>/<filename>.whl
<aa> is the first two hex chars of the sha256, used as a bucket so directories
stay shallow on case-insensitive filesystems. Override with --cache PATH on
any command.
How it compares
pip install -r requirements.txt re-resolves dependencies and consults PyPI on
every run. venvsnap skips the resolver. With a warm cache, restore is wheel
copies plus one pip install invocation.
uv is a faster pip with a real resolver. venvsnap doesn't replace either: use
pip or uv to build the env, then venvsnap snapshot to record it. They compose
fine.
pip-tools writes a pinned requirements file. Install still goes through the
index. venvsnap stores the wheels themselves.
Limits
- Wheels only. If a package only ships an sdist, snapshot warns and skips it.
- PyPI only. Private indexes are not supported in 0.1.
- No resolver. venvsnap captures whatever is already installed; building the env is somebody else's job.
Benchmark
examples/benchmark.py installs a small dependency set with pip install -r,
then runs venvsnap restore cold and warm, and prints the times. Numbers vary
with bandwidth and hardware, so run it locally.
python examples/benchmark.py
Development
git clone https://github.com/VKSFY/venvsnap
cd venvsnap
python -m venv .venv
.venv/bin/pip install -e ".[dev]"
.venv/bin/pytest
ruff check, ruff format --check, mypy src, and pytest all run in CI on
push.
License
MIT. See LICENSE.
Metadata
Release files for venvsnap 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| venvsnap-0.1.0.tar.gz | 17.0 kB | With provenance | Details for venvsnap-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| venvsnap-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for venvsnap-0.1.0-py3-none-any.whl |
Total release size: 32.7 kB
Release files / venvsnap-0.1.0.tar.gz
| Download URL | venvsnap-0.1.0.tar.gz |
|---|---|
| Size | 17.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eb784685db736fb9023c9ac72ab0d511b3f58f0fb417729a8b71793b95e19ddb
|
|
BLAKE2b-256 checksum How to use checksums |
5d808b83bbc9fe6fbeeb335db787890b8fe334c3e241e4b593e748299ed1aa2e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 May 3, 2026.
Transparency logRelease files / venvsnap-0.1.0-py3-none-any.whl
| Download URL | venvsnap-0.1.0-py3-none-any.whl |
|---|---|
| Size | 15.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6dcc234fa057a7c09ee65ece71569e9fa062d7d055fed3059f2f476696a80d8d
|
|
BLAKE2b-256 checksum How to use checksums |
c83afae109f682ea7a40e16d0b442ae94322a3b6628eb3a59d57f66717b7cad1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 May 3, 2026.
Transparency logSecurity for venvsnap 0.1.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
Both files in this release have been uploaded with provenance metadata.
Attestation for venvsnap-0.1.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 May 3, 2026.
Transparency logA 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.