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

[pythonic config] properly propagate default values set at the top level for nested config classes #27206

Merged
merged 1 commit into from
Jan 29, 2025

Conversation

benpankow
Copy link
Member

@benpankow benpankow commented Jan 17, 2025

Summary

Ensures that default values on Pythonic Config get properly propagated to inner Config classes, e.g.

class ANestedOpConfig(Config):
    an_int: int = 1
    a_bool: bool = True

class AnOpConfig(Config):
    a_string: str = "foo"
    a_nested: ANestedOpConfig = ANestedOpConfig(an_int=5)

An alternative impl which uses some utils in a stacked PR can be found at #27209.

Test Plan

New unit test; todo add a few more

@benpankow
Copy link
Member Author

@benpankow benpankow merged commit c53f68f into master Jan 29, 2025
5 checks passed
@benpankow benpankow deleted the benpankow/pythonic-config-nesting-defaults branch January 29, 2025 01:31
prha pushed a commit that referenced this pull request Jan 29, 2025
…vel for nested config classes (#27206)

## Summary

Ensures that default values on Pythonic Config get properly propagated
to inner Config classes, e.g.

```python
class ANestedOpConfig(Config):
    an_int: int = 1
    a_bool: bool = True

class AnOpConfig(Config):
    a_string: str = "foo"
    a_nested: ANestedOpConfig = ANestedOpConfig(an_int=5)
```

An alternative impl which uses some utils in a stacked PR can be found
at #27209.

## Test Plan

New unit test; todo add a few more
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants