ty 0.0.1__py3-none-macosx_11_0_arm64.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.
- ty/__init__.py +0 -0
- ty/__main__.py +86 -0
- ty/py.typed +1 -0
- ty-0.0.1.data/scripts/ty +0 -0
- ty-0.0.1.dist-info/METADATA +133 -0
- ty-0.0.1.dist-info/RECORD +8 -0
- ty-0.0.1.dist-info/WHEEL +4 -0
- ty-0.0.1.dist-info/licenses/LICENSE +21 -0
ty/__init__.py
ADDED
|
File without changes
|
ty/__main__.py
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import sys
|
|
5
|
+
import sysconfig
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def find_ty_bin() -> str:
|
|
9
|
+
"""Return the ty binary path."""
|
|
10
|
+
|
|
11
|
+
ty_exe = "ty" + sysconfig.get_config_var("EXE")
|
|
12
|
+
|
|
13
|
+
scripts_path = os.path.join(sysconfig.get_path("scripts"), ty_exe)
|
|
14
|
+
if os.path.isfile(scripts_path):
|
|
15
|
+
return scripts_path
|
|
16
|
+
|
|
17
|
+
if sys.version_info >= (3, 10):
|
|
18
|
+
user_scheme = sysconfig.get_preferred_scheme("user")
|
|
19
|
+
elif os.name == "nt":
|
|
20
|
+
user_scheme = "nt_user"
|
|
21
|
+
elif sys.platform == "darwin" and sys._framework:
|
|
22
|
+
user_scheme = "osx_framework_user"
|
|
23
|
+
else:
|
|
24
|
+
user_scheme = "posix_user"
|
|
25
|
+
|
|
26
|
+
user_path = os.path.join(sysconfig.get_path("scripts", scheme=user_scheme), ty_exe)
|
|
27
|
+
if os.path.isfile(user_path):
|
|
28
|
+
return user_path
|
|
29
|
+
|
|
30
|
+
# Search in `bin` adjacent to package root (as created by `pip install --target`).
|
|
31
|
+
pkg_root = os.path.dirname(os.path.dirname(__file__))
|
|
32
|
+
target_path = os.path.join(pkg_root, "bin", ty_exe)
|
|
33
|
+
if os.path.isfile(target_path):
|
|
34
|
+
return target_path
|
|
35
|
+
|
|
36
|
+
# Search for pip-specific build environments.
|
|
37
|
+
#
|
|
38
|
+
# Expect to find ty in <prefix>/pip-build-env-<rand>/overlay/bin/ty
|
|
39
|
+
# Expect to find a "normal" folder at <prefix>/pip-build-env-<rand>/normal
|
|
40
|
+
#
|
|
41
|
+
# See: https://github.com/pypa/pip/blob/102d8187a1f5a4cd5de7a549fd8a9af34e89a54f/src/pip/_internal/build_env.py#L87
|
|
42
|
+
paths = os.environ.get("PATH", "").split(os.pathsep)
|
|
43
|
+
if len(paths) >= 2:
|
|
44
|
+
|
|
45
|
+
def get_last_three_path_parts(path: str) -> list[str]:
|
|
46
|
+
"""Return a list of up to the last three parts of a path."""
|
|
47
|
+
parts = []
|
|
48
|
+
|
|
49
|
+
while len(parts) < 3:
|
|
50
|
+
head, tail = os.path.split(path)
|
|
51
|
+
if tail or head != path:
|
|
52
|
+
parts.append(tail)
|
|
53
|
+
path = head
|
|
54
|
+
else:
|
|
55
|
+
parts.append(path)
|
|
56
|
+
break
|
|
57
|
+
|
|
58
|
+
return parts
|
|
59
|
+
|
|
60
|
+
maybe_overlay = get_last_three_path_parts(paths[0])
|
|
61
|
+
maybe_normal = get_last_three_path_parts(paths[1])
|
|
62
|
+
if (
|
|
63
|
+
len(maybe_normal) >= 3
|
|
64
|
+
and maybe_normal[-1].startswith("pip-build-env-")
|
|
65
|
+
and maybe_normal[-2] == "normal"
|
|
66
|
+
and len(maybe_overlay) >= 3
|
|
67
|
+
and maybe_overlay[-1].startswith("pip-build-env-")
|
|
68
|
+
and maybe_overlay[-2] == "overlay"
|
|
69
|
+
):
|
|
70
|
+
# The overlay must contain the ty binary.
|
|
71
|
+
candidate = os.path.join(paths[0], ty_exe)
|
|
72
|
+
if os.path.isfile(candidate):
|
|
73
|
+
return candidate
|
|
74
|
+
|
|
75
|
+
raise FileNotFoundError(scripts_path)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
if __name__ == "__main__":
|
|
79
|
+
ty = os.fsdecode(find_ty_bin())
|
|
80
|
+
if sys.platform == "win32":
|
|
81
|
+
import subprocess
|
|
82
|
+
|
|
83
|
+
completed_process = subprocess.run([ty, *sys.argv[1:]])
|
|
84
|
+
sys.exit(completed_process.returncode)
|
|
85
|
+
else:
|
|
86
|
+
os.execvp(ty, [ty, *sys.argv[1:]])
|
ty/py.typed
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
ty-0.0.1.data/scripts/ty
ADDED
|
Binary file
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ty
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Classifier: Development Status :: 4 - Beta
|
|
5
|
+
Classifier: Environment :: Console
|
|
6
|
+
Classifier: Intended Audience :: Developers
|
|
7
|
+
Classifier: Operating System :: OS Independent
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Programming Language :: Python
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
17
|
+
Classifier: Programming Language :: Rust
|
|
18
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
19
|
+
Classifier: Topic :: Software Development :: Testing
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Summary: An extremely fast Python type checker, written in Rust.
|
|
24
|
+
Keywords: ty,typing,analysis,check
|
|
25
|
+
Home-Page: https://github.com/astral-sh/ty/
|
|
26
|
+
Author-email: "Astral Software Inc." <hey@astral.sh>
|
|
27
|
+
Requires-Python: >=3.8
|
|
28
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
29
|
+
Project-URL: Repository, https://github.com/astral-sh/ty
|
|
30
|
+
Project-URL: Changelog, https://github.com/astral-sh/ty/blob/main/CHANGELOG.md
|
|
31
|
+
Project-URL: Releases, https://github.com/astral-sh/ty/releases
|
|
32
|
+
Project-URL: Discord, https://discord.gg/astral-sh
|
|
33
|
+
|
|
34
|
+
# ty
|
|
35
|
+
|
|
36
|
+
[](https://github.com/astral-sh/ty)
|
|
37
|
+
[](https://pypi.python.org/pypi/ty)
|
|
38
|
+
[](https://discord.com/invite/astral-sh)
|
|
39
|
+
|
|
40
|
+
An extremely fast Python type checker and language server, written in Rust.
|
|
41
|
+
|
|
42
|
+
<br />
|
|
43
|
+
|
|
44
|
+
<p align="center">
|
|
45
|
+
<img alt="Shows a bar chart with benchmark results." width="500px" src="https://raw.githubusercontent.com/astral-sh/ty/0.0.1/docs/assets/ty-benchmark-cli.svg">
|
|
46
|
+
</p>
|
|
47
|
+
|
|
48
|
+
<p align="center">
|
|
49
|
+
<i>Type checking the <a href="https://github.com/home-assistant/core">home-assistant</a> project without caching.</i>
|
|
50
|
+
</p>
|
|
51
|
+
|
|
52
|
+
<br />
|
|
53
|
+
|
|
54
|
+
ty is backed by [Astral](https://astral.sh), the creators of
|
|
55
|
+
[uv](https://github.com/astral-sh/uv) and [Ruff](https://github.com/astral-sh/ruff).
|
|
56
|
+
|
|
57
|
+
## Highlights
|
|
58
|
+
|
|
59
|
+
- 10x - 100x faster than mypy and Pyright
|
|
60
|
+
- Comprehensive [diagnostics](https://docs.astral.sh/ty/features/diagnostics/) with rich contextual information
|
|
61
|
+
- Configurable [rule levels](https://docs.astral.sh/ty/rules/), [per-file overrides](https://docs.astral.sh/ty/reference/configuration/#overrides), [suppression comments](https://docs.astral.sh/ty/suppression/), and first-class project support
|
|
62
|
+
- Designed for adoption, with support for [redeclarations](https://docs.astral.sh/ty/features/type-system/#redeclarations) and [partially typed code](https://docs.astral.sh/ty/features/type-system/#gradual-guarantee)
|
|
63
|
+
- [Language server](https://docs.astral.sh/ty/features/language-server/) with code navigation, completions, code actions, auto-import, inlay hints, on-hover help, etc.
|
|
64
|
+
- Fine-grained [incremental analysis](https://docs.astral.sh/ty/features/language-server/#fine-grained-incrementality) designed for fast updates when editing files in an IDE
|
|
65
|
+
- Editor integrations for [VS Code](https://docs.astral.sh/ty/editors/#vs-code), [PyCharm](https://docs.astral.sh/ty/editors/#pycharm), [Neovim](https://docs.astral.sh/ty/editors/#neovim) and more
|
|
66
|
+
- Advanced typing features like first-class [intersection types](https://docs.astral.sh/ty/features/type-system/#intersection-types), advanced [type narrowing](https://docs.astral.sh/ty/features/type-system/#top-and-bottom-materializations), and
|
|
67
|
+
[type-driven reachability analysis](https://docs.astral.sh/ty/features/type-system/#reachability-based-on-types)
|
|
68
|
+
|
|
69
|
+
## Getting started
|
|
70
|
+
|
|
71
|
+
Run ty with [uvx](https://docs.astral.sh/uv/guides/tools/#running-tools) to get started quickly:
|
|
72
|
+
|
|
73
|
+
```shell
|
|
74
|
+
uvx ty check
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Or, check out the [ty playground](https://play.ty.dev) to try it out in your browser.
|
|
78
|
+
|
|
79
|
+
To learn more about using ty, see the [documentation](https://docs.astral.sh/ty/).
|
|
80
|
+
|
|
81
|
+
## Installation
|
|
82
|
+
|
|
83
|
+
To install ty, see the [installation](https://github.com/astral-sh/ty/blob/0.0.1/installation.md) documentation.
|
|
84
|
+
|
|
85
|
+
To add the ty language server to your editor, see the [editor integration](https://github.com/astral-sh/ty/blob/0.0.1/editors.md) guide.
|
|
86
|
+
|
|
87
|
+
## Getting help
|
|
88
|
+
|
|
89
|
+
If you have questions or want to report a bug, please open an
|
|
90
|
+
[issue](https://github.com/astral-sh/ty/issues) in this repository.
|
|
91
|
+
|
|
92
|
+
You may also join our [Discord server](https://discord.com/invite/astral-sh).
|
|
93
|
+
|
|
94
|
+
## Contributing
|
|
95
|
+
|
|
96
|
+
Development of this project takes place in the [Ruff](https://github.com/astral-sh/ruff) repository
|
|
97
|
+
at this time. Please [open pull requests](https://github.com/astral-sh/ruff/pulls) there for changes
|
|
98
|
+
to anything in the `ruff` submodule (which includes all of the Rust source code).
|
|
99
|
+
|
|
100
|
+
See the
|
|
101
|
+
[contributing guide](https://github.com/astral-sh/ty/blob/0.0.1/CONTRIBUTING.md) for more details.
|
|
102
|
+
|
|
103
|
+
## FAQ
|
|
104
|
+
|
|
105
|
+
<!-- We intentionally use smaller headings for the FAQ items -->
|
|
106
|
+
|
|
107
|
+
<!-- markdownlint-disable MD001 -->
|
|
108
|
+
|
|
109
|
+
#### How do you pronounce ty?
|
|
110
|
+
|
|
111
|
+
It's pronounced as "tee - why" ([`/tiː waɪ/`](https://en.wikipedia.org/wiki/Help:IPA/English#Key))
|
|
112
|
+
|
|
113
|
+
#### How should I stylize ty?
|
|
114
|
+
|
|
115
|
+
Just "ty", please.
|
|
116
|
+
|
|
117
|
+
<!-- markdownlint-enable MD001 -->
|
|
118
|
+
|
|
119
|
+
## License
|
|
120
|
+
|
|
121
|
+
ty is licensed under the MIT license ([LICENSE](https://github.com/astral-sh/ty/blob/0.0.1/LICENSE) or
|
|
122
|
+
<https://opensource.org/licenses/MIT>).
|
|
123
|
+
|
|
124
|
+
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in ty
|
|
125
|
+
by you, as defined in the MIT license, shall be licensed as above, without any additional terms or
|
|
126
|
+
conditions.
|
|
127
|
+
|
|
128
|
+
<div align="center">
|
|
129
|
+
<a target="_blank" href="https://astral.sh" style="background:none">
|
|
130
|
+
<img src="https://raw.githubusercontent.com/astral-sh/uv/main/assets/svg/Astral.svg" alt="Made by Astral">
|
|
131
|
+
</a>
|
|
132
|
+
</div>
|
|
133
|
+
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
ty-0.0.1.data/scripts/ty,sha256=r5zugYE6tairGmp6EBjD36IRnoSjwVs9ayQYzy5DAZY,18807952
|
|
2
|
+
ty-0.0.1.dist-info/METADATA,sha256=5hXTzi1iwj-4Mt9biroCJaXhgFHaNlSkd9ZkQnF4K00,6130
|
|
3
|
+
ty-0.0.1.dist-info/WHEEL,sha256=K6RyQz3Ufe0lRcsLav96-6nDgK8JHBgxgxxnbBDYnAE,102
|
|
4
|
+
ty-0.0.1.dist-info/licenses/LICENSE,sha256=hg49eoa4TmpwEsemNfxk30dc68bM403-tzpZguxYF2w,1077
|
|
5
|
+
ty/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
+
ty/__main__.py,sha256=EFz_yrs8nZWhIs1P5u76AQdloJrLT5K3-BwDjBEMi3s,2875
|
|
7
|
+
ty/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
8
|
+
ty-0.0.1.dist-info/RECORD,,
|
ty-0.0.1.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Astral Software Inc.
|
|
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.
|