facebook / facebook/pyrefly

Editable installs from uv workspaces excluded by project-exclude-heuristics

Open
#2,667 3 comments 2 reactions 1 assignee Claimed by @kinto0 View on GitHub
configuration language-server
Dominant language
Rust
Stars
7k
Forks
516
PR merge metrics
No merged PRs in 30d

Description

### Describe the Bug

# Problem

When a workspace member is added as a dependency via `uv add`, uv installs it as an editable install under the interpreter's site-packages path, see the [uv workspace docs](https://docs.astral.sh/uv/concepts/projects/workspaces/) for details. Pyrefly's `project-exclude-heuristics` then excludes this path from type checking, so errors in workspace packages go unreported. Explicitly including the package path in config produces an include/exclude conflict error.

# Reproduction

```sh
# Fresh project
mkdir repro && cd repro
uv init --package
uv init --lib packages/my-lib

# Add a deliberate type error
cat > packages/my-lib/src/my_lib/main.py << 'EOF'
my_int: int = "not int"
EOF

# Check without the dependency link - error reported correctly
uvx pyrefly init
uvx pyrefly check
# 1 error
# Now add the lib as a workspace dependency
uv add my_lib
uvx pyrefly check
# 0 errors
```

## Behavior

After `uv add my_lib`, pyrefly no longer reports the type error. The editable install path ends up in `interpreter_site_package_path`, which `project-exclude-heuristics` excludes. Trying to explicitly include the path in config produces an include/exclude conflict error, since the heuristic exclusion and user-specified inclusion appear to be treated at the same priority level.

It might be worth either recognizing editable installs as local sources, or letting explicit user includes take precedence over heuristic exclusions.

### Sandbox Link

_No response_

### (Only applicable for extension issues) IDE Information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.