-
-
Notifications
You must be signed in to change notification settings - Fork 220
Description
Describe the bug
The Python toolchain detects workspace dependencies by matching [project.dependencies] names against other workspace projects. However, it only matches bare names, dependencies with any PEP 508 qualifier (extras, version specifiers, markers) are silently skipped.
In practice, workspace dependencies in pyproject.toml sometimes include at least one qualifier, here is an example in a uv workspace:
# packages/my-app/pyproject.toml
[project]
dependencies = ["my-lib[server]"]
[tool.uv.sources]
my-lib = { workspace = true }Here my-lib is unambiguously a workspace dep via [tool.uv.sources], but Moon skips it because of the [server] extra. The workaround is to declare dependsOn manually in moon.yml.
Steps to reproduce
- Create a uv workspace with two packages:
my-workspace/
├── pyproject.toml
├── packages/
│ ├── my-lib/
│ │ ├── pyproject.toml
│ │ └── moon.yml
│ └── my-app/
│ ├── pyproject.toml
│ └── moon.yml
- In
packages/my-app/pyproject.toml:
[project]
name = "my-app"
dependencies = ["my-lib[server]"]
[tool.uv.sources]
my-lib = { workspace = true }-
Run
moon project my-app— the "Depends on" section does not listmy-lib. -
Change the dependency to bare
my-lib(no extras); now it's detected.
Expected behavior
my-app should list my-lib as a dependency. Extras, version specifiers, and environment markers are PEP 508 qualifiers on the requirement, they don't change the identity of the package.
Ideally, all of the following (and combinations) should resolve to a dependency on the my-lib workspace project:
| Dependency string | PEP 508 component |
|---|---|
my-lib |
Bare name |
my-lib[server] |
Extras |
my-lib>=1.0 |
Version specifier |
my-lib; python_version >= "3.12" |
Environment marker |
I'm open to contributing a fix, @milesj feel free to assign this to me if you want me to give it a shot.