Add zen_exclude
option to builds
and make_custom_builds_fn
#558
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.
This PR adds the ability to exclude parameters - either by name or by pattern (i.e.
callable[[name], bool]
) - frombuilds
whenpopulate_full_signature=True
.or
Note that this does not enable one to exclude inherited parameters.
Implementation details
I have wanted to implement
zen_exclude
for a while, but doing so would make our typing-overloads forpopulate_full_signature=True
double, which I am absolutely not going to do.Because specifying
zen_exclude
has the same effect, as far as typing is concerned, as a user specifying a target-kwarg in builds, I realized that I can just "smuggle"zen_exclude
into**target_kwargs
. The typing overloads work just fine.The downside to this is that
zen_exclude
does not explicitly appear in the signature ofbuilds
. Thus you will not see it autocomplete nor will you get type-checking on this parameter. This is unfortunate but ultimately it is better to havezen_exclude
with some lack in tooling support rather than not at all.