-
Notifications
You must be signed in to change notification settings - Fork 99
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
Evaluate usefulness of pep-593 for structured configs #131
Comments
@till-varoquaux, would love to chat with you about this to see what is currently possible. |
I wanted to mention that the @dataclass
class MySchema:
num: int = field(metadata={"doc": "number of trials", "range": [0, 10]}) Using the PEP 593 annotations feels "cooler" than defining metadata via the Attr classes support this too (not just dataclasses). |
Not sure what the status is of this, and I haven't ever used omegaconf myself, but I found this issue from other issues and thought it might be relevant to mention https://github.com/annotated-types/annotated-types since it actually implements some of the proposals here and is currently being used by Pydantic. |
Thanks @adriangb. |
"This PEP introduces a mechanism to extend the type annotations from PEP 484 with arbitrary metadata."
Some ideas below. Note that this is all pseudo code for now.
Documentation annotation
Range annotation for valid input range.
Size unit annotation
Number can be converted from some common base unit or string representation to the specified unit.
File annotations
Not sure about it, File (Or pathlib.Path) should be a properly supported primitive first. but:
The text was updated successfully, but these errors were encountered: