PyRequire
A bunch of decorators for checking specific requirements of Python functions at runtime.
Features
- Simple decorators to enforce required Python version or package versions at runtime
- Flexible version specification using standard comparison operators (e.g., >=, <, ==)
- Lightweight, with no runtime dependencies
- Helps ensure reproducibility and compatibility in code execution
Installation
The recommended way to install pyrequire is through the Python Package Index:
pip install pyrequire --user
Otherwise, clone and extract the package, then run from the package location:
pip install . --user
To test the integrity of the installed package, check out this repository and run:
pytest
Examples
from pyrequire import require_package, require_python
@require_python(">=3.9")
@require_package("foo>=1.2.3")
def bar():
return
Metadata
Release files for pyrequire 0.2.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 | |
|---|---|---|---|
| pyrequire-0.2.0.tar.gz | 5.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyrequire-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.2 kB
Release files / pyrequire-0.2.0.tar.gz
| Download URL | pyrequire-0.2.0.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bdee1177066331ee150155a5a53ee8c0ed05913f720a1d2ad704954b382f2177
|
|
BLAKE2b-256 checksum How to use checksums |
43da17758cabb354caf7a7fd5b3c864d294c56a854fceb74305ac44a207f369c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / pyrequire-0.2.0-py3-none-any.whl
| Download URL | pyrequire-0.2.0-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
83debd148e1a8cdc67194067f4fe65ea228bae2372fee36128e02d73e3cc9d1b
|
|
BLAKE2b-256 checksum How to use checksums |
9bd1d6bbf0713c3612b6afa69416420f4baf03427888d2d5cd63b737e250820c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|