Skip to content

Commit 8975825

Browse files
committed
fix: replace pyright with ty
1 parent 4b70013 commit 8975825

File tree

1 file changed

+18
-11
lines changed
  • docs/platforms/python

1 file changed

+18
-11
lines changed

docs/platforms/python/uv.md

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ requires-python = ">=3.9"
154154

155155
### What Are UV Tools And How to Use Them?
156156

157-
Some Python packages are exposed as command-line tools like `ruff` or `black` for code formatting and linting, `pytest` for testing, `pyright` for type checking, etc. UV provides two special interfaces to manage these packages:
157+
Some Python packages are exposed as command-line tools like `ruff` or `black` for code formatting and linting, `pytest` for testing, `ty` for type checking, etc. UV provides two special interfaces to manage these packages:
158158

159159
UV provides two special interfaces to manage these packages:
160160

@@ -187,26 +187,33 @@ uv run ruff check --fix # lint (what flake8 used to do)
187187

188188
#### Typing
189189

190-
first install it
190+
first install [ty](https://pydevtools.com/handbook/reference/ty/)
191191

192192
```shell
193-
uv add --dev pyright
193+
uv add --dev ty
194194
```
195195

196-
[configure](https://github.com/microsoft/pyright/blob/main/docs/configuration.md) it
196+
[configure](https://github.com/astral-sh/ty/blob/main/docs/reference/configuration.md) it
197+
198+
Example configuration:
197199

198200
```toml
199-
[tool.pyright]
200-
venvPath = "." # uv installs the venv in the current dir
201-
venv = ".venv" # in a folder called `.venv`
202-
strict = ["**/*.py"] # use 'strict' checking on all files
203-
pythonVersion = "3.12" # if library, specify the _lowest_ you support
201+
[tool.ty]
202+
respect-ignore-files = true
203+
204+
[tool.ty.rules]
205+
unused-ignore-comment = "warn"
206+
redundant-cast = "ignore"
207+
possibly-unbound-attribute = "error"
208+
possibly-unbound-import = "error"
204209
```
205210

206-
And now you can run it with `uv run pyright`. And, as with the formatters/linters, you should get it integrated with your editor.
211+
And now you can run it with `uv run ty check example.py`. And, as with the type checker, you should get it integrated with your [editor](https://marketplace.visualstudio.com/items?itemName=astral-sh.ty).
207212

208213
#### Testing
209214

215+
Refer for full testing [docs](./testing.md)
216+
210217
```shell
211218
uv add --dev pytest
212219
```
@@ -397,7 +404,7 @@ uv cache prune
397404
* How to Learn Python From Scratch in 2025: [An Expert Guide](https://www.datacamp.com/blog/how-to-learn-python-expert-guide)
398405
* UV [features](https://github.com/astral-sh/uv/blob/main/docs/getting-started/features.md)
399406
* UV [Working on projects](https://docs.astral.sh/uv/guides/projects/)
400-
* UV [Python Developer Tooling Handbook](https://pydevtools.com/handbook/)
407+
* UV ***[Python Developer Tooling Handbook](https://pydevtools.com/handbook/)
401408
* Beyond Hypermodern: [Python is easy now](https://rdrn.me/postmodern-python/)
402409
* Python UV: [The Ultimate Guide to the Fastest Python Package Manager](https://www.datacamp.com/tutorial/python-uv)
403410
* [Writing your pyproject.toml](https://packaging.python.org/en/latest/guides/writing-pyproject-toml/)

0 commit comments

Comments
 (0)