You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/platforms/python/uv.md
+18-11Lines changed: 18 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -154,7 +154,7 @@ requires-python = ">=3.9"
154
154
155
155
### What Are UV Tools And How to Use Them?
156
156
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:
158
158
159
159
UV provides two special interfaces to manage these packages:
160
160
@@ -187,26 +187,33 @@ uv run ruff check --fix # lint (what flake8 used to do)
187
187
188
188
#### Typing
189
189
190
-
first install it
190
+
first install [ty](https://pydevtools.com/handbook/reference/ty/)
191
191
192
192
```shell
193
-
uv add --dev pyright
193
+
uv add --dev ty
194
194
```
195
195
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:
197
199
198
200
```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"
204
209
```
205
210
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).
207
212
208
213
#### Testing
209
214
215
+
Refer for full testing [docs](./testing.md)
216
+
210
217
```shell
211
218
uv add --dev pytest
212
219
```
@@ -397,7 +404,7 @@ uv cache prune
397
404
* How to Learn Python From Scratch in 2025: [An Expert Guide](https://www.datacamp.com/blog/how-to-learn-python-expert-guide)
0 commit comments