Run Python functions in isolated virtualenvs configured by separate requirements files.
Project description
compat-runtime
compat-runtime helps solve Python dependency conflicts by running functions inside
isolated virtual environments created from separate requirements files. It is
useful for compatibility testing, dependency isolation, and reproducing
behavior across multiple dependency versions.
Features
- Decorate a function with
@runtime("requirements.txt"). - Resolve relative requirements paths from the decorated function's source file.
- Cache virtual environments by requirements-file hash.
- Execute worker code through file-based IPC, avoiding command-line length limits.
- Manage cached runtimes with the
compatCLI.
Install
python -m pip install compat-runtime
For local development from a checkout:
python -m pip install -e .[test,release]
Usage
Create an app-specific requirements file:
pydantic==2.5.3
Use it from Python:
from compat import runtime
@runtime("requirements.txt")
def get_pydantic_version():
import pydantic
return pydantic.__version__
print(get_pydantic_version())
Arguments and return values must be picklable. Exceptions raised in the worker
process are surfaced as compat.exceptions.WorkerError with the worker
traceback attached.
Cache Management
compat list
compat invalidate requirements.txt
compat clear
Cache locations follow the host platform:
- Windows:
%LOCALAPPDATA%\compat_runtime\envs - macOS:
~/Library/Caches/compat_runtime/envs - Linux:
$XDG_CACHE_HOME/compat_runtime/envsor~/.compat_runtime/envs
Test
python -m pytest -q
python -m compileall -q compat
Build and Release
python -m build
python -m twine check dist/*
python -m twine upload --repository testpypi dist/*
python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ compat-runtime==0.1.0
python -m twine upload dist/*
Publishing uses standard Twine credentials. Set TWINE_USERNAME=__token__ and
TWINE_PASSWORD=<token> for the target package index before uploading.
Repository
Source code is published at:
https://github.com/tanishqjain123145/Compat
License
MIT
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 compat_runtime-0.1.0.tar.gz.
File metadata
- Download URL: compat_runtime-0.1.0.tar.gz
- Upload date:
- Size: 11.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bfc5035e29c02d557d139f9eefe8980fd859093be024daa2d78f92da655038f7
|
|
| MD5 |
b4eb81f2983596e4dcf21edcece2d717
|
|
| BLAKE2b-256 |
383996d2fae8b8ca43d891a0dd8f41567ee2f113cdba7642157ec7e9446044d6
|
Provenance
The following attestation bundles were made for compat_runtime-0.1.0.tar.gz:
Publisher:
workflow.yml on tanishqjain123145/Compat
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
compat_runtime-0.1.0.tar.gz -
Subject digest:
bfc5035e29c02d557d139f9eefe8980fd859093be024daa2d78f92da655038f7 - Sigstore transparency entry: 1524472677
- Sigstore integration time:
-
Permalink:
tanishqjain123145/Compat@7c98d165c97ebe51e4c3cb3212d8d5c38f827de7 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/tanishqjain123145
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@7c98d165c97ebe51e4c3cb3212d8d5c38f827de7 -
Trigger Event:
push
-
Statement type:
File details
Details for the file compat_runtime-0.1.0-py3-none-any.whl.
File metadata
- Download URL: compat_runtime-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.6 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 |
e015030581452b96b0ced5daa3fc472a84e5aef8ae15b6c2fcaff91187fa88c9
|
|
| MD5 |
54548472155efdf86b5f639002a54fcf
|
|
| BLAKE2b-256 |
34a8663311bf9d0d155f135e79e84bc3cef5e11572bb182d67ca2edbc63c1e1f
|
Provenance
The following attestation bundles were made for compat_runtime-0.1.0-py3-none-any.whl:
Publisher:
workflow.yml on tanishqjain123145/Compat
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
compat_runtime-0.1.0-py3-none-any.whl -
Subject digest:
e015030581452b96b0ced5daa3fc472a84e5aef8ae15b6c2fcaff91187fa88c9 - Sigstore transparency entry: 1524472701
- Sigstore integration time:
-
Permalink:
tanishqjain123145/Compat@7c98d165c97ebe51e4c3cb3212d8d5c38f827de7 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/tanishqjain123145
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@7c98d165c97ebe51e4c3cb3212d8d5c38f827de7 -
Trigger Event:
push
-
Statement type: