{"id":17787940,"url":"https://github.com/zmievsa/type-inspector","last_synced_at":"2025-04-02T00:27:14.788Z","repository":{"id":86519021,"uuid":"597559598","full_name":"zmievsa/type-inspector","owner":"zmievsa","description":"Inspect pydantic models without passing data into them","archived":false,"fork":false,"pushed_at":"2023-10-28T15:55:11.000Z","size":37,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-07T15:45:24.456Z","etag":null,"topics":[],"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/zmievsa.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":"2023-02-04T22:45:04.000Z","updated_at":"2023-09-02T18:31:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"80aaac54-37ae-47ca-bbe9-c3f4da406657","html_url":"https://github.com/zmievsa/type-inspector","commit_stats":null,"previous_names":["zmievsa/type-inspector"],"tags_count":0,"template":false,"template_full_name":"zmievsa/python-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zmievsa%2Ftype-inspector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zmievsa%2Ftype-inspector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zmievsa%2Ftype-inspector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zmievsa%2Ftype-inspector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zmievsa","download_url":"https://codeload.github.com/zmievsa/type-inspector/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246732696,"owners_count":20824793,"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":[],"created_at":"2024-10-27T10:13:24.998Z","updated_at":"2025-04-02T00:27:14.763Z","avatar_url":"https://github.com/zmievsa.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# type-inspector\n\nWalk a deeply nested pydantic model, type alias or dataclass as if data was already put into it. While pydantic allows you to validate data with a model, type-inspector allows you to validate **operations** on data using a model **before** any data has been passed.\n\n---\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://github.com/zmievsa/type-inspector/actions?query=workflow%3ATests+event%3Apush+branch%3Amain\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://github.com/zmievsa/type-inspector/actions/workflows/test.yaml/badge.svg?branch=main\u0026event=push\" alt=\"Test\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://codecov.io/gh/ovsyanka83/type-inspector\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.shields.io/codecov/c/github/ovsyanka83/type-inspector?color=%2334D058\" alt=\"Coverage\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://pypi.org/project/type-inspector/\" target=\"_blank\"\u003e\n    \u003cimg alt=\"PyPI\" src=\"https://img.shields.io/pypi/v/type-inspector?color=%2334D058\u0026label=pypi%20package\" alt=\"Package version\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://pypi.org/project/type-inspector/\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.shields.io/pypi/pyversions/type-inspector?color=%2334D058\" alt=\"Supported Python versions\"\u003e\n\u003c/a\u003e\n\u003c/p\u003e\n\n## Installation\n\n```bash\npip install type-inspector\n```\n\n## Usage\n\n### Quickstart\n\nLet's pick an inspector for a model and try doing a few operations on it:\n\n```python\nfrom type_inspector import pick_inspector\nfrom pydantic import BaseModel\n\nclass NestedModel(BaseModel):\n    b: dict[str, int | list[bytes]]\n\nclass MyModel(BaseModel):\n    a: list[NestedModel]\n\ninspector = pick_inspector(MyModel, [\"MyModel\"])\nresult = inspector.a[1].b[\"hello\"][11]\nprint(result.wrapped) # bytes\n```\n\nIf you try to access a property or item that cannot exist, an `InspectionError` will be raised.\n\n### Note on notation\n\nThis library was originally created to mimic javascript syntax so `Model[\"a\"][\"b\"]` is the same as Model.a.b. However, this notation is not necessarily correct in terms of python syntax. But it will definitely make sure that the operations you write will work on a JSON object that the model was created for.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzmievsa%2Ftype-inspector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzmievsa%2Ftype-inspector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzmievsa%2Ftype-inspector/lists"}