{"id":48707950,"url":"https://github.com/type-python/type-python","last_synced_at":"2026-05-25T18:01:00.523Z","repository":{"id":350650808,"uuid":"1184591137","full_name":"type-python/type-python","owner":"type-python","description":"TypePython: The typed superset of Python.","archived":false,"fork":false,"pushed_at":"2026-05-05T15:03:13.000Z","size":5877,"stargazers_count":3,"open_issues_count":10,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-05T16:32:53.251Z","etag":null,"topics":["language","python","typechecker","typepython"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/type-python.png","metadata":{"files":{"readme":"README-PyPI.md","changelog":null,"contributing":"docs/contributing.md","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-17T18:29:06.000Z","updated_at":"2026-05-05T14:32:28.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/type-python/type-python","commit_stats":null,"previous_names":["type-python/type-python"],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/type-python/type-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/type-python%2Ftype-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/type-python%2Ftype-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/type-python%2Ftype-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/type-python%2Ftype-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/type-python","download_url":"https://codeload.github.com/type-python/type-python/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/type-python%2Ftype-python/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33486787,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-25T14:31:05.219Z","status":"ssl_error","status_checked_at":"2026-05-25T14:31:02.878Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["language","python","typechecker","typepython"],"created_at":"2026-04-11T12:21:05.210Z","updated_at":"2026-05-25T18:01:00.498Z","avatar_url":"https://github.com/type-python.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/type-python/type-python/main/logo.png\" alt=\"TypePython\" width=\"160\" /\u003e\n\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003eTypePython\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cstrong\u003eWrite richer types in \u003ccode\u003e.tpy\u003c/code\u003e. Ship plain \u003ccode\u003e.py\u003c/code\u003e + \u003ccode\u003e.pyi\u003c/code\u003e.\u003c/strong\u003e\n\u003c/p\u003e\n\n---\n\nTypePython is a typed dialect of Python that compiles to standard `.py` + `.pyi`.\nIt brings author-time TypeScript-class ergonomics — `sealed` classes, exhaustive `match`,\nstrict null checks, `unknown`, `interface`, `data class` — to a language whose\noutput runs anywhere CPython runs.\n\nThose stronger checks are enforced while authoring `.tpy`; emitted artifacts\nremain standard Python and do not transfer every TypePython-only constraint to\ndownstream checkers.\n\n**No custom runtime. No required per-checker plugin for emitted output. No vendor lock-in.**\n\n\u003e Status: **Core v1.0 RC** (v1.0.0-rc.1). Core syntax, config, `init`/`check`/\n\u003e `build`/`clean`/`verify`, Core checker semantics, diagnostic code identity,\n\u003e and emitted `.py`/`.pyi` compatibility are the release-candidate surfaces.\n\u003e Supported DX, Experimental opt-in, and Roadmap / prototype features remain\n\u003e outside the Core v1.0 RC compatibility promise and are tracked separately in\n\u003e the Experimental Feature Registry.\n\u003e This is not a full product-wide v1.0 RC: editor UX, VS Code packaging,\n\u003e `watch`, migration heuristics, and research slices remain outside the stable\n\u003e v1.0 promise until their own gates are complete.\n\u003e Bug reports and contributions are very welcome.\n\n## Install\n\n```bash\npip install type-python\ntypepython init --dir hello \u0026\u0026 cd hello\ntypepython check --project .\ntypepython build --project .\n```\n\nYou now have `.typepython/build/` with `.py` + `.pyi` + `py.typed` ready for\nany Python interpreter, IDE, or downstream type checker.\n\n- **Wheels** are prebuilt for Windows AMD64, macOS x86_64, macOS arm64, and Linux x86_64.\n  Other platforms fall back to source and need Rust + `cargo`. Wheels are tagged\n  `py3-none-\u003cplatform\u003e` because the bundled Rust CLI is platform-specific while\n  the Python wrapper is ABI-independent.\n- **Python**: the package bridge supports 3.9+; generated projects target Python 3.10 through 3.14.\n\n## See it in 15 lines\n\n```python\n# src/app/expr.tpy\n\nsealed class Expr:\n    pass\n\nclass Num(Expr):  value: int\nclass Add(Expr):  left: Expr; right: Expr\nclass Neg(Expr):  operand: Expr\n\ndef evaluate(expr: Expr) -\u003e int:\n    match expr:\n        case Num(value=v):           return v\n        case Add(left=l, right=r):   return evaluate(l) + evaluate(r)\n        case Neg(operand=o):         return -evaluate(o)\n    # No default branch needed — the compiler proves the match is exhaustive.\n    # Add a fourth subclass and TypePython tells you exactly where to update.\n```\n\n`typepython build` lowers that to ordinary Python and writes a matching `.pyi`\nthat any modern type checker can consume — no TypePython runtime required. The\nexhaustiveness proof happens before emit; downstream tools see a normal Python\nclass hierarchy.\n\n## What you write vs. what ships\n\n| You write (`.tpy`)                    | TypePython emits (`.py` / `.pyi`)                         |\n| ------------------------------------- | --------------------------------------------------------- |\n| `interface Drawable:`                 | `class Drawable(Protocol):`                               |\n| `data class User:`                    | `@dataclass class User:`                                  |\n| `sealed class Expr:`                  | ordinary class + `tpy:sealed` marker                      |\n| `overload def parse(...)`             | `@overload def parse(...)`                                |\n| `typealias Pair[T] = tuple[T, T]`     | `T = TypeVar(\"T\")` + `Pair: TypeAlias = tuple[T, T]`      |\n| `def first[T](xs: list[T]) -\u003e T:`     | inline generic on 3.13+, `TypeVar`-based on 3.10 – 3.12   |\n| `unsafe: eval(expr)`                  | valid Python, marker erased — runtime behavior preserved  |\n| `unknown` (must narrow before use)    | `object` in `.pyi`                                        |\n| `Partial[Config]` / `Pick[Config, …]` | expanded `TypedDict` shapes (PEP 655 / 705)               |\n\n## Why not just mypy / pyright / PEP 695?\n\nThe comparison below is about `.tpy` authoring inside the package checked by\nTypePython. Emitted `.py` / `.pyi` remain standard Python typing, so external\nconsumers do not automatically inherit TypePython-only constraints such as\nsealed exhaustiveness or `unknown` strictness.\n\n| Capability                                              | mypy strict | pyright strict | PEP 695 `.py` | **TypePython `.tpy` authoring** |\n| ------------------------------------------------------- | :---------: | :------------: | :-----------: | :--------------------------------: |\n| `sealed class` + compiler-proved exhaustiveness         |      —      |       —        |       —       |          ✅           |\n| `unknown` — safe dynamic boundary, must narrow          |      —      |       —        |       —       |          ✅           |\n| `unsafe:` audit fence for `eval` / `exec` / `setattr`   |      —      |       —        |       —       |          ✅           |\n| First-class `interface` / `data class` / `typealias`    |    via      |     via        |    via        |     keyword           |\n| Inline generics `def f[T]` on **any** target ≥ 3.10     |     3.12+   |     3.12+      |     3.12+     |          ✅           |\n| `TypedDict` transforms (`Partial`, `Pick`, `Readonly`…) |      —      |       —        |       —       |          ✅           |\n| Output consumed by mypy / pyright / basedpyright / ty unmodified | N/A | N/A | ✅ | ✅ |\n\nTypePython doesn't replace those checkers. It sits **one step earlier**: you\nauthor in `.tpy`, the compiler emits standard typed Python that those tools\nthen consume normally.\n\nThe strongest TypePython guarantees are author-time checks. Emitted artifacts\nremain standard Python: sealed exhaustiveness, `unknown` strictness, and\n`unsafe:` fences are enforced by TypePython during authoring, but external\ncheckers see the portable `.py` / `.pyi` boundary. Carrying TypePython-only\nsemantics across that boundary requires an opt-in sidecar, checker plugin, or\nTypePython-aware consumer.\n\n## What you also get\n\n- **Rust-native, incremental compiler** — public-API fingerprints skip\n  downstream rechecks when only a body changes.\n- **Full toolchain** — `init`, `check`, `build`, `watch`, `clean`, `verify`,\n  `compat`, `api-diff`, `type-health`, `migrate`, `lsp`.\n- **Supported DX LSP server** — hover, go to definition, references, rename,\n  completions, signature help, real-time diagnostics, and code-action quick fixes.\n  The repository includes a source-installable VS Code extension plus copy-paste\n  setup for Neovim, Helix, Sublime Text, and Emacs. Editor UX and extension\n  packaging are still outside the Core v1.0 RC compatibility promise.\n- **Standard, portable output** — emitted `.py` + `.pyi` work with mypy,\n  pyright, and ty out of the box. PEP 561 `py.typed` is written automatically.\n- **Mixed projects** — `.tpy`, `.py`, and `.pyi` live in the same source tree.\n  `.py` is pass-through; `.pyi` is stub-authoritative.\n\n## For library authors\n\nFive commands aimed at people who *publish* typed Python:\n\n```bash\ntypepython build       --project .\ntypepython verify      --project . --checker-preset all\ntypepython compat      --project . --profile library-portable\ntypepython api-diff    dist/previous.whl .typepython/build\ntypepython type-health --project . --fail-under 85\n```\n\nThese catch missing/stale `py.typed`, wheel ↔ build-tree drift, multi-checker\nportability gaps, public-API drift between releases, and runtime-annotation\nhazards for frameworks that introspect annotations.\nThey validate the standard published surface; they do not make ordinary\ndownstream `.py` checkers enforce TypePython-only facts.\n\n## Documentation\n\n- [Getting Started](https://github.com/type-python/type-python/blob/main/docs/getting-started.md)\n- [Syntax Guide](https://github.com/type-python/type-python/blob/main/docs/syntax-guide.md)\n- [Type System](https://github.com/type-python/type-python/blob/main/docs/type-system.md)\n- [Configuration](https://github.com/type-python/type-python/blob/main/docs/configuration.md)\n- [CLI Reference](https://github.com/type-python/type-python/blob/main/docs/cli-reference.md)\n- [Diagnostics (TPYxxxx codes)](https://github.com/type-python/type-python/blob/main/docs/diagnostics.md)\n- [LSP Integration](https://github.com/type-python/type-python/blob/main/docs/lsp.md)\n- [Interoperability](https://github.com/type-python/type-python/blob/main/docs/interop.md)\n- [Migration Guide](https://github.com/type-python/type-python/blob/main/docs/migration-guide.md)\n- [Framework Adapters](https://github.com/type-python/type-python/blob/main/docs/framework-adapters.md)\n- [Beta Readiness](https://github.com/type-python/type-python/blob/main/docs/beta-readiness.md)\n- [Feature Status](https://github.com/type-python/type-python/blob/main/docs/feature-status.md)\n- [Experimental Feature Registry](https://github.com/type-python/type-python/blob/main/docs/experimental-features.md)\n- [Language Spec v1](https://github.com/type-python/type-python/blob/main/docs/spec/language-spec-v1.md)\n\n## Links\n\n- [Repository](https://github.com/type-python/type-python)\n- [Issues / bug reports](https://github.com/type-python/type-python/issues)\n- [Contributing](https://github.com/type-python/type-python/blob/main/docs/contributing.md)\n- [License (MIT)](https://github.com/type-python/type-python/blob/main/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftype-python%2Ftype-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftype-python%2Ftype-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftype-python%2Ftype-python/lists"}