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

[Feature Request] --config relative to root #508

Open
RaulWCosta opened this issue Oct 30, 2023 · 1 comment
Open

[Feature Request] --config relative to root #508

RaulWCosta opened this issue Oct 30, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@RaulWCosta
Copy link

Congratulations on the project! 😄

Is your feature request related to a problem? Please describe.

Right now the --config option is not relative to the root argument. That can cause some troubles if a person is executing the command from a different directory than the root.

If I want to execute deptry in a folder below my current folder, I'd need to run deptry path/to/folder --config path/to/folder/pyproject.toml, otherwise the command would look for pyproject.toml in my current directory.

This approach works, but is not very ergonometric to repeat the whole path twice, and besides that, if I want to read a bunch of paths from a file and execute on those paths, I'd need to cat list_of_paths.txt | xargs deptry --config {some bash magic} which is a bit painful.

Describe the solution you would like

--config path be relative to root

@RaulWCosta RaulWCosta added the enhancement New feature or request label Oct 30, 2023
@RaulWCosta RaulWCosta changed the title Feature Request Summary [Feature Request] --config relative to root Oct 30, 2023
@mkniewallner
Copy link
Collaborator

What you suggest is similar to the behaviour deptry used to have before https://github.com/fpgmaas/deptry/releases/tag/0.7.0 got released. In the past, we did not have any way to pass --config, meaning that the CLI always assumed that pyproject.toml was in the directory passed as an argument.

I get how convenient this would be in some situations if the CLI would consider pyproject.toml based on the directory passed as an argument, but I believe that some users might think otherwise, and would expect the option to be relative to the location where the CLI is run. I think this is also more in line with what most other code quality tools do in the Python ecosystem.

As an alternative, maybe we should consider looking for multiple pyproject.toml instead? For instance in your example, running deptry path/to/folder (without passing --config) would search for a pyproject.toml automatically in path/to/folder, and if not found could fallback to a pyproject.toml in the location where the CLI is run from. This might create some complexity though, as one could have a pyproject.toml in the directory, but without anything related to deptry configuration, which could be located in the directory deptry is run from. I think we could take example from what Ruff does though, e.g. also checking if a configuration for deptry exists in pyproject.toml to consider it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants