Skip to main content

Runtime typechecking debugging module.

Project description

Release status PyPI package Supported Python versions Build Status Coverage Status Documentation Status Pypi downloads Pypi downloads

pyoload

This adds some runtime type checking and warnings when enabled. It is disabled by default.

Pyoload permits you to add runtime checking to classes on instance attribute assignment and functions.

usage

pyoload provides two basic methods:

  • pyoload.annotate: decorator over functions or methods.
  • pyoload.annotate_class: decorator over classes. All wrapped by pyoload() which checks what to be called.
import pyoload

pyoload.debug()

@pyoload
def foo(a: int, b, c: str) -> tuple[str, int]:
    return ("ab", 23)

@pyoload
class myclass:
    pass

pyolaod modes

Pyoload includes three modes of enum type pyoload.Mode and where the current mode is in pyoload.MODE.

  • DEBUG: Shows warnings, comments, exceptions activate via pyoload.debug()
  • DEV : Does not call upon validatore
  • PROD(DEFAULT): @pyoload simply does nothing.

Adding validators

You may add validators to check values furthermore.

def validator(value) -> Optional[str]:
    if value.is_ok():
        return None
    else:
        return "Value is not Ok! pass a value which is Ok please."

@pyoload(comments=dict(val=validator))
def func(val):
    pass

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

pyoload-3.0.0.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

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

pyoload-3.0.0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file pyoload-3.0.0.tar.gz.

File metadata

  • Download URL: pyoload-3.0.0.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.8

File hashes

Hashes for pyoload-3.0.0.tar.gz
Algorithm Hash digest
SHA256 1026f6981f47d91e4e70562232fa38759a5fdf924e5ce913fe3c1cbaf819830a
MD5 d7337b087b610f963c4166209f851637
BLAKE2b-256 1e2d7fbe1c023d294976f8bc0d20f244cb8b7cacd8a4b4de42fc6853d7d96c3b

See more details on using hashes here.

File details

Details for the file pyoload-3.0.0-py3-none-any.whl.

File metadata

  • Download URL: pyoload-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.8

File hashes

Hashes for pyoload-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eb3a4f5f968392a9bf9dada23322df05cc31627b119a3837651c24923e190e56
MD5 8b889141be16cba751325cb483fee1d3
BLAKE2b-256 fc5008d5ca87a02190303f59d47b9f17cc0d08d7814510c38a055fc53444e6b2

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