Skip to content

Commit

Permalink
use compat mode when uv installing editable packages in make dev_inst…
Browse files Browse the repository at this point in the history
…all (#24029)

## Summary & Motivation

After wiping my pyright & base virtual envs, I was unable to get pyright
working, hitting [strange errors that dagster imports were not
found](https://dagsterlabs.slack.com/archives/C03A0D72A6T/p1724874346772169):

```python
/Users/ben/repos/dagster/python_modules/libraries/dagster-shell/dagster_shell/__init__.py:
  1:5: Import "dagster._core.libraries" could not be resolved (reportMissingImports)
```

Some Googling turned up that there are [multiple ways to install
editable packages](astral-sh/uv#3898) & the
default behavior of `uv pip install` is to not install packages in
compat mode, which pyright requires.

We [explicitly opt in in our pyright venv building
code](https://github.com/dagster-io/dagster/blob/master/scripts/run-pyright.py#L304),
but I'm wondering if my base editable installs not using compat mode has
some bleed-over to my pyright venv (e.g. the editable install is
shared)? Either way, making this change, rerunning `make dev_install`
and then rerunning `make rebuild_pyright` seemed to fix my issues.


## Changelog [Bug]

`NOCHANGELOG`
  • Loading branch information
benpankow authored Sep 4, 2024
1 parent 55a0917 commit 9b3bf2d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions scripts/install_dev_python_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@ def main(
# image build!
cmd = ["uv", "pip", "install"] + (["--system"] if system else []) + install_targets

# Force compat mode for editable installs to avoid
# polluting uv cache for pyright install
# See https://github.com/dagster-io/dagster/pull/24212
# and https://github.com/astral-sh/uv/issues/7028
cmd += ["--config-settings", "editable-mode=compat"]

if quiet is not None:
cmd.append(f'-{"q" * quiet}')

Expand Down

0 comments on commit 9b3bf2d

Please sign in to comment.