Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow sourcing from only selected fields in pyproject.toml file #359

Open
gbdlin opened this issue Aug 29, 2023 · 1 comment
Open

Allow sourcing from only selected fields in pyproject.toml file #359

gbdlin opened this issue Aug 29, 2023 · 1 comment
Labels
P3 minor: not priorized type: feature request

Comments

@gbdlin
Copy link

gbdlin commented Aug 29, 2023

Is your feature request related to a problem? Please describe.
Often there are multiple sections inside pyproject.toml file that specify dependencies. Not all of those sections are being used in the project directly, for example dev dependencies group from poetry is mostly populated by tools.

Right now the only way to skip this group is to manually duplicate it into the list of ignored dependencies. Allowing for ignoring this whole section would solve this problem.

Note: it was advised at some point to use a similar solution when having normal and dev dependencies split into separate files, but it's not possible to split the pyproject.toml into multiple files.

The other problem it may fix is a situation when a dependency is defined in the wrong group, for example when a runtime project dependency is defined only in dev section.

Describe the solution you'd like
There should be a way to specify for each pyproject.toml deps source which sections should be allowed or excluded. When using pyproject.toml itself to configure FawltyDeps, it can look like this:

[tool.fawltydeps]
deps = [
    { path = "first/pyproject.toml", exclude = ["tool.poetry.group.dev.dependencies", "tool.poetry.dependencies:some-extra-group"] },
    { path = "second/pyproject.toml", only = ["tool.poetry.dependencies"] },
]

Example above shows how to exclude a specific group in poetry, a specific extras group (that can be used with PEP 621 as well)

Describe alternatives you've considered
The alternative is keeping the ignored list up to date, but that means defining each dev dependency twice. It also doesn't solve the situation when there is some directly used dependency lost in the wrong group, as FawltyDeps won't warn about it if it's not on the ignored list (when for tools, it's obvious you forgot to put one in the ignored lists).

Additional context
None

@jherland
Copy link
Member

This is very much in line with #44, except that we'd like to solve this for more than just pyproject.toml dependency groups (and Poetry ones at that). We'd certainly like to provide this, but it's hard to put an ETA on it now.

@jherland jherland added P3 minor: not priorized type: feature request labels Aug 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 minor: not priorized type: feature request
Projects
None yet
Development

No branches or pull requests

2 participants