Skip to main content

A bunch of decorators for checking specific requirements of Python functions at runtime

Project description

PyRequire

License Stars Pyversions Version Downloads Code style: black

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyrequire-0.2.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyrequire-0.2.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file pyrequire-0.2.0.tar.gz.

File metadata

  • Download URL: pyrequire-0.2.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for pyrequire-0.2.0.tar.gz
Algorithm Hash digest
SHA256 bdee1177066331ee150155a5a53ee8c0ed05913f720a1d2ad704954b382f2177
MD5 4f1a6b155dfc99414c2a34e8baa925d0
BLAKE2b-256 43da17758cabb354caf7a7fd5b3c864d294c56a854fceb74305ac44a207f369c

See more details on using hashes here.

File details

Details for the file pyrequire-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pyrequire-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for pyrequire-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 83debd148e1a8cdc67194067f4fe65ea228bae2372fee36128e02d73e3cc9d1b
MD5 8c281bfc7d367e2b599d6173daa07eb1
BLAKE2b-256 9bd1d6bbf0713c3612b6afa69416420f4baf03427888d2d5cd63b737e250820c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page