fpgmaas/deptry

Increase flexibility regarding development dependencies.

fpgmaas opened this issue · 1 comments

Inspired by this comment of @mkniewallner

#162 proposes to add support for PEP-621. However PEP-621 does not provide any standards for dealing with development dependencies. Currently, deptry has no implemented method to extract development dependencies for such a project.

AFAIK, there are now two main methods of specifying development dependencies for these projects:

  1. As a category/multiple categories under [project.optional-dependencies] in pyproject.toml. A drawback of this approach is that this adds an installation option to end-users, e.g. pip install package[dev], which may be undesirable.
  2. Outside of pyproject.toml, for example in a separate dev-requirements.txt

My initial proposal was to add a CLI command that allows the user to specify which entries under [project.optional-dependencies] are development dependencies, e.g.

[project.optional-dependencies]
develop = ["pytest", "pytest-cov"]
rest = ["docutils>=0.3", "pack ==1.1, ==1.3"]
deptry . --dependencies-dev-keys develop

But this only supports (1) from the above listed ways to specify development dependencies. We might want to provide end-users with more flexibility regarding the detection of development dependencies than we currently support.

On the other hand, we should balance between flexibility and overengineering. I do think additional flexibility only is needed for projects that uses PEP-621 (for now), since for the other projects it's quite straightforward. Below a table of all reasonable combinations I think can occur.

requirements-dev.txt Poetry PDM [tool.pdm.dev-dependencies] PEP-621 [project.optional-dependencies]
requirements.txt x
Poetry x
PDM [project] dependencies x
PEP-621 [project] dependencies x x

close as duplicate