A statically-typed authoring language that compiles to standard Python
Project description
TypePython
Write richer types. Emit standard Python.
A statically-typed authoring language that compiles to standard Python.
Write .tpy source files with interface, data class, sealed class, inline generics, and strict null safety. The compiler emits standard .py + .pyi files for Python 3.10-3.14. No custom runtime, no vendor lock-in.
Install
pip install type-python
typepython --help
The Python package bridge supports Python 3.9+. Generated projects can target Python 3.10 through 3.14.
Published wheels bundle the Rust CLI binary. Prebuilt wheels are available for Windows AMD64, macOS x86_64, macOS arm64, and Linux x86_64. Other platforms fall back to the source distribution and require Rust + cargo.
Quick Start
typepython init --dir my-project
cd my-project
typepython check --project .
typepython build --project .
Example source:
# src/app/__init__.tpy
sealed class Expr:
pass
data class Num(Expr):
value: int
data class Add(Expr):
left: Expr
right: Expr
def evaluate(expr: Expr) -> int:
match expr:
case Num(value=v):
return v
case Add(left=l, right=r):
return evaluate(l) + evaluate(r)
# Compiler proves all cases are covered -- no default needed.
What You Get
Your code (.tpy) |
Emitted output (.py / .pyi) |
|---|---|
sealed class Expr: |
class Expr: # tpy:sealed |
data class Num(Expr): |
@dataclass plus ordinary class Num(Expr): |
interface Drawable: |
class Drawable(Protocol): |
overload def f(x: int) -> int: |
@overload plus ordinary def f(x: int) -> int: |
typealias Pair[T] = tuple[T, T] |
T = TypeVar("T"); Pair: TypeAlias = tuple[T, T] |
- Rich type system --
unknown,dynamic,Never, strict nulls, sealed exhaustiveness, generic defaults, TypeVarTuple - TypedDict utilities --
Partial,Required_,Readonly,Mutable,Pick,Omit - Full toolchain --
init,check,build,watch,clean,verify,lsp,migrate - LSP server -- hover, go-to-definition, references, rename, completions, signature help, diagnostics
- Standard output -- emitted
.py+.pyiwork with mypy, pyright, and ty out of the box
Documentation
Links
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file type_python-0.3.0.tar.gz.
File metadata
- Download URL: type_python-0.3.0.tar.gz
- Upload date:
- Size: 964.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65153468381f1929c3c09cfa7f31fd142838251a1c57fac307e35a3d3a7601cf
|
|
| MD5 |
1ab8402e407f42de3df59f1a0f4478fa
|
|
| BLAKE2b-256 |
8c04a070d41a6cc2e9b0880a2b2bafa8a9bdec7ad2c5a797fca27e994d2e40f8
|
Provenance
The following attestation bundles were made for type_python-0.3.0.tar.gz:
Publisher:
publish.yml on type-python/type-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
type_python-0.3.0.tar.gz -
Subject digest:
65153468381f1929c3c09cfa7f31fd142838251a1c57fac307e35a3d3a7601cf - Sigstore transparency entry: 1310679075
- Sigstore integration time:
-
Permalink:
type-python/type-python@679501011d165187b356537de0f8829717897fad -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/type-python
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@679501011d165187b356537de0f8829717897fad -
Trigger Event:
release
-
Statement type:
File details
Details for the file type_python-0.3.0-py3-none-win_amd64.whl.
File metadata
- Download URL: type_python-0.3.0-py3-none-win_amd64.whl
- Upload date:
- Size: 4.5 MB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34752fc5aefa212b3829c9c6e99ef8ce710c6751312b004493234947e312902d
|
|
| MD5 |
ded3bc18debb13ec490aff5a3089f11c
|
|
| BLAKE2b-256 |
d333232e395b2931a23023488c38e8225727aa823025bb8c41249a099cefc025
|
Provenance
The following attestation bundles were made for type_python-0.3.0-py3-none-win_amd64.whl:
Publisher:
publish.yml on type-python/type-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
type_python-0.3.0-py3-none-win_amd64.whl -
Subject digest:
34752fc5aefa212b3829c9c6e99ef8ce710c6751312b004493234947e312902d - Sigstore transparency entry: 1310679292
- Sigstore integration time:
-
Permalink:
type-python/type-python@679501011d165187b356537de0f8829717897fad -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/type-python
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@679501011d165187b356537de0f8829717897fad -
Trigger Event:
release
-
Statement type:
File details
Details for the file type_python-0.3.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.
File metadata
- Download URL: type_python-0.3.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
- Upload date:
- Size: 4.6 MB
- Tags: Python 3, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ab88bd2dff8d16a201d280ca3908630897a8216abf4ecb964fce0b28190f043
|
|
| MD5 |
97f0a9613d467d3bf1652abb66e44e44
|
|
| BLAKE2b-256 |
f09e28b8cbec88917cb7ebae6a6fc9f19b897f08e74783c0424d81271511915a
|
Provenance
The following attestation bundles were made for type_python-0.3.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl:
Publisher:
publish.yml on type-python/type-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
type_python-0.3.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl -
Subject digest:
7ab88bd2dff8d16a201d280ca3908630897a8216abf4ecb964fce0b28190f043 - Sigstore transparency entry: 1310679117
- Sigstore integration time:
-
Permalink:
type-python/type-python@679501011d165187b356537de0f8829717897fad -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/type-python
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@679501011d165187b356537de0f8829717897fad -
Trigger Event:
release
-
Statement type:
File details
Details for the file type_python-0.3.0-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: type_python-0.3.0-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 4.1 MB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5c1370c6d2ae82bef6c3e97d6b78c4adb6a6b7b65c8bfc2e18de192c61f9db2
|
|
| MD5 |
1a58a26329f5179077e12ac4d3ad38b3
|
|
| BLAKE2b-256 |
fd1a708791988a2096382c262cd098d5ac37cb7f64116c0cee2690a0e5a2e997
|
Provenance
The following attestation bundles were made for type_python-0.3.0-py3-none-macosx_11_0_arm64.whl:
Publisher:
publish.yml on type-python/type-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
type_python-0.3.0-py3-none-macosx_11_0_arm64.whl -
Subject digest:
e5c1370c6d2ae82bef6c3e97d6b78c4adb6a6b7b65c8bfc2e18de192c61f9db2 - Sigstore transparency entry: 1310679220
- Sigstore integration time:
-
Permalink:
type-python/type-python@679501011d165187b356537de0f8829717897fad -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/type-python
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@679501011d165187b356537de0f8829717897fad -
Trigger Event:
release
-
Statement type:
File details
Details for the file type_python-0.3.0-py3-none-macosx_10_13_x86_64.whl.
File metadata
- Download URL: type_python-0.3.0-py3-none-macosx_10_13_x86_64.whl
- Upload date:
- Size: 4.5 MB
- Tags: Python 3, macOS 10.13+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4568d9a07cba183116f24ec6ed9e7cf262dad5492eeb6fb2adad090b7c9609c9
|
|
| MD5 |
6768deb920e6c17f6a1901146d70d9dc
|
|
| BLAKE2b-256 |
226cc4f3175597d5ab65ed7047a7ff6be721e9636dda7d22a87480fc649e8ee0
|
Provenance
The following attestation bundles were made for type_python-0.3.0-py3-none-macosx_10_13_x86_64.whl:
Publisher:
publish.yml on type-python/type-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
type_python-0.3.0-py3-none-macosx_10_13_x86_64.whl -
Subject digest:
4568d9a07cba183116f24ec6ed9e7cf262dad5492eeb6fb2adad090b7c9609c9 - Sigstore transparency entry: 1310679154
- Sigstore integration time:
-
Permalink:
type-python/type-python@679501011d165187b356537de0f8829717897fad -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/type-python
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@679501011d165187b356537de0f8829717897fad -
Trigger Event:
release
-
Statement type: