Metadata-Version: 2.2
Name: pyoload
Version: 3.0.0
Summary: Runtime typechecking debugging module.
Author-email: Engon Ken Morel <engonken8@gmail.com>
Maintainer-email: Engon Ken Morel <engonken8@gmail.com>
License: Copyright 2024 ken-morel
        
        Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
        
Project-URL: Homepage, https://github.com/ken-morel/pyoload
Project-URL: Repository, https://github.com/ken-morel/pyoload.git
Project-URL: Issues, https://github.com/ken-morel/pyoload/issues
Keywords: annotations,pyoload,debug
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Description-Content-Type: text/markdown
License-File: LICENSE

[![Release status](https://github.com/ken-morel/pyoload/actions/workflows/python-publish.yml/badge.svg)](https://github.com/ken-morel/pyoload/releases)
[![PyPI package](https://badge.fury.io/py/pyoload.svg)](https://pypi.org/project/pyoload)
[![Supported Python versions](https://img.shields.io/pypi/pyversions/pyoload)](https://pypi.org/project/pyoload)
[![Build Status](https://github.com/ken-morel/pyoload/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/ken-morel/pyoload/tree/mai)
[![Coverage Status](https://coveralls.io/repos/github/ken-morel/pyoload/badge.svg?branch=main&cache=3000)](https://coveralls.io/github/ken-morel/pyoload?branch=main)
[![Documentation Status](https://readthedocs.org/projects/pyoload/badge/?version=latest)](https://pyoload.readthedocs.io)
[![Pypi downloads](https://img.shields.io/pypi/dd/pyoload)](https://pypi.org/project/pyoload)
[![Pypi downloads](https://img.shields.io/pypi/dw/pyoload)](https://pypi.org/project/pyoload)

# 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.

```py
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.

```py
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
```
