{"id":19630607,"url":"https://github.com/zwimer/simple_type_checker","last_synced_at":"2026-03-08T04:31:12.716Z","repository":{"id":217683129,"uuid":"744582187","full_name":"zwimer/simple_type_checker","owner":"zwimer","description":"A small extendable python type checker library","archived":false,"fork":false,"pushed_at":"2024-08-26T06:12:10.000Z","size":41,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-04T12:02:27.508Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zwimer.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,"zenodo":null}},"created_at":"2024-01-17T15:40:50.000Z","updated_at":"2024-08-26T06:12:15.000Z","dependencies_parsed_at":"2024-01-17T22:48:46.279Z","dependency_job_id":"235e0ff5-4874-49a9-b417-de36426ce552","html_url":"https://github.com/zwimer/simple_type_checker","commit_stats":null,"previous_names":["zwimer/simple_type_checker"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/zwimer/simple_type_checker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zwimer%2Fsimple_type_checker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zwimer%2Fsimple_type_checker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zwimer%2Fsimple_type_checker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zwimer%2Fsimple_type_checker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zwimer","download_url":"https://codeload.github.com/zwimer/simple_type_checker/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zwimer%2Fsimple_type_checker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30245212,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-08T00:58:18.660Z","status":"online","status_checked_at":"2026-03-08T02:00:06.215Z","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":[],"created_at":"2024-11-11T12:04:34.479Z","updated_at":"2026-03-08T04:31:12.681Z","avatar_url":"https://github.com/zwimer.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# simple\\_type\\_checker\n\nA small extendable python type checker library\n\n### Basic Usage\n\nChecking a type:\n```python\nfrom simple_type_check import type_check\nassert type_check(\"A string\", str)\n```\n\nAs a decorator:\n```python\nfrom simple_type_check import type_check, TypeCheckFailed\n\n@type_check.returns\ndef id_(x) -\u003e int:\n    return x\n\n_ = id_(1)  # Passes\ntry:\n    _ = id_(\"string\")  # Raises\nexcept TypeCheckFailed as e:\n    pass\n```\n\nDecorators for aruments exist as well: `type_check.args`.\nBoth can be done at once with `type_check.decorate`.\n\n### With custom types\n\nBasic types where `isinstance` is sufficient:\n```python\nfrom simple_type_check import TypeChecker\n\nclass Foo:\n    pass\n\ntype_check = TypeChecker(Foo)\n\nassert type_check(Foo(), Foo)\n```\n\nSpecial type checking logic desired:\n```python\nfrom simple_type_check import TopLevelCheck, TypeChecker\n\nBar = list[int] | list[\"Bar\"]\n\nclass BarCheck(TopLevelCheck):\n    def __call__(self, obj, type_) -\u003e bool:\n        return type_ == \"Bar\" and self._recurse(obj, Bar)\n\ntype_check = TypeChecker(advanced=[BarCheck])\n\ntype_check([1, [2], [[3]]], Bar)  # Should pass\n```\nThis use case is useful for container types that take arguments, for example.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzwimer%2Fsimple_type_checker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzwimer%2Fsimple_type_checker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzwimer%2Fsimple_type_checker/lists"}