pedantic


Namepedantic JSON
Version 2.1.8 PyPI version JSON
download
home_pagehttps://github.com/LostInDarkMath/pedantic-python-decorators
SummarySome useful Python decorators for cleaner software development.
upload_time2024-12-04 13:30:34
maintainerWilli Sontopski
docs_urlNone
authorWilli Sontopski
requires_python>=3.11.0
licenseApache-2.0 License
keywords decorators tools helpers type-checking pedantic type annotations
VCS
bugtrack_url
requirements docstring-parser Flask multiprocess Werkzeug
Travis-CI No Travis.
coveralls test coverage
            # pedantic-python-decorators [![Build Status](https://travis-ci.com/LostInDarkMath/pedantic-python-decorators.svg?branch=master)](https://travis-ci.com/LostInDarkMath/pedantic-python-decorators)  [![Coverage Status](https://coveralls.io/repos/github/LostInDarkMath/pedantic-python-decorators/badge.svg?branch=master)](https://coveralls.io/github/LostInDarkMath/pedantic-python-decorators?branch=master) [![PyPI version](https://badge.fury.io/py/pedantic.svg)](https://badge.fury.io/py/pedantic) [![Conda Version](https://img.shields.io/conda/vn/conda-forge/pedantic.svg)](https://anaconda.org/conda-forge/pedantic) [![Last Commit](https://badgen.net/github/last-commit/LostInDarkMath/pedantic-python-decorators?color=green)](https://GitHub.com/LostInDarkMath/pedantic-python-decorators) [![Stars](https://badgen.net/github/stars/LostInDarkMath/pedantic-python-decorators?color=green)](https://GitHub.com/LostInDarkMath/pedantic-python-decorators) [![Open Issues](https://badgen.net/github/open-issues/LostInDarkMath/pedantic-python-decorators?color=green)](https://GitHub.com/LostInDarkMath/pedantic-python-decorators/issues) [![Open PRs](https://badgen.net/github/open-prs/LostInDarkMath/pedantic-python-decorators?color=green)](https://GitHub.com/LostInDarkMath/pedantic-python-decorators/pulls)

This packages includes many decorators that will make you write cleaner Python code. 

## Getting Started
This package requires Python 3.11 or later.
There are multiple options for installing this package.

### Option 1: Installing with pip from [Pypi](https://pypi.org/)
Run `pip install pedantic`.

### Option 2: Installing with conda from [conda-forge](conda-forge.org)
Run `conda install -c conda-forge pedantic`

