{"id":18574742,"url":"https://github.com/kaliv0/pypermissive","last_synced_at":"2025-09-05T20:32:44.728Z","repository":{"id":252457712,"uuid":"836934423","full_name":"kaliv0/pypermissive","owner":"kaliv0","description":"Validation library in Python, modeled after Pydantic","archived":false,"fork":false,"pushed_at":"2024-12-06T22:55:32.000Z","size":92,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T18:46:37.921Z","etag":null,"topics":["pydantic-v2","python-validator","validation-library"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/pypermissive/","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/kaliv0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2024-08-01T21:38:22.000Z","updated_at":"2024-12-30T22:30:09.000Z","dependencies_parsed_at":"2024-08-09T22:41:13.223Z","dependency_job_id":"a40fb433-643b-468b-84b7-f69909bef716","html_url":"https://github.com/kaliv0/pypermissive","commit_stats":null,"previous_names":["kaliv0/pypermissive"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaliv0%2Fpypermissive","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaliv0%2Fpypermissive/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaliv0%2Fpypermissive/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaliv0%2Fpypermissive/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kaliv0","download_url":"https://codeload.github.com/kaliv0/pypermissive/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248185163,"owners_count":21061467,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["pydantic-v2","python-validator","validation-library"],"created_at":"2024-11-06T23:16:14.688Z","updated_at":"2025-04-10T08:30:36.540Z","avatar_url":"https://github.com/kaliv0.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/kaliv0/pypermissive/blob/main/assets/permissive.jpg?raw=true\" alt=\"Permissive Path\"\u003e\n\u003c/p\u003e\n\n---\n\n# PyPermissive\n\n[![tests](https://img.shields.io/github/actions/workflow/status/kaliv0/pypermissive/ci.yml)](https://github.com/kaliv0/pypermissive/actions/workflows/ci.yml)\n![Python 3.x](https://img.shields.io/badge/python-3.12-blue?style=flat-square\u0026logo=Python\u0026logoColor=white)\n[![PyPI](https://img.shields.io/pypi/v/pypermissive.svg)](https://pypi.org/project/pypermissive/)\n[![Downloads](https://static.pepy.tech/badge/pypermissive)](https://pepy.tech/projects/pypermissive)\n[![License](https://img.shields.io/badge/License-MIT-yellow?style=flat-square)](https://github.com/kaliv0/pypermissive/blob/main/LICENSE)\n\nValidation library in Python, modeled after Pydantic\n\n--------------------------------\n## Example\n\nInherit from BaseModel and describe required types.\u003cbr\u003e\n\u003ci\u003ePyPermissive\u003c/i\u003e supports validation for primitive types:\n```python\nclass Employee(BaseModel):\n    employee_id: int\n    name: str\n    salary: float\n    elected_benefits: bool = False\n    \nemployee = Employee(\n    employee_id=1,\n    name=\"Foo Bar\",\n    salary=123_000.00,\n    elected_benefits=True,\n)\n```\ncollections:\n```python\nclass Book(BaseModel):\n    characters: dict[str, str]\n    chapters: list[str]\n    \nbook = Book(\n    characters={\"Pelleas\": \"he\", \"Melisande\": \"she\"},\n    chapters=[\"Beginning\", \"Middle\", \"End\"]\n)\n```\nunions, classes and fields.\u003cbr\u003e\n\n--------------------------------\nFields are similar to \u003ci\u003epydantic\u003c/i\u003e with one caveat: you need to give value type explicitly:\n```python\nclass User(BaseModel):\n    name: Field(type=str, default=\"Jimmie\", frozen=True)\n    age: Field(type=int, gt=18, lt=35)\n    id: Field(type=UUID, default_factory=uuid4)\n    email: Field(type=str, pattern=r\"^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+[.][a-zA-Z0-9-.]+$\")\n    nickname: Field(type=str, min_length=6, max_length=12)\n    PIN: Field(type=str, field_validator=lambda x: x.isdigit())\n\n```\n\n--------------------------------\nYou can also use decorators:\u003cbr\u003e\n@ComputedField (invoke only from instances) and @ComputedClassField (invoke both on class and instance level)\n```python\nclass Thesis:\n    BAZZ = [\"1\", \"2\", \"3\"]\n\n    def __init__(self):\n        self.fizz = [1, 2, 3, 4, 5]\n        self.buzz = [6, 7, 8, 9]\n\n    @ComputedField\n    def foo(self):\n        return [val for val in itertools.product(self.fizz, self.buzz)]\n\n    @ComputedClassField\n    def bar(self):\n        return list(itertools.permutations(self.BAZZ))\n\n    \n```\n\n--------------------------------\nThe library supports @validate_call that checks both argument and return types:\n```python\n@validate_call\ndef some_func(delimiter: str, count: int, numbers: list[int]) -\u003e str:\n    return (delimiter * count).join([str(d) for d in numbers])\n```\n\n--------------------------------\n@Interface checks on a class-definition level if the decorated class implements all described methods with the specified signature\n```python\nclass MyInterface:\n    def pow(self, x: int, y: int) -\u003e int: ...\n\n\n@Interface(MyInterface)\nclass Powerful:\n    def pow(self, x: int, y: int) -\u003e int:\n        return x ** y\n```\n\n```python\nclass OtherInterface:\n    def moo(self): ...\n\n\n@Interface(MyInterface, OtherInterface)\nclass Frankenstein:\n    def pow(self, x: int, y: int) -\u003e int:\n        return x ** y\n\n    def moo(self):\n        return \"Yeah Mr. White...\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaliv0%2Fpypermissive","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkaliv0%2Fpypermissive","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaliv0%2Fpypermissive/lists"}