compile_pip_requirements: Fix defaulted macro args behaviour #467
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What is the current behavior?
requirements_in
arg cannot be popped from**kwargs
because it is a named argument. So the arg value is always:name + ".in"
requirements_txt
arg is actually set by passingrequirements_locked
to the macro. If you pass the latter, you can set the former. If you just pass the former, the arg value is alwaysname + ".txt"
, similar to the above.The result is that the
.in
file must always be${name}.in
and you have to set the lock file name via an undocumented kwarg.What is the new behavior?
Both args are given
None
defaults which the macro body will immediately detect and replace with thename + ".in"
andname + ".txt"
value if needed.With this change the following macro instantiation now works as expected:
I could have done
requirements_in = requirements_in or name + ".in
, but I wanted to explictly check foNone
and not catch anything falsey.Another alternative is keeping the
= "requirements.in"
defaulting and abandoning the defaulting to thename + <ext>
setup.PR Checklist
Please check if your PR fulfills the following requirements:
.par
files. See CONTRIBUTING.md for infoPR Type
What kind of change does this PR introduce?
Does this PR introduce a breaking change?