Describe the bug
Can't use pydantic class fields in code only aliases
To Reproduce
from pydantic import BaseModel, Field, ConfigDict
from typing import Tuple
class CustomBaseModel(BaseModel):
model_config = ConfigDict(
populate_by_name=True,
arbitrary_types_allowed=True
)
class Range(CustomBaseModel):
min_: int | float = Field(alias='Min')
max_: int | float = Field(alias='Max')
def format_to_tuple(self) -> Tuple[int | float, int | float]:
return self.min_, self.max_
p = Range(min_=0, max_=5)
Expected behavior
I expected I can write p = Range(min_=0, max=5)
without IDE warnings
Environments (please complete the following information):
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too