{"id":34077574,"url":"https://github.com/izxxr/typedclasses","last_synced_at":"2025-12-14T10:18:10.079Z","repository":{"id":44591011,"uuid":"454359470","full_name":"izxxr/typedclasses","owner":"izxxr","description":"Python classes with types validation at runtime.","archived":false,"fork":false,"pushed_at":"2022-11-20T08:05:21.000Z","size":23,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-06T17:09:16.239Z","etag":null,"topics":["classes","python-typing","python3","typed","typing"],"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/izxxr.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}},"created_at":"2022-02-01T11:21:52.000Z","updated_at":"2022-02-06T10:42:52.000Z","dependencies_parsed_at":"2023-01-23T04:00:54.696Z","dependency_job_id":null,"html_url":"https://github.com/izxxr/typedclasses","commit_stats":null,"previous_names":["nerdguyahmad/typedclasses"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/izxxr/typedclasses","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/izxxr%2Ftypedclasses","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/izxxr%2Ftypedclasses/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/izxxr%2Ftypedclasses/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/izxxr%2Ftypedclasses/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/izxxr","download_url":"https://codeload.github.com/izxxr/typedclasses/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/izxxr%2Ftypedclasses/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27726205,"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","status":"online","status_checked_at":"2025-12-14T02:00:11.348Z","response_time":56,"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":["classes","python-typing","python3","typed","typing"],"created_at":"2025-12-14T10:18:05.237Z","updated_at":"2025-12-14T10:18:10.068Z","avatar_url":"https://github.com/izxxr.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# typedclasses\nPython classes with types validation at runtime.\n\nThis is purely an experiment, not meant for actual use.\n\n## Installation\nYou can install this library using Python's favorite, `pip` package manager.\n\n```sh\npip install -U typedclasses\n```\n\n## How it works\nUsing typedclasses, you can create classes in `dataclasses`-like manner i.e using type annotations and library will enforce types for\nthat class at runtime. Here's an example:\n\n```py\nimport typing\nfrom typedclasses import TypedClass\n\nclass User(TypedClass):\n  id: int\n  name: str\n  email: typing.Optional[str] = None\n```\n\nParameters will be validated when initialising above class. Since `email` has a default value set, It is optional to pass\nit as a parameter while instansiating:\n\n```py\n\u003e\u003e\u003e User(id=1, name=\"foobar\") # runs fine\n\u003e\u003e\u003e User(id=\"1\", name=\"foobar\")\nTypeError: Parameter 'id' must be an instance of \u003cclass 'int'\u003e, \u003cclass 'str'\u003e is unsupported.\n```\n\nThis library also provides validation for *various* generic types from `typing` module:\n\n```py\nclass Foo(TypedClass):\n  x: typing.Union[int, float]\n\nFoo(x=1) # ok\nFoo(x=1.0) # ok\nFoo(x=\"1\") # invalid\n```\n\nList of all types supported from `typing` module can be found in the [documentation](https://github.com/nerdguyahmad/typedclasses/wiki).\n\n## Contribute\nYou can contribute to the library in two ways:\n\n- Directly contributing to code using pull requests.\n- Suggest features or report bugs via issues.\n\nWe welcome all contributions! 👍\n\nWhen using issues, Please be descriptive about your issue and for pull requests, Try to be consistent with current design.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fizxxr%2Ftypedclasses","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fizxxr%2Ftypedclasses","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fizxxr%2Ftypedclasses/lists"}