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
Clarify editable install behavior with setuptools and uv (#10888)
* Clarify editable install behavior with setuptools and uv
Following a user question in uv (astral-sh/uv#15652), clarify the documentation around editables.
From my uv experience, import hooks breaking static type checkers is almost exclusively a setuptools problem (see e.g. astral-sh/uv#1708 (comment) and astral-sh/uv#3898), so I clarified the docs that this is update using uv with setuptools.
* Update docs/import-resolution.md
Co-authored-by: DetachHead <57028336+DetachHead@users.noreply.github.com>
* Remove "generally"
---------
Co-authored-by: DetachHead <57028336+DetachHead@users.noreply.github.com>
Copy file name to clipboardExpand all lines: docs/import-resolution.md
+9-7Lines changed: 9 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,25 +41,27 @@ Pyright uses the following mechanisms (in priority order) to determine which Pyt
41
41
3. As a fallback, use the default Python environment (i.e. the one that is invoked when typing `python` in the shell).
42
42
43
43
### Editable installs
44
-
45
-
If you want to use static analysis tools with an editable install, you should configure the editable install to use `.pth` files that contain file paths rather than executable lines (prefixed with `import`) that install import hooks. See your package manager’s documentation for details on how to do this. We have provided some basic information for common package managers below.
44
+
If you want to use static analysis tools with an editable install, you should configure the editable install to use `.pth` files that contain file paths rather than executable lines (prefixed with `import`) that install import hooks.
46
45
47
46
Import hooks can provide an editable installation that is a more accurate representation of your real installation. However, because resolving module locations using an import hook requires executing Python code, they are not usable by Pyright and other static analysis tools. Therefore, if your editable install is configured to use import hooks, Pyright will be unable to find the corresponding source files.
48
47
49
-
#### pip / setuptools
50
-
`pip` (`setuptools`) supports two ways to avoid import hooks:
48
+
Notably, setuptools uses import hooks by default. For setuptools-based editable installs to be usable with Pyright, setuptools needs to be configured to use path-based `.pth` files through the build frontend.
49
+
50
+
#### pip with setuptools
51
+
`pip` with `setuptools` supports two ways to avoid import hooks:
0 commit comments