### Option 3: Installing with pip and git
1. Install [Git](https://git-scm.com/downloads) if you don't have it already.
2. Run `pip install git+https://github.com/LostInDarkMath/pedantic-python-decorators.git@master`

### Option 4: Offline installation using wheel
1. Download the [latest release here](https://github.com/LostInDarkMath/PythonHelpers/releases/latest) by clicking on `pedantic-python-decorators-x.y.z-py-none-any.whl`.
2. Execute `pip install pedantic-python-decorators-x.y.z-py3-none-any.whl`.

## The [@pedantic](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/method_decorators.html#pedantic.method_decorators.pedantic) decorator - Type checking at runtime
The `@pedantic` decorator does the following things:
- The decorated function can only be called by using keyword arguments. Positional arguments are not accepted.
- The decorated function must have [type annotations](https://docs.python.org/3/library/typing.html).
- Each time the decorated function is called, pedantic checks that the passed arguments and the return value of the function matches the given type annotations. 
As a consequence, the arguments are also checked for `None`, because `None` is only a valid argument, if it is annotated via `typing.Optional`.

In a nutshell:
`@pedantic` raises an `PedanticException` if one of the following happened:
- The decorated function is called with positional arguments.
- The function has no type annotation for their return type or one or more parameters do not have type annotations.
- A type annotation is incorrect.
- A type annotation misses type arguments, e.g. `typing.List` instead of `typing.List[int]`.

### Minimal example
```python
from pedantic import pedantic


@pedantic
def get_sum_of(values: list[int | float]) -> int:
    return sum(values)

get_sum_of(values=[0, 1.2, 3, 5.4])  # this raises the following runtime error: 
# Type hint of return value is incorrect: Expected type <class 'int'> but 10.0 of type <class 'float'> was the return value which does not match.
```


## The [@validate]() decorator
As the name suggests, with `@validate` you are able to validate the values that are passed to the decorated function.
That is done in a highly customizable way. 
But the highest benefit of this decorator is that it makes it extremely easy to write decoupled easy testable, maintainable and scalable code.
The following example shows the decoupled implementation of a configurable algorithm with the help of `@validate`:
```python
import os
from dataclasses import dataclass

from pedantic import validate, ExternalParameter, overrides, Validator, Parameter, Min, ReturnAs


@dataclass(frozen=True)
class Configuration:
    iterations: int
    max_error: float


class ConfigurationValidator(Validator):
    @overrides(Validator)
    def validate(self, value: Configuration) -> Configuration:
        if value.iterations < 1 or value.max_error < 0:
            self.raise_exception(msg=f'Invalid configuration: {value}', value=value)

        return value


class ConfigFromEnvVar(ExternalParameter):
    """ Reads the configuration from environment variables. """

    @overrides(ExternalParameter)
    def has_value(self) -> bool:
        return 'iterations' in os.environ and 'max_error' in os.environ

    @overrides(ExternalParameter)
    def load_value(self) -> Configuration:
        return Configuration(
            iterations=int(os.environ['iterations']),
            max_error=float(os.environ['max_error']),
        )


class ConfigFromFile(ExternalParameter):
    """ Reads the configuration from a config file. """

    @overrides(ExternalParameter)
    def has_value(self) -> bool:
        return os.path.isfile('config.csv')

    @overrides(ExternalParameter)
    def load_value(self) -> Configuration:
        with open(file='config.csv', mode='r') as file:
            content = file.readlines()
            return Configuration(
                iterations=int(content[0].strip('\n')),
                max_error=float(content[1]),
            )


# choose your configuration source here:
@validate(ConfigFromEnvVar(name='config', validators=[ConfigurationValidator()]), strict=False, return_as=ReturnAs.KWARGS_WITH_NONE)
# @validate(ConfigFromFile(name='config', validators=[ConfigurationValidator()]), strict=False)

# with strict_mode = True (which is the default)
# you need to pass a Parameter for each parameter of the decorated function
# @validate(
#     Parameter(name='value', validators=[Min(5, include_boundary=False)]),
#     ConfigFromFile(name='config', validators=[ConfigurationValidator()]),
# )
def my_algorithm(value: float, config: Configuration) -> float:
    """
        This method calculates something that depends on the given value with considering the configuration.
        Note how well this small piece of code is designed:
            - Fhe function my_algorithm() need a Configuration but has no knowledge where this come from.
            - Furthermore, it doesn't care about parameter validation.
            - The ConfigurationValidator doesn't know anything about the creation of the data.
            - The @validate decorator is the only you need to change, if you want a different configuration source.
    """
    print(value)
    print(config)
    return value


if __name__ == '__main__':
    # we can call the function with a config like there is no decorator.
    # This makes testing extremely easy: no config files, no environment variables or stuff like that
    print(my_algorithm(value=2, config=Configuration(iterations=3, max_error=4.4)))

    os.environ['iterations'] = '12'
    os.environ['max_error'] = '3.1415'

    # but we also can omit the config and load it implicitly by our custom Parameters
    print(my_algorithm(value=42.0))
```

## List of all decorators in this package
- [@count_calls](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/decorators/fn_deco_count_calls.html)
- [@deprecated](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/decorators/fn_deco_deprecated.html)
- [@does_same_as_function](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/decorators/fn_deco_does_same_as_function.html)
- [@frozen_dataclass](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/decorators/cls_deco_frozen_dataclass.html#pedantic.decorators.cls_deco_frozen_dataclass.frozen_dataclass)
- [@frozen_type_safe_dataclass](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/decorators/cls_deco_frozen_dataclass.html#pedantic.decorators.cls_deco_frozen_dataclass.frozen_type_safe_dataclass)
- [@for_all_methods](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/decorators/class_decorators.html#pedantic.decorators.class_decorators.for_all_methods)
- [@in_subprocess](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/decorators/fn_deco_in_subprocess.html)
- [@mock](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/decorators/fn_deco_mock.html)
- [@overrides](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/decorators/fn_deco_overrides.html)
- [@pedantic](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/decorators/fn_deco_pedantic.html#pedantic.decorators.fn_deco_pedantic.pedantic)
- [@pedantic_class](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/decorators/class_decorators.html#pedantic.decorators.class_decorators.pedantic_class)
- [@rename_kwargs](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/decorators/fn_deco_rename_kwargs.html)
- [@require_kwargs](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/decorators/fn_deco_require_kwargs.html)
- [@retry](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/decorators/fn_deco_retry.html)
- [@timer](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/decorators/fn_deco_timer.html)
- [@timer_class](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/decorators/class_decorators.html#pedantic.decorators.class_decorators.timer_class)
- [@trace](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/decorators/fn_deco_trace.html)
- [@trace_class](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/decorators/class_decorators.html#pedantic.decorators.class_decorators.trace_class)
- [@trace_if_returns](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/decorators/fn_deco_trace_if_returns.html)
- [@unimplemented](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/decorators/fn_deco_unimplemented.html)
- [@validate](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/decorators/fn_deco_validate/fn_deco_validate.html)

## List of all mixins in this package
- [GenericMixin](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/mixins/generic_mixin.html)
- [WithDecoratedMethods](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/mixins/with_decorated_methods.html)

## Dependencies
There are no hard dependencies. But if you want to use some advanced features you need to install the following packages:
- [multiprocess](https://github.com/uqfoundation/multiprocess) if you want to use the `@in_subprocess` decorator
- [flask](https://pypi.org/project/Flask/) if you want to you the request validators which are designed for `Flask` (see unit tests for examples): 
  - `FlaskParameter` (abstract class)
  - `FlaskJsonParameter`
  - `FlaskFormParameter`
  - `FlaskPathParameter`
  - `FlaskGetParameter`
  - `FlaskHeaderParameter`
  - `GenericFlaskDeserializer`

## Contributing
Feel free to contribute by submitting a pull request :)

## Acknowledgments
* [Rathaustreppe](https://github.com/rathaustreppe)
* [Aran-Fey](https://stackoverflow.com/questions/55503673/how-do-i-check-if-a-value-matches-a-type-in-python/55504010#55504010)
* [user395760](https://stackoverflow.com/questions/55503673/how-do-i-check-if-a-value-matches-a-type-in-python/55504010#55504010)

## Risks and side effects
The usage of decorators may affect the performance of your application. 
For this reason, I would highly recommend you to disable the decorators if your code runs in a productive environment.
You can disable `pedantic` by set an environment variable:
```
export ENABLE_PEDANTIC=0
```
You can also disable or enable the environment variables in your project by calling a method:
```python
from pedantic import enable_pedantic, disable_pedantic
enable_pedantic()
```

## Issues with compiled Python code
This package is **not** compatible with compiled source code (e.g. with [Nuitka](https://github.com/Nuitka/Nuitka)).
That's because it uses the `inspect` module from the standard library which will raise errors like `OSError: could not get source code` in case of compiled source code.


Don't forget to check out the [documentation](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic).
Happy coding!

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/LostInDarkMath/pedantic-python-decorators",
    "name": "pedantic",
    "maintainer": "Willi Sontopski",
    "docs_url": null,
    "requires_python": ">=3.11.0",
    "maintainer_email": null,
    "keywords": "decorators tools helpers type-checking pedantic type annotations",
    "author": "Willi Sontopski",
    "author_email": "willi_sontopski@arcor.de",
    "download_url": null,
    "platform": null,
    "description": "# pedantic-python-decorators [![Build Status](https://travis-ci.com/LostInDarkMath/pedantic-python-decorators.svg?branch=master)](https://travis-ci.com/LostInDarkMath/pedantic-python-decorators)  [![Coverage Status](https://coveralls.io/repos/github/LostInDarkMath/pedantic-python-decorators/badge.svg?branch=master)](https://coveralls.io/github/LostInDarkMath/pedantic-python-decorators?branch=master) [![PyPI version](https://badge.fury.io/py/pedantic.svg)](https://badge.fury.io/py/pedantic) [![Conda Version](https://img.shields.io/conda/vn/conda-forge/pedantic.svg)](https://anaconda.org/conda-forge/pedantic) [![Last Commit](https://badgen.net/github/last-commit/LostInDarkMath/pedantic-python-decorators?color=green)](https://GitHub.com/LostInDarkMath/pedantic-python-decorators) [![Stars](https://badgen.net/github/stars/LostInDarkMath/pedantic-python-decorators?color=green)](https://GitHub.com/LostInDarkMath/pedantic-python-decorators) [![Open Issues](https://badgen.net/github/open-issues/LostInDarkMath/pedantic-python-decorators?color=green)](https://GitHub.com/LostInDarkMath/pedantic-python-decorators/issues) [![Open PRs](https://badgen.net/github/open-prs/LostInDarkMath/pedantic-python-decorators?color=green)](https://GitHub.com/LostInDarkMath/pedantic-python-decorators/pulls)\n\nThis packages includes many decorators that will make you write cleaner Python code. \n\n## Getting Started\nThis package requires Python 3.11 or later.\nThere are multiple options for installing this package.\n\n### Option 1: Installing with pip from [Pypi](https://pypi.org/)\nRun `pip install pedantic`.\n\n### Option 2: Installing with conda from [conda-forge](conda-forge.org)\nRun `conda install -c conda-forge pedantic`\n\n### Option 3: Installing with pip and git\n1. Install [Git](https://git-scm.com/downloads) if you don't have it already.\n2. Run `pip install git+https://github.com/LostInDarkMath/pedantic-python-decorators.git@master`\n\n### Option 4: Offline installation using wheel\n1. Download the [latest release here](https://github.com/LostInDarkMath/PythonHelpers/releases/latest) by clicking on `pedantic-python-decorators-x.y.z-py-none-any.whl`.\n2. Execute `pip install pedantic-python-decorators-x.y.z-py3-none-any.whl`.\n\n## The [@pedantic](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/method_decorators.html#pedantic.method_decorators.pedantic) decorator - Type checking at runtime\nThe `@pedantic` decorator does the following things:\n- The decorated function can only be called by using keyword arguments. Positional arguments are not accepted.\n- The decorated function must have [type annotations](https://docs.python.org/3/library/typing.html).\n- Each time the decorated function is called, pedantic checks that the passed arguments and the return value of the function matches the given type annotations. \nAs a consequence, the arguments are also checked for `None`, because `None` is only a valid argument, if it is annotated via `typing.Optional`.\n\nIn a nutshell:\n`@pedantic` raises an `PedanticException` if one of the following happened:\n- The decorated function is called with positional arguments.\n- The function has no type annotation for their return type or one or more parameters do not have type annotations.\n- A type annotation is incorrect.\n- A type annotation misses type arguments, e.g. `typing.List` instead of `typing.List[int]`.\n\n### Minimal example\n```python\nfrom pedantic import pedantic\n\n\n@pedantic\ndef get_sum_of(values: list[int | float]) -> int:\n    return sum(values)\n\nget_sum_of(values=[0, 1.2, 3, 5.4])  # this raises the following runtime error: \n# Type hint of return value is incorrect: Expected type <class 'int'> but 10.0 of type <class 'float'> was the return value which does not match.\n```\n\n\n## The [@validate]() decorator\nAs the name suggests, with `@validate` you are able to validate the values that are passed to the decorated function.\nThat is done in a highly customizable way. \nBut the highest benefit of this decorator is that it makes it extremely easy to write decoupled easy testable, maintainable and scalable code.\nThe following example shows the decoupled implementation of a configurable algorithm with the help of `@validate`:\n```python\nimport os\nfrom dataclasses import dataclass\n\nfrom pedantic import validate, ExternalParameter, overrides, Validator, Parameter, Min, ReturnAs\n\n\n@dataclass(frozen=True)\nclass Configuration:\n    iterations: int\n    max_error: float\n\n\nclass ConfigurationValidator(Validator):\n    @overrides(Validator)\n    def validate(self, value: Configuration) -> Configuration:\n        if value.iterations < 1 or value.max_error < 0:\n            self.raise_exception(msg=f'Invalid configuration: {value}', value=value)\n\n        return value\n\n\nclass ConfigFromEnvVar(ExternalParameter):\n    \"\"\" Reads the configuration from environment variables. \"\"\"\n\n    @overrides(ExternalParameter)\n    def has_value(self) -> bool:\n        return 'iterations' in os.environ and 'max_error' in os.environ\n\n    @overrides(ExternalParameter)\n    def load_value(self) -> Configuration:\n        return Configuration(\n            iterations=int(os.environ['iterations']),\n            max_error=float(os.environ['max_error']),\n        )\n\n\nclass ConfigFromFile(ExternalParameter):\n    \"\"\" Reads the configuration from a config file. \"\"\"\n\n    @overrides(ExternalParameter)\n    def has_value(self) -> bool:\n        return os.path.isfile('config.csv')\n\n    @overrides(ExternalParameter)\n    def load_value(self) -> Configuration:\n        with open(file='config.csv', mode='r') as file:\n            content = file.readlines()\n            return Configuration(\n                iterations=int(content[0].strip('\\n')),\n                max_error=float(content[1]),\n            )\n\n\n# choose your configuration source here:\n@validate(ConfigFromEnvVar(name='config', validators=[ConfigurationValidator()]), strict=False, return_as=ReturnAs.KWARGS_WITH_NONE)\n# @validate(ConfigFromFile(name='config', validators=[ConfigurationValidator()]), strict=False)\n\n# with strict_mode = True (which is the default)\n# you need to pass a Parameter for each parameter of the decorated function\n# @validate(\n#     Parameter(name='value', validators=[Min(5, include_boundary=False)]),\n#     ConfigFromFile(name='config', validators=[ConfigurationValidator()]),\n# )\ndef my_algorithm(value: float, config: Configuration) -> float:\n    \"\"\"\n        This method calculates something that depends on the given value with considering the configuration.\n        Note how well this small piece of code is designed:\n            - Fhe function my_algorithm() need a Configuration but has no knowledge where this come from.\n            - Furthermore, it doesn't care about parameter validation.\n            - The ConfigurationValidator doesn't know anything about the creation of the data.\n            - The @validate decorator is the only you need to change, if you want a different configuration source.\n    \"\"\"\n    print(value)\n    print(config)\n    return value\n\n\nif __name__ == '__main__':\n    # we can call the function with a config like there is no decorator.\n    # This makes testing extremely easy: no config files, no environment variables or stuff like that\n    print(my_algorithm(value=2, config=Configuration(iterations=3, max_error=4.4)))\n\n    os.environ['iterations'] = '12'\n    os.environ['max_error'] = '3.1415'\n\n    # but we also can omit the config and load it implicitly by our custom Parameters\n    print(my_algorithm(value=42.0))\n```\n\n## List of all decorators in this package\n- [@count_calls](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/decorators/fn_deco_count_calls.html)\n- [@deprecated](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/decorators/fn_deco_deprecated.html)\n- [@does_same_as_function](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/decorators/fn_deco_does_same_as_function.html)\n- [@frozen_dataclass](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/decorators/cls_deco_frozen_dataclass.html#pedantic.decorators.cls_deco_frozen_dataclass.frozen_dataclass)\n- [@frozen_type_safe_dataclass](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/decorators/cls_deco_frozen_dataclass.html#pedantic.decorators.cls_deco_frozen_dataclass.frozen_type_safe_dataclass)\n- [@for_all_methods](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/decorators/class_decorators.html#pedantic.decorators.class_decorators.for_all_methods)\n- [@in_subprocess](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/decorators/fn_deco_in_subprocess.html)\n- [@mock](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/decorators/fn_deco_mock.html)\n- [@overrides](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/decorators/fn_deco_overrides.html)\n- [@pedantic](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/decorators/fn_deco_pedantic.html#pedantic.decorators.fn_deco_pedantic.pedantic)\n- [@pedantic_class](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/decorators/class_decorators.html#pedantic.decorators.class_decorators.pedantic_class)\n- [@rename_kwargs](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/decorators/fn_deco_rename_kwargs.html)\n- [@require_kwargs](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/decorators/fn_deco_require_kwargs.html)\n- [@retry](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/decorators/fn_deco_retry.html)\n- [@timer](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/decorators/fn_deco_timer.html)\n- [@timer_class](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/decorators/class_decorators.html#pedantic.decorators.class_decorators.timer_class)\n- [@trace](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/decorators/fn_deco_trace.html)\n- [@trace_class](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/decorators/class_decorators.html#pedantic.decorators.class_decorators.trace_class)\n- [@trace_if_returns](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/decorators/fn_deco_trace_if_returns.html)\n- [@unimplemented](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/decorators/fn_deco_unimplemented.html)\n- [@validate](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/decorators/fn_deco_validate/fn_deco_validate.html)\n\n## List of all mixins in this package\n- [GenericMixin](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/mixins/generic_mixin.html)\n- [WithDecoratedMethods](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/mixins/with_decorated_methods.html)\n\n## Dependencies\nThere are no hard dependencies. But if you want to use some advanced features you need to install the following packages:\n- [multiprocess](https://github.com/uqfoundation/multiprocess) if you want to use the `@in_subprocess` decorator\n- [flask](https://pypi.org/project/Flask/) if you want to you the request validators which are designed for `Flask` (see unit tests for examples): \n  - `FlaskParameter` (abstract class)\n  - `FlaskJsonParameter`\n  - `FlaskFormParameter`\n  - `FlaskPathParameter`\n  - `FlaskGetParameter`\n  - `FlaskHeaderParameter`\n  - `GenericFlaskDeserializer`\n\n## Contributing\nFeel free to contribute by submitting a pull request :)\n\n## Acknowledgments\n* [Rathaustreppe](https://github.com/rathaustreppe)\n* [Aran-Fey](https://stackoverflow.com/questions/55503673/how-do-i-check-if-a-value-matches-a-type-in-python/55504010#55504010)\n* [user395760](https://stackoverflow.com/questions/55503673/how-do-i-check-if-a-value-matches-a-type-in-python/55504010#55504010)\n\n## Risks and side effects\nThe usage of decorators may affect the performance of your application. \nFor this reason, I would highly recommend you to disable the decorators if your code runs in a productive environment.\nYou can disable `pedantic` by set an environment variable:\n```\nexport ENABLE_PEDANTIC=0\n```\nYou can also disable or enable the environment variables in your project by calling a method:\n```python\nfrom pedantic import enable_pedantic, disable_pedantic\nenable_pedantic()\n```\n\n## Issues with compiled Python code\nThis package is **not** compatible with compiled source code (e.g. with [Nuitka](https://github.com/Nuitka/Nuitka)).\nThat's because it uses the `inspect` module from the standard library which will raise errors like `OSError: could not get source code` in case of compiled source code.\n\n\nDon't forget to check out the [documentation](https://lostindarkmath.github.io/pedantic-python-decorators/pedantic).\nHappy coding!\n",
    "bugtrack_url": null,
    "license": "Apache-2.0 License",
    "summary": "Some useful Python decorators for cleaner software development.",
    "version": "2.1.8",
    "project_urls": {
        "Bug Tracker": "https://github.com/LostInDarkMath/pedantic-python-decorators/issues",
        "Documentation": "https://lostindarkmath.github.io/pedantic-python-decorators/pedantic/",
        "Homepage": "https://github.com/LostInDarkMath/pedantic-python-decorators",
        "Source Code": "https://github.com/LostInDarkMath/pedantic-python-decorators"
    },
    "split_keywords": [
        "decorators",
        "tools",
        "helpers",
        "type-checking",
        "pedantic",
        "type",
        "annotations"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "35a4042d74dffa7bc180cddeb9ad8a704dd408435041d1f8a2c4ab7afda4f5c6",
                "md5": "4cb115ad9101820af1b8c60dce64f927",
                "sha256": "e927e4b1f0c18ee1af4153232430c593832cb465256320f29057b2dd56318b5a"
            },
            "downloads": -1,
            "filename": "pedantic-2.1.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4cb115ad9101820af1b8c60dce64f927",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11.0",
            "size": 115505,
            "upload_time": "2024-12-04T13:30:34",
            "upload_time_iso_8601": "2024-12-04T13:30:34.794133Z",
            "url": "https://files.pythonhosted.org/packages/35/a4/042d74dffa7bc180cddeb9ad8a704dd408435041d1f8a2c4ab7afda4f5c6/pedantic-2.1.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-04 13:30:34",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "LostInDarkMath",
    "github_project": "pedantic-python-decorators",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "requirements": [
        {
            "name": "docstring-parser",
            "specs": [
                [
                    "==",
                    "0.16"
                ]
            ]
        },
        {
            "name": "Flask",
            "specs": [
                [
                    "==",
                    "3.0.2"
                ]
            ]
        },
        {
            "name": "multiprocess",
            "specs": [
                [
                    "==",
                    "0.70.16"
                ]
            ]
        },
        {
            "name": "Werkzeug",
            "specs": [
                [
                    "==",
                    "3.0.1"
                ]
            ]
        }
    ],
    "lcname": "pedantic"
}
        
Elapsed time: 0.36370s