-
Notifications
You must be signed in to change notification settings - Fork 19
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
Separate pyproject.toml
location from root
argument
#244
Separate pyproject.toml
location from root
argument
#244
Conversation
Codecov Report
@@ Coverage Diff @@
## main #244 +/- ##
=======================================
- Coverage 95.7% 95.6% -0.1%
=======================================
Files 32 32
Lines 915 906 -9
Branches 203 200 -3
=======================================
- Hits 876 867 -9
Misses 26 26
Partials 13 13
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Keeping it as a draft for now, since this might be controversial, and I would like to have your opinion on the changes first. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a very welcome change, thanks! It did not cross my mind, but it seems to be what tools like isort
and black
do as well, so probably also the behaviour users would expect.
As you mentioned, this does mean that we could potentially introduce breaking changes in other projects using deptry
. I think it would be good to not create a release after merging this PR, and then - since the project is also approaching reasonable maturity - to create our first major release after merging both this PR and #245.
Do you agree?
Semantic versioning explicitly authorises introducing breaking changes in Personally, for now, I like that we are able to update the API of the CLI or the library's behaviour without having to give too much thoughts about it, even if it is still a good thing to not break possible current usages of it (like this PR + #245 do, by offering alternatives), and of course, communicate about the changes we are making in the changelog. If we want to respect semantic version, going into There are IMO reasons why major libraries like In any case, I agree that it would be best to tag a release once #245 is also merged, but based on everything mentioned above, I would personally bump the version to |
Thanks, that makes sense. I was unaware that breaking changes can be introduced in version |
PR Checklist
docs
is updatedDescription of changes
deptry
allows passing the root directory as a positional argument, which gives some flexibility to projects that use different kind of structures.This is for instance useful for projects that use an
src
directory structure, like Poetry or Hatch.Unfortunately, the root directory passed as a command line means that the configuration file will be read from the directory, and not from the directory
deptry
is launched from, diverging, in my opinion, to what most other tools in the ecosystem do.This PR is an attempt to fix that by always trying to load
pyproject.toml
from the locationdeptry
is run from, both for reading[tool.deptry]
configuration, or extracting the dependencies if a project uses PEP 621 or Poetry.This means that when running:
deptry
will now search forpyproject.toml
in the location it is run from, whereas currently, doing so will makedeptry
look for apyproject.toml
insrc
directory.The downside is that this could break some projects that did explicitly want to find
pyproject.toml
in a root directory other than.
, but I have a second PR (#245) building upon this one that exposes the--config
argument, making it possible to explicitly pass the location ofpyproject.toml
, giving both flexibility for passing a different root directory and allowing to continue supporting this use case, if it exists.