type-python 0.0.7__py3-none-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- type_python-0.0.7.dist-info/METADATA +98 -0
- type_python-0.0.7.dist-info/RECORD +10 -0
- type_python-0.0.7.dist-info/WHEEL +5 -0
- type_python-0.0.7.dist-info/entry_points.txt +2 -0
- type_python-0.0.7.dist-info/licenses/LICENSE +21 -0
- type_python-0.0.7.dist-info/top_level.txt +1 -0
- typepython/__init__.py +5 -0
- typepython/__main__.py +5 -0
- typepython/_runner.py +60 -0
- typepython/bin/typepython.exe +0 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: type-python
|
|
3
|
+
Version: 0.0.7
|
|
4
|
+
Summary: A statically-typed authoring language that compiles to standard Python
|
|
5
|
+
Author: unadlib
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/type-python/type-python
|
|
8
|
+
Project-URL: Repository, https://github.com/type-python/type-python
|
|
9
|
+
Project-URL: Documentation, https://github.com/type-python/type-python/tree/main/docs
|
|
10
|
+
Project-URL: Issues, https://github.com/type-python/type-python/issues
|
|
11
|
+
Keywords: typepython,type-checking,compiler,python,static-typing
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Rust
|
|
20
|
+
Classifier: Topic :: Software Development :: Compilers
|
|
21
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
22
|
+
Classifier: Typing :: Typed
|
|
23
|
+
Requires-Python: >=3.9
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Dynamic: license-file
|
|
27
|
+
|
|
28
|
+
# TypePython
|
|
29
|
+
|
|
30
|
+
**A statically-typed authoring language that compiles to standard Python.**
|
|
31
|
+
|
|
32
|
+
TypePython lets you write `.tpy` source files with features such as `interface`, `data class`, `sealed class`, inline generics, and strict null safety. The compiler emits standard `.py` and `.pyi` files that run on ordinary Python interpreters and type-check with mypy or pyright.
|
|
33
|
+
|
|
34
|
+
## Install
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pip install type-python
|
|
38
|
+
typepython --help
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Published wheels are platform-specific because they bundle the Rust CLI binary. Supported releases publish prebuilt wheels for Windows AMD64, macOS x86_64, macOS arm64, and Linux x86_64, so those platforms can install and run TypePython without Rust. Other platforms fall back to the source distribution and require a Rust toolchain with `cargo`.
|
|
42
|
+
|
|
43
|
+
The Python package bridge supports Python 3.9+. Generated TypePython projects currently target Python 3.10, 3.11, or 3.12.
|
|
44
|
+
|
|
45
|
+
## Quick Start
|
|
46
|
+
|
|
47
|
+
Create a project:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
typepython init --dir my-project
|
|
51
|
+
cd my-project
|
|
52
|
+
typepython check --project .
|
|
53
|
+
typepython build --project .
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Example source:
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
sealed class Expr:
|
|
60
|
+
pass
|
|
61
|
+
|
|
62
|
+
data class Num(Expr):
|
|
63
|
+
value: int
|
|
64
|
+
|
|
65
|
+
data class Add(Expr):
|
|
66
|
+
left: Expr
|
|
67
|
+
right: Expr
|
|
68
|
+
|
|
69
|
+
def evaluate(expr: Expr) -> int:
|
|
70
|
+
match expr:
|
|
71
|
+
case Num(value=v):
|
|
72
|
+
return v
|
|
73
|
+
case Add(left=l, right=r):
|
|
74
|
+
return evaluate(l) + evaluate(r)
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## What You Get
|
|
78
|
+
|
|
79
|
+
- Standard `.py` and `.pyi` output with no custom runtime
|
|
80
|
+
- Type system features such as `unknown`, strict nulls, sealed exhaustiveness, `TypedDict` utilities, and generic defaults
|
|
81
|
+
- CLI commands for `init`, `check`, `build`, `watch`, `clean`, `verify`, `lsp`, and `migrate`
|
|
82
|
+
- Interoperability with standard Python typing tools and package publishing workflows
|
|
83
|
+
|
|
84
|
+
## Documentation
|
|
85
|
+
|
|
86
|
+
- Getting started: <https://github.com/type-python/type-python/blob/main/docs/getting-started.md>
|
|
87
|
+
- Syntax guide: <https://github.com/type-python/type-python/blob/main/docs/syntax-guide.md>
|
|
88
|
+
- Type system: <https://github.com/type-python/type-python/blob/main/docs/type-system.md>
|
|
89
|
+
- Configuration: <https://github.com/type-python/type-python/blob/main/docs/configuration.md>
|
|
90
|
+
- CLI reference: <https://github.com/type-python/type-python/blob/main/docs/cli-reference.md>
|
|
91
|
+
- Interoperability: <https://github.com/type-python/type-python/blob/main/docs/interop.md>
|
|
92
|
+
- Language spec: <https://github.com/type-python/type-python/blob/main/docs/spec/language-spec-v1.md>
|
|
93
|
+
|
|
94
|
+
## Project Links
|
|
95
|
+
|
|
96
|
+
- Repository: <https://github.com/type-python/type-python>
|
|
97
|
+
- Issues: <https://github.com/type-python/type-python/issues>
|
|
98
|
+
- License: <https://github.com/type-python/type-python/blob/main/LICENSE>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type_python-0.0.7.dist-info/licenses/LICENSE,sha256=BMHUZ3id_LOrEdv_GmAbL1ttlKsqjZz14f1_M1tn73k,1089
|
|
2
|
+
typepython/__init__.py,sha256=GEL_90WfM7ygPQ5OHjZp4T22FjoAdXgG3Jxh7gEG1-g,89
|
|
3
|
+
typepython/__main__.py,sha256=m8cggQyLAOSPtb8r-uUv_g53whMoPXtF2NX9yLuPyLg,89
|
|
4
|
+
typepython/_runner.py,sha256=DySWPTud0FIAv2-0xhmwAyt_kk3w3kFJWK8FcYSe858,1777
|
|
5
|
+
typepython/bin/typepython.exe,sha256=-0XmZU94SDpDVQCcKmjeUsy5QDM-Of6rqcJ043P8nG4,10820096
|
|
6
|
+
type_python-0.0.7.dist-info/METADATA,sha256=lvoJL17eIetmibKzJU0b8EdvxFarX7tucBSVnyOeGzA,3930
|
|
7
|
+
type_python-0.0.7.dist-info/WHEEL,sha256=GjDPPQwEcripVP6P2r3RxLa-h5Lb9ifGB7FYYtbLDT0,98
|
|
8
|
+
type_python-0.0.7.dist-info/entry_points.txt,sha256=B5Yjdi-RWaeRy7YUcni1lU_ya2lVZXM8llSFNSKEq0U,56
|
|
9
|
+
type_python-0.0.7.dist-info/top_level.txt,sha256=JFRFjt3AXvRQ99SKMxUVu9e3TOp2QpspvE-jk85uMjU,11
|
|
10
|
+
type_python-0.0.7.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 type-python
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
typepython
|
typepython/__init__.py
ADDED
typepython/__main__.py
ADDED
typepython/_runner.py
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import pathlib
|
|
5
|
+
import shutil
|
|
6
|
+
import subprocess
|
|
7
|
+
import sys
|
|
8
|
+
from typing import Sequence
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def _repo_root() -> pathlib.Path:
|
|
12
|
+
return pathlib.Path(__file__).resolve().parent.parent
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _cargo_typepython_command() -> list[str] | None:
|
|
16
|
+
repo_root = _repo_root()
|
|
17
|
+
cargo_toml = repo_root / "Cargo.toml"
|
|
18
|
+
if not cargo_toml.exists():
|
|
19
|
+
return None
|
|
20
|
+
cargo = shutil.which("cargo")
|
|
21
|
+
if cargo is None:
|
|
22
|
+
return None
|
|
23
|
+
return [cargo, "run", "--manifest-path", str(cargo_toml), "-p", "typepython-cli", "--"]
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _configured_command() -> list[str] | None:
|
|
27
|
+
configured = os.environ.get("TYPEPYTHON_BIN")
|
|
28
|
+
if not configured:
|
|
29
|
+
return None
|
|
30
|
+
return [configured]
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _bundled_command() -> list[str] | None:
|
|
34
|
+
binary_name = "typepython.exe" if os.name == "nt" else "typepython"
|
|
35
|
+
bundled = pathlib.Path(__file__).resolve().parent / "bin" / binary_name
|
|
36
|
+
if not bundled.is_file():
|
|
37
|
+
return None
|
|
38
|
+
return [str(bundled)]
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def _command() -> list[str]:
|
|
42
|
+
configured = _configured_command()
|
|
43
|
+
if configured is not None:
|
|
44
|
+
return configured
|
|
45
|
+
bundled = _bundled_command()
|
|
46
|
+
if bundled is not None:
|
|
47
|
+
return bundled
|
|
48
|
+
cargo_command = _cargo_typepython_command()
|
|
49
|
+
if cargo_command is not None:
|
|
50
|
+
return cargo_command
|
|
51
|
+
raise RuntimeError(
|
|
52
|
+
"Unable to locate the TypePython Rust CLI. Set TYPEPYTHON_BIN or run from a repository checkout with cargo available."
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def main(argv: Sequence[str] | None = None) -> int:
|
|
57
|
+
args = list(sys.argv[1:] if argv is None else argv)
|
|
58
|
+
command = [*_command(), *args]
|
|
59
|
+
completed = subprocess.run(command, check=False)
|
|
60
|
+
return completed.returncode
|
|
Binary file
|