ty-extended 0.58.0__py3-none-linux_armv6l.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 +5 -0
- ty/__main__.py +27 -0
- ty/_find_ty.py +102 -0
- ty/py.typed +1 -0
- ty_extended-0.58.0.data/scripts/ty +0 -0
- ty_extended-0.58.0.dist-info/METADATA +163 -0
- ty_extended-0.58.0.dist-info/RECORD +10 -0
- ty_extended-0.58.0.dist-info/WHEEL +4 -0
- ty_extended-0.58.0.dist-info/licenses/LICENSE +21 -0
- ty_extended-0.58.0.dist-info/sboms/ty.cyclonedx.json +11210 -0
ty/__init__.py
ADDED
ty/__main__.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import sys
|
|
5
|
+
|
|
6
|
+
from ty import find_ty_bin
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def _run() -> None:
|
|
10
|
+
ty = find_ty_bin()
|
|
11
|
+
|
|
12
|
+
if sys.platform == "win32":
|
|
13
|
+
import subprocess
|
|
14
|
+
|
|
15
|
+
# Avoid emitting a traceback on interrupt
|
|
16
|
+
try:
|
|
17
|
+
completed_process = subprocess.run([ty, *sys.argv[1:]])
|
|
18
|
+
except KeyboardInterrupt:
|
|
19
|
+
sys.exit(2)
|
|
20
|
+
|
|
21
|
+
sys.exit(completed_process.returncode)
|
|
22
|
+
else:
|
|
23
|
+
os.execvp(ty, [ty, *sys.argv[1:]])
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
if __name__ == "__main__":
|
|
27
|
+
_run()
|
ty/_find_ty.py
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import sys
|
|
5
|
+
import sysconfig
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class TyNotFound(FileNotFoundError): ...
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def find_ty_bin() -> str:
|
|
12
|
+
"""Return the ty binary path."""
|
|
13
|
+
|
|
14
|
+
ty_exe = "ty" + sysconfig.get_config_var("EXE")
|
|
15
|
+
|
|
16
|
+
targets = [
|
|
17
|
+
# The scripts directory for the current Python
|
|
18
|
+
sysconfig.get_path("scripts"),
|
|
19
|
+
# The scripts directory for the base prefix
|
|
20
|
+
sysconfig.get_path("scripts", vars={"base": sys.base_prefix}),
|
|
21
|
+
# Above the package root, e.g., from `pip install --prefix` or `uv run --with`
|
|
22
|
+
(
|
|
23
|
+
# On Windows, with module path `<prefix>/Lib/site-packages/ty`
|
|
24
|
+
_join(_matching_parents(_module_path(), "Lib/site-packages/ty"), "Scripts")
|
|
25
|
+
if sys.platform == "win32"
|
|
26
|
+
# On Unix, with module path `<prefix>/lib/python3.13/site-packages/ty`
|
|
27
|
+
else _join(
|
|
28
|
+
_matching_parents(_module_path(), "lib/python*/site-packages/ty"),
|
|
29
|
+
"bin",
|
|
30
|
+
)
|
|
31
|
+
),
|
|
32
|
+
# Adjacent to the package root, e.g., from `pip install --target`
|
|
33
|
+
# with module path `<target>/ty`
|
|
34
|
+
_join(_matching_parents(_module_path(), "ty"), "bin"),
|
|
35
|
+
# The user scheme scripts directory, e.g., `~/.local/bin`
|
|
36
|
+
sysconfig.get_path("scripts", scheme=_user_scheme()),
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
seen = []
|
|
40
|
+
for target in targets:
|
|
41
|
+
if not target:
|
|
42
|
+
continue
|
|
43
|
+
if target in seen:
|
|
44
|
+
continue
|
|
45
|
+
seen.append(target)
|
|
46
|
+
path = os.path.join(target, ty_exe)
|
|
47
|
+
if os.path.isfile(path):
|
|
48
|
+
return path
|
|
49
|
+
|
|
50
|
+
locations = "\n".join(f" - {target}" for target in seen)
|
|
51
|
+
raise TyNotFound(
|
|
52
|
+
f"Could not find the ty binary in any of the following locations:\n{locations}\n"
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def _module_path() -> str | None:
|
|
57
|
+
path = os.path.dirname(__file__)
|
|
58
|
+
return path
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def _matching_parents(path: str | None, match: str) -> str | None:
|
|
62
|
+
"""
|
|
63
|
+
Return the parent directory of `path` after trimming a `match` from the end.
|
|
64
|
+
The match is expected to contain `/` as a path separator, while the `path`
|
|
65
|
+
is expected to use the platform's path separator (e.g., `os.sep`). The path
|
|
66
|
+
components are compared case-insensitively and a `*` wildcard can be used
|
|
67
|
+
in the `match`.
|
|
68
|
+
"""
|
|
69
|
+
from fnmatch import fnmatch
|
|
70
|
+
|
|
71
|
+
if not path:
|
|
72
|
+
return None
|
|
73
|
+
parts = path.split(os.sep)
|
|
74
|
+
match_parts = match.split("/")
|
|
75
|
+
if len(parts) < len(match_parts):
|
|
76
|
+
return None
|
|
77
|
+
|
|
78
|
+
if not all(
|
|
79
|
+
fnmatch(part, match_part)
|
|
80
|
+
for part, match_part in zip(reversed(parts), reversed(match_parts))
|
|
81
|
+
):
|
|
82
|
+
return None
|
|
83
|
+
|
|
84
|
+
return os.sep.join(parts[: -len(match_parts)])
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def _join(path: str | None, *parts: str) -> str | None:
|
|
88
|
+
if not path:
|
|
89
|
+
return None
|
|
90
|
+
return os.path.join(path, *parts)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def _user_scheme() -> str:
|
|
94
|
+
if sys.version_info >= (3, 10):
|
|
95
|
+
user_scheme = sysconfig.get_preferred_scheme("user")
|
|
96
|
+
elif os.name == "nt":
|
|
97
|
+
user_scheme = "nt_user"
|
|
98
|
+
elif sys.platform == "darwin" and sys._framework: # ty: ignore[unresolved-attribute]
|
|
99
|
+
user_scheme = "osx_framework_user"
|
|
100
|
+
else:
|
|
101
|
+
user_scheme = "posix_user"
|
|
102
|
+
return user_scheme
|
ty/py.typed
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
Binary file
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ty-extended
|
|
3
|
+
Version: 0.58.0
|
|
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.14
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Programming Language :: Rust
|
|
19
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
20
|
+
Classifier: Topic :: Software Development :: Testing
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Summary: A ty fork with semantic extension support.
|
|
25
|
+
Keywords: ty,typing,analysis,check,extensions
|
|
26
|
+
Home-Page: https://github.com/regularkevvv/ty-extended/
|
|
27
|
+
Author-email: Kevin Castro <hola@kev.pe>
|
|
28
|
+
Requires-Python: >=3.8
|
|
29
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
30
|
+
Project-URL: Changelog, https://github.com/regularkevvv/ty-extended/blob/main/CHANGELOG.md
|
|
31
|
+
Project-URL: Releases, https://github.com/regularkevvv/ty-extended/releases
|
|
32
|
+
Project-URL: Repository, https://github.com/regularkevvv/ty-extended
|
|
33
|
+
|
|
34
|
+
# ty-extended
|
|
35
|
+
|
|
36
|
+
[](https://pypi.org/project/ty-extended/)
|
|
37
|
+
|
|
38
|
+
A fork of ty with semantic extension support for framework-aware type checking.
|
|
39
|
+
|
|
40
|
+
<br />
|
|
41
|
+
|
|
42
|
+
<p align="center">
|
|
43
|
+
<img alt="Shows a bar chart with benchmark results." width="500px" src="https://raw.githubusercontent.com/astral-sh/ty/main/docs/assets/ty-benchmark-cli-light.svg">
|
|
44
|
+
</p>
|
|
45
|
+
|
|
46
|
+
<p align="center">
|
|
47
|
+
<i>Type checking the <a href="https://github.com/home-assistant/core">home-assistant</a> project without caching.</i>
|
|
48
|
+
</p>
|
|
49
|
+
|
|
50
|
+
<br />
|
|
51
|
+
|
|
52
|
+
ty-extended builds on [Astral's ty](https://github.com/astral-sh/ty) and keeps the command-line
|
|
53
|
+
executable named `ty`. The fork adds a semantic extension protocol, a Rust SDK for extension
|
|
54
|
+
authors, and live WASM extension execution.
|
|
55
|
+
|
|
56
|
+
ty-extended tracks ty's beta checker and language server while the extension protocol stabilizes.
|
|
57
|
+
|
|
58
|
+
## Highlights
|
|
59
|
+
|
|
60
|
+
- 10x - 100x faster than mypy and Pyright
|
|
61
|
+
- Comprehensive [diagnostics](https://docs.astral.sh/ty/features/diagnostics/) with rich contextual information
|
|
62
|
+
- 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
|
|
63
|
+
- 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)
|
|
64
|
+
- [Language server](https://docs.astral.sh/ty/features/language-server/) with code navigation, completions, code actions, auto-import, inlay hints, on-hover help, etc.
|
|
65
|
+
- 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
|
|
66
|
+
- 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
|
|
67
|
+
- 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
|
|
68
|
+
[sophisticated reachability analysis](https://docs.astral.sh/ty/features/type-system/#reachability-based-on-types)
|
|
69
|
+
|
|
70
|
+
## Getting started
|
|
71
|
+
|
|
72
|
+
Run ty with [uvx](https://docs.astral.sh/uv/guides/tools/#running-tools) to get started quickly:
|
|
73
|
+
|
|
74
|
+
```shell
|
|
75
|
+
uvx --from ty-extended ty check
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Or, check out the [ty playground](https://play.ty.dev) to try it out in your browser.
|
|
79
|
+
|
|
80
|
+
To learn more about using ty-extended, see the [documentation](https://github.com/astral-sh/ty/blob/0.58.0/docs/index.md).
|
|
81
|
+
|
|
82
|
+
## Extension SDK
|
|
83
|
+
|
|
84
|
+
ty-extended also publishes the Rust crates extension authors use to build semantic extensions:
|
|
85
|
+
|
|
86
|
+
- [`ty_plugin_protocol`](https://crates.io/crates/ty_plugin_protocol): the stable JSON wire
|
|
87
|
+
protocol for manifests, requests, responses, claims, and patches.
|
|
88
|
+
- [`ty_plugin_sdk`](https://crates.io/crates/ty_plugin_sdk): the author-facing SDK with
|
|
89
|
+
`ManifestBuilder`, the `Plugin` trait, typed DSL helpers, JSON dispatch, and WASM exports.
|
|
90
|
+
|
|
91
|
+
Start with the [extension authoring guide](https://github.com/astral-sh/ty/blob/0.58.0/docs/extension-authoring.md) for a working crate
|
|
92
|
+
layout, manifest claims, hook methods, and packaging guidance.
|
|
93
|
+
|
|
94
|
+
## Installation
|
|
95
|
+
|
|
96
|
+
To install ty-extended, see the [installation](https://github.com/astral-sh/ty/blob/0.58.0/docs/installation.md) documentation.
|
|
97
|
+
|
|
98
|
+
To add the ty language server to your editor, see the [editor integration](https://docs.astral.sh/ty/editors/) guide.
|
|
99
|
+
|
|
100
|
+
## Getting help
|
|
101
|
+
|
|
102
|
+
If you have questions or want to report a bug, please open an
|
|
103
|
+
[issue](https://github.com/regularkevvv/ty-extended/issues) in this repository.
|
|
104
|
+
|
|
105
|
+
## Contributing
|
|
106
|
+
|
|
107
|
+
Most of the implementation lives in the `ruff` submodule, which points at
|
|
108
|
+
[regularkevvv/ruff-extended](https://github.com/regularkevvv/ruff-extended) for this fork.
|
|
109
|
+
|
|
110
|
+
See the
|
|
111
|
+
[contributing guide](https://github.com/astral-sh/ty/blob/0.58.0/CONTRIBUTING.md) for more details.
|
|
112
|
+
|
|
113
|
+
## Version policy
|
|
114
|
+
|
|
115
|
+
ty-extended uses SemVer-compatible fork versioning that records the upstream ty base:
|
|
116
|
+
|
|
117
|
+
- upstream `0.0.58` maps to `ty-extended 0.58.0`;
|
|
118
|
+
- a second fork release on the same upstream base maps to `ty-extended 0.58.1`;
|
|
119
|
+
- upstream `0.1.50` maps to `ty-extended 0.150.0`;
|
|
120
|
+
- once upstream reaches `1.0.0`, ty-extended follows that shape directly as `1.0.x`.
|
|
121
|
+
|
|
122
|
+
The semantic extension protocol and SDK crates are versioned independently. They are pre-1.0;
|
|
123
|
+
breaking changes may occur between any two `0.0.x` releases.
|
|
124
|
+
|
|
125
|
+
## FAQ
|
|
126
|
+
|
|
127
|
+
<!-- We intentionally use smaller headings for the FAQ items -->
|
|
128
|
+
|
|
129
|
+
<!-- markdownlint-disable MD001 -->
|
|
130
|
+
|
|
131
|
+
#### Which Python versions does ty support?
|
|
132
|
+
|
|
133
|
+
ty officially supports type checking code that targets Python 3.10 and later. Earlier versions
|
|
134
|
+
(Python 3.7 through 3.9) can still be selected, but may result in false negatives or false
|
|
135
|
+
positives due to a lack of bundled standard library stubs.
|
|
136
|
+
|
|
137
|
+
The target version is independent of the Python version used to install ty. For example, ty
|
|
138
|
+
installed from PyPI using Python 3.8 or later can type check code targeting Python 3.7; the
|
|
139
|
+
standalone installer does not require Python at all.
|
|
140
|
+
|
|
141
|
+
#### Why is ty doing \_\_\_\_\_?
|
|
142
|
+
|
|
143
|
+
See our [typing FAQ](https://docs.astral.sh/ty/reference/typing-faq).
|
|
144
|
+
|
|
145
|
+
#### How do you pronounce ty?
|
|
146
|
+
|
|
147
|
+
It's pronounced as "tee - why" ([`/tiː waɪ/`](https://en.wikipedia.org/wiki/Help:IPA/English#Key))
|
|
148
|
+
|
|
149
|
+
#### How should I stylize ty?
|
|
150
|
+
|
|
151
|
+
Just "ty", please.
|
|
152
|
+
|
|
153
|
+
<!-- markdownlint-enable MD001 -->
|
|
154
|
+
|
|
155
|
+
## License
|
|
156
|
+
|
|
157
|
+
ty is licensed under the MIT license ([LICENSE](https://github.com/astral-sh/ty/blob/0.58.0/LICENSE) or
|
|
158
|
+
<https://opensource.org/licenses/MIT>).
|
|
159
|
+
|
|
160
|
+
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in ty
|
|
161
|
+
by you, as defined in the MIT license, shall be licensed as above, without any additional terms or
|
|
162
|
+
conditions.
|
|
163
|
+
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
ty/__init__.py,sha256=meeRIpzSHikJxggwdjyCLpFxOUKRHxDeTJKsguxJkIc,97
|
|
2
|
+
ty/__main__.py,sha256=iNm62mHBYrrMp6DlU9koHqYTygCbhyyK4LxYXnoAABE,520
|
|
3
|
+
ty/_find_ty.py,sha256=QiE6gkacklpjZnTcqoXKId5p4SsaYHiqXrRSP_sWic8,3192
|
|
4
|
+
ty/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
5
|
+
ty_extended-0.58.0.data/scripts/ty,sha256=iGjOaMIMgFOj--638YI-BJGYrB4KwNHhkReiWLth7fs,24373496
|
|
6
|
+
ty_extended-0.58.0.dist-info/METADATA,sha256=XsugJkxvsWhPO88JbHsGWeFaRoOIlzZ5q1Zh-yiq9YM,7589
|
|
7
|
+
ty_extended-0.58.0.dist-info/WHEEL,sha256=peqlCt2WY30zWcANXTs84d-WYP3gl4LqKN4ERxHg1DI,97
|
|
8
|
+
ty_extended-0.58.0.dist-info/licenses/LICENSE,sha256=hg49eoa4TmpwEsemNfxk30dc68bM403-tzpZguxYF2w,1077
|
|
9
|
+
ty_extended-0.58.0.dist-info/sboms/ty.cyclonedx.json,sha256=JYy8t8I-EdMB_hR0zefyhVh8fYzNcwYLt1_peVAWisE,372124
|
|
10
|
+
ty_extended-0.58.0.dist-info/RECORD,,
|
|
@@ -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.
|