-
-
Notifications
You must be signed in to change notification settings - Fork 375
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem? Please describe.
The following is acceptable to mark fields as optional without adding spec to an inner Config
from typing import Optional
import pandera.pandas as pdm
from pandera.typing import pandas as pdm_types
class InputMetadataModel(pdm.DataFrameModel):
size: pdm_types.Series[int]
label: pdm_types.Series[str]
note: Optional[pdm_types.Series[str]]But it will flag against UP007.
Describe the solution you'd like
Allow X | Y annotation in class definition
import pandera.pandas as pdm
from pandera.typing import pandas as pdm_types
class InputMetadataModel(pdm.DataFrameModel):
size: pdm_types.Series[int]
label: pdm_types.Series[str]
note: pdm_types.Series[str] | NoneDescribe alternatives you've considered
It would be nice to allow Field to allow a required bool, similar to how Column exposes such, but that's only available for schema built at runtime.
Certainly each instance of this pattern can include a #noqa tag, but given that there are other ruff related issues, it's worth updating the annotations.
Additional context
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request