Automatically use requirements.in if the project uses a requirements.txt + requirements.in-setup#641
Automatically use requirements.in if the project uses a requirements.txt + requirements.in-setup#641
requirements.in if the project uses a requirements.txt + requirements.in-setup#641Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #641 +/- ##
=====================================
Coverage 92.4% 92.4%
=====================================
Files 35 35
Lines 950 958 +8
Branches 175 176 +1
=====================================
+ Hits 878 886 +8
Misses 55 55
Partials 17 17 ☔ View full report in Codecov by Sentry. |
|
Reviewing this made me think that we could simplify a bit the dependency specification detector by getting rid of the intermediate Aside from this refactoring, I'm wondering about 2 things:
|
Yes, definitely! In the earlier approach I did not do that because of the way we had the
I think we should not do that, for two reasons:
|
PR Checklist
docsis updatedDescription of changes
This implements a solution that was proposed by @mkniewallner for the issue described in #608. That is; use a same approach as we use for the
excludeparameter to determine if a user specified the argumentrequirement-files. If no input is provided by the user for this argument and the project contains both a requirements.txt and a requirements.in, use the requirements.in.Considerations:
requirements.infile?DependencySpecificationDetector().detect(): This would make sure thatdeptryalso works if the project only contains arequirements.inand norequirements.txt. But this will log to the user that therequirements.inwill be used before theDependencySpecificationDetectorhas run. This will be a lie if the project detects that Poetry is used for dependency management in theDependencySpecificationDetector.DependencySpecificationDetector-> this seems to violate SRP; now it not only detects, but also overwrites the requirements_files argument if it decides that is necessary.DependencySpecificationDetector().detect(): This means it does not work automatically if the project only contains arequirements.inand norequirements.txt. This should be a rare case, so this solution seems like the best solution to me.If the user does not explicitly set the
requirements-filesargument, the dependency format is detected asrequirements-filebecause the project contains arequirements.txt, andrequirements.inis detected, the user will see the following message: