mirror of
https://github.com/kennethreitz/pydantic.git
synced 2026-06-05 23:00:18 +00:00
Remove Cython & Move to pyproject.toml (#4473)
* Remove Cython * fix CI * fix coverage * fix tests * switching to pypyroject.toml * pre-commit all and use pre-commit for linting * no mypy tests on macos and windows on ci, use flake8-pyproject * fix docs and tests CI * check build is working * drop pytest-cov * window and macos ci with 3.11, reduce filtering * use pip-tools to pin all dependencies * fix docs and fastapi tests * fix test deps for 3.7 * no cache on tests job * revert fastapi changes, fix coverage * fix mypy coverage * test with older mypy * dotenv not required for mypy tests * split testing requirements std and extra * typo * @PrettyWood comments * correct branch name * mypy python_version and pr template
This commit is contained in:
@@ -251,15 +251,15 @@ The specific configuration **`frozen`** (in beta) has a special meaning.
|
||||
|
||||
It prevents other code from changing a model instance once it's created, keeping it **"frozen"**.
|
||||
|
||||
When using the second version to declare `frozen=True` (with **keyword arguments** in the class definition),
|
||||
Pylance can use it to help you check in your code and **detect errors** when something is trying to set values
|
||||
When using the second version to declare `frozen=True` (with **keyword arguments** in the class definition),
|
||||
Pylance can use it to help you check in your code and **detect errors** when something is trying to set values
|
||||
in a model that is "frozen".
|
||||
|
||||

|
||||
|
||||
## BaseSettings and ignoring Pylance/pyright errors
|
||||
|
||||
Pylance/pyright does not work well with [`BaseSettings`](./usage/settings.md) - fields in settings classes can be
|
||||
Pylance/pyright does not work well with [`BaseSettings`](./usage/settings.md) - fields in settings classes can be
|
||||
configured via environment variables and therefore "required" fields do not have to be explicitly set when
|
||||
initialising a settings instance. However, pyright considers these fields as "required" and will therefore
|
||||
show an error when they're not set.
|
||||
@@ -284,7 +284,7 @@ class Knight(BaseModel):
|
||||
title: str = Field(default='Sir Lancelot') # this is okay
|
||||
age: int = Field(23) # this works fine at runtime but will case an error for pyright
|
||||
|
||||
lance = Knight() # error: Argument missing for parameter "age"
|
||||
lance = Knight() # error: Argument missing for parameter "age"
|
||||
```
|
||||
|
||||
Like the issue with `BaseSettings`, this is a limitation of dataclass transforms and cannot be fixed in pydantic.
|
||||
|
||||
Reference in New Issue
Block a user