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

Generically compute dynamic defaults for Fields (Cherry-pick of #16206) #16219

Merged
merged 1 commit into from
Jul 19, 2022

Conversation

stuhood
Copy link
Member

@stuhood stuhood commented Jul 19, 2022

As discussed on #16175, we don't currently consume the "dynamic" defaults of field values for the purposes of parametrize. That is at least partially because there is no generic way to do so: a Field has no way to declare a dynamic default currently, because Fields cannot declare a dependency @rule_helper to compute their value (...yet? see #12934 (comment)).

This change adds a mechanism for generically declaring the default value of a Field. This is definitely not the most ergonomic API: over the next few versions, many dynamic Field defaults will hopefully move to __defaults__. And #12934 (comment) will hopefully allow for significantly cleaning up those that remain.

Fixes #16175.

As discussed on pantsbuild#16175, we don't currently consume the "dynamic" defaults of field values for the purposes of `parametrize`. That is at least partially because there is no generic way to do so: a `Field` has no way to declare a dynamic default currently, because `Field`s cannot declare a dependency `@rule_helper` to compute their value (...yet? see pantsbuild#12934 (comment)).

This change adds a mechanism for generically declaring the default value of a `Field`. This is definitely not the most ergonomic API: over the next few versions, many dynamic `Field` defaults will hopefully move to `__defaults__`. And pantsbuild#12934 (comment) will hopefully allow for significantly cleaning up those that remain.

Fixes pantsbuild#16175.

[ci skip-rust]
[ci skip-build-wheels]
@stuhood stuhood merged commit afcfe58 into pantsbuild:2.13.x Jul 19, 2022
@stuhood stuhood deleted the cherry-pick-16206-to-2.13.x branch July 19, 2022 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants