{"id":24650793,"url":"https://github.com/tangoman75/pyvalidator","last_synced_at":"2026-07-22T18:31:32.597Z","repository":{"id":114062178,"uuid":"261906371","full_name":"TangoMan75/pyvalidator","owner":"TangoMan75","description":"TangoMan PyValidator is a dynamic runtime typing validation for members annotated with PEP 484 type hints","archived":false,"fork":false,"pushed_at":"2020-05-18T15:33:19.000Z","size":32,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-09T18:39:45.403Z","etag":null,"topics":["annotation","dynamic","python3","runtime","tangoman","type","typing","validation"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TangoMan75.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-06T23:58:24.000Z","updated_at":"2020-05-18T15:33:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"362ea396-9153-4cb0-b379-3e0d377c2be1","html_url":"https://github.com/TangoMan75/pyvalidator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/TangoMan75/pyvalidator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TangoMan75%2Fpyvalidator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TangoMan75%2Fpyvalidator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TangoMan75%2Fpyvalidator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TangoMan75%2Fpyvalidator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TangoMan75","download_url":"https://codeload.github.com/TangoMan75/pyvalidator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TangoMan75%2Fpyvalidator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35773465,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-07-20T02:08:10.276Z","status":"online","status_checked_at":"2026-07-22T02:00:06.236Z","response_time":124,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["annotation","dynamic","python3","runtime","tangoman","type","typing","validation"],"created_at":"2025-01-25T18:16:42.304Z","updated_at":"2026-07-22T18:31:32.580Z","avatar_url":"https://github.com/TangoMan75.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"TangoMan PyValidator\n====================\n\nA dynamic runtime typing validation for members annotated with [PEP 484](https://www.python.org/dev/peps/pep-0484) type hints.\n\n**TangoMan PyValidator** idea was inspired by [agronholm / typeguard](https://github.com/agronholm/typeguard) but enforces SOLID principles, and is based on the chain-of-responsibility design pattern which makes it more readable, extensible and maintenable.\n\n**TangoMan PyValidator** provides `@Validator.type_check` decorator as a mean to dynamically check for type violations at runtime.\n\nInstall\n-------\n\nEnter following command to install locally\n\n```bash\n$ sudo python3 setup.py install\n# or\n$ pip3 install git+https://github.com/TangoMan75/pyvalidator\n```\n\nFeatures\n--------\n\n### Validator\n\n- Validate typing aliases recursively.\n- Validate standard python types.\n- Validate classes.\n- Validate nullable properties.\n- Validate not blank properties.\n\n### pyfunctools\n\nPython utilities to handle reflexion methods on functions.\n\nUsage\n-----\n\nImport `typing` module and extend your class with `Validator`\n\n```python\nimport typing\n\nfrom pyvalidator.validator import Validator\n\nclass Foobar(Validator):\n\t# ...\n```\n\n### type_check\n\nDocument your class with appropriate annotations and use `@Validator.type_check` decorator on your method and properties.\n\n```python\n    @property\n    def nullable_str(self) -\u003e typing.Optional[str]:\n        return self._nullable_str\n\n    @nullable_str.setter\n    @Validator.type_check\n    def nullable_str(self, nullable_str_: typing.Optional[str]) -\u003e None:\n        self._nullable_str = nullable_str_\n```\n\nAt runtime if any given argument does not match expected type, `Validator` will raise a `TypeError`.\n\n### not_blank\n\nUse `@Validator.not_blank` decorator on your method and properties.\n\n```python\n    @Validator.not_blank\n    def divide(self, a: int, b: int) -\u003e None:\n    \treturn a / b\n```\n\nAt runtime `Validator` will raise a `ValueError` if any given argument is empty i.e:\n\n- `bytes` equals `b''`\n- `bytearray` equals `bytearray()`\n- `complex` equals `0j`\n- `dict` equals `{}`\n- `float` equals `0.0`\n- `frozenset` equals `frozenset()`\n- `int` equals `0`\n- `list` equals `[]`\n- `memoryview` equals `memoryview(b'')`\n- `range` equals `range(0)`\n- `set` equals `set()`\n- `str` equals `''`\n- `tuple` equals `()`\n\n\u003e NOTE: \"bool\" and \"type\" values excluded, since \"not blank\" does not make sense with them.\n\n### Decorator\n\nDecorators are chainable, you can use `@Validator.type_check` and `@Validator.not_blank` on the same attribute.\n\n```python\n    @property\n    def email(self) -\u003e typing.Optional[str]:\n        return self._email\n\n    @email.setter\n    @Validator.type_check\n    @Validator.not_blank\n    def email(self, email_: typing.Optional[str]) -\u003e None:\n        self._email = email_\n```\n\nKnown bug\n-----------\n\n`typing.OrderedDict` causes `AttributeError` at runtime (which causes travis ci to fail):\n\n```\nAttributeError: module 'typing' has no attribute 'OrderedDict'\n```\n\nSeems like mypy maintainers don't want to fix the issue https://github.com/python/mypy/issues/6904\n\nContinuous Integration\n----------------------\n\n[![Build Status](https://travis-ci.org/TangoMan75/pyvalidator.svg?branch=master)](https://travis-ci.org/TangoMan75/pyvalidator) \nIf you find any bug please report here : [Issues](https://github.com/TangoMan75/pyvalidator/issues/new)\n\nLicense\n-------\n\nCopyrights (c) 2020 \u0026quot;Matthias Morin\u0026quot; \u0026lt;mat@tangoman.io\u0026gt;\n\n[![License](https://img.shields.io/badge/Licence-MIT-green.svg)](LICENCE)\nDistributed under the MIT license.\n\nIf you like **TangoMan PyValidator** please star, follow or tweet:\n\n[![GitHub stars](https://img.shields.io/github/stars/TangoMan75/pyvalidator?style=social)](https://github.com/TangoMan75/pyvalidator/stargazers)\n[![GitHub followers](https://img.shields.io/github/followers/TangoMan75?style=social)](https://github.com/TangoMan75)\n[![Twitter](https://img.shields.io/twitter/url?style=social\u0026url=https%3A%2F%2Fgithub.com%2FTangoMan75%2Fpyvalidator)](https://twitter.com/intent/tweet?text=Wow:\u0026url=https%3A%2F%2Fgithub.com%2FTangoMan75%2Fpyvalidator)\n\n... And check my other cool projects.\n\n[![LinkedIn](https://img.shields.io/static/v1?style=social\u0026logo=linkedin\u0026label=LinkedIn\u0026message=morinmatthias)](https://www.linkedin.com/in/morinmatthias)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftangoman75%2Fpyvalidator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftangoman75%2Fpyvalidator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftangoman75%2Fpyvalidator/lists"}