Open DetachHead opened 1 year ago
Not just dev, but any non-main group
also pdm dev dependencies:
[tool.pdm.dev-dependencies]
lint = ["foo>=1.0.0"]
Same issue exists with rye:
[tool.rye]
managed = true
dev-dependencies = [
"ipykernel>=6.24.0",
...
I foresee the major issue here being that dependency names do not map one-to-one with imported module names. How can we know which maps to which statically?
Unfortunately not possible to know that in advance (unless we hard-code a database of lookups) -- you need access to the built distribution or the virtual environment.
@charliermarsh now that astral controls the entire stack, couldn't uv
be used to resolve this?
I believe https://github.com/fpgmaas/deptry does this and supports Uv, poetry, pip and pdm. (And btw, it's relying on ruff parser for the import detections)
thanks, though it would be nice if this functionality was built into ruff, mainly for its language server so that the errors it reports can be visible in your IDE
in my project, i was importing from dev dependencies in intended to be used by users of my module:
because of this, all my tests were passing because the dependency existed, but the moment a user tried to use it, it crashed because the module was not installed.
it would be nice if ruff had a rule to detect this like this eslint plugin does