compat-runtime
Run individual Python functions inside isolated virtual environments, each with
its own requirements.txt.
compat-runtime is built for real dependency-conflict situations: testing a
function against multiple library versions, isolating a risky dependency, or
reproducing behavior from an older dependency stack without changing your main
application environment.
Install the package as compat-runtime, then import it as compat.
python -m pip install compat-runtime
from compat import runtime
Quick Start
Create a requirements file next to your Python module:
pydantic==2.5.3
Decorate the function that should run in that dependency environment:
from compat import runtime
@runtime("requirements.txt")
def get_pydantic_version():
import pydantic
return pydantic.__version__
print(get_pydantic_version())
On first call, compat-runtime creates a cached virtual environment, installs
the requirements, runs the function in a worker process, and returns the result
to your main Python process. Later calls reuse the cached environment.
Why Use It?
- Test one codebase against old and new dependency versions.
- Keep conflicting dependencies out of your main environment.
- Reproduce production or legacy behavior from a pinned requirements file.
- Run dependency-heavy code only where it is needed.
- Avoid command-line length limits by using file-based IPC internally.
Path Resolution
Relative requirements paths are resolved from the decorated function's source file first, then from the current working directory. This means code can be run from another directory and still find the right requirements file.
@runtime("runtimes/pydantic-v1.txt")
def parse_with_old_pydantic(data):
import pydantic
return pydantic.__version__
Return Values and Errors
Arguments and return values must be picklable because calls cross a process boundary.
If the worker function raises an exception, the host process receives
compat.exceptions.WorkerError with the original exception type and worker
traceback attached.
CLI
Use the compat command to inspect and manage cached runtimes:
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
Development
python -m pip install -e .[test,release]
python -m pytest -q
python -m compileall -q compat
Build and validate release artifacts:
python -m build
python -m twine check dist/*
Publishing
This project is published from GitHub Actions using PyPI Trusted Publishing.
Creating and pushing a version tag such as v0.1.1 runs the release workflow.
Verify an uploaded release with:
python -m pip install compat-runtime==0.1.1
python -c "import compat; print(compat.__version__)"
Repository
Source code is available at:
https://github.com/tanishqjain123145/Compat
License
MIT
Metadata
Release files for compat-runtime 0.1.1
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 |
|---|---|---|---|---|
| compat_runtime-0.1.1.tar.gz | 11.7 kB | With provenance | Details for compat_runtime-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| compat_runtime-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for compat_runtime-0.1.1-py3-none-any.whl |
Total release size: 24.8 kB
Release files / compat_runtime-0.1.1.tar.gz
| Download URL | compat_runtime-0.1.1.tar.gz |
|---|---|
| Size | 11.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2bdcadb14e3b87dd4a1e55a336c7c6d25460571894df8569166a6bbd9dd38cc3
|
|
BLAKE2b-256 checksum How to use checksums |
45a6a5ba1f6787119d4c4f476668618f866f6f16c5ccd4307284d69a84037af3
|
| 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 13, 2026.
Transparency logRelease files / compat_runtime-0.1.1-py3-none-any.whl
| Download URL | compat_runtime-0.1.1-py3-none-any.whl |
|---|---|
| Size | 13.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1893dbe65fc68098bfd342ae9dbd32e5ac34c73a9fd28e2c0fa03c70104f157f
|
|
BLAKE2b-256 checksum How to use checksums |
d154207ba47462de3547ab95a69c51604ab7ac3e796597d32b96fa08e71bdaf7
|
| 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 13, 2026.
Transparency logSecurity for compat-runtime 0.1.1
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 compat_runtime-0.1.1.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 13, 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.