Name | flake8-pydantic-fields JSON |
Version |
0.1.11
JSON |
| download |
home_page | |
Summary | |
upload_time | 2023-06-19 22:25:34 |
maintainer | |
docs_url | None |
author | |
requires_python | >=3.10 |
license | |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# flake8-pydantic-fields
A flake8 plugin that checks that Pydantic models have default values which are Fields, and that those fields have descriptions. This encourages data documentation.
This package adds the following warnings:
- `PF001`: A Pydantic field which has no default.
- `PF002`: A Pydantic field with a default that is not a Field.
- `PF002`: A Pydantic field which has a Field default with no description.
There are no configuration options at this time.
This package uses heuristics to determine whether a class is a Pydantic model. While this could be accomplished by running the code, that is not in the spirit of static analyzers, and it would be considerably slower.
The heuristics are:
It is not a Pydantic model if:
- The class has no base classes.
- The class is annotated with `@dataclass`.
It is a Pydantic model if:
- The name of the base class is `BaseModel` or `GenericModel`.
- The class contains only annotated assignments.
- The class has at least one method decorated with `@validator` or `@root_validator`.
- The class contains an inner `Config` class.
- The class contains only methods with no arguments other than `self`. These are assumed to be transformations on a data model.
- The class contains an attribute annotated as a `ClassVar`.
Raw data
{
"_id": null,
"home_page": "",
"name": "flake8-pydantic-fields",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "",
"keywords": "",
"author": "",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/e1/a4/eab6745280e387badff127ddb003242cb06c0fb5e7515d9924f9811bf5ef/flake8-pydantic-fields-0.1.11.tar.gz",
"platform": null,
"description": "# flake8-pydantic-fields\n\nA flake8 plugin that checks that Pydantic models have default values which are Fields, and that those fields have descriptions. This encourages data documentation.\n\nThis package adds the following warnings:\n\n- `PF001`: A Pydantic field which has no default.\n- `PF002`: A Pydantic field with a default that is not a Field.\n- `PF002`: A Pydantic field which has a Field default with no description.\n\nThere are no configuration options at this time.\n\nThis package uses heuristics to determine whether a class is a Pydantic model. While this could be accomplished by running the code, that is not in the spirit of static analyzers, and it would be considerably slower.\n\nThe heuristics are:\n\nIt is not a Pydantic model if:\n- The class has no base classes.\n- The class is annotated with `@dataclass`.\n\nIt is a Pydantic model if:\n- The name of the base class is `BaseModel` or `GenericModel`.\n- The class contains only annotated assignments.\n- The class has at least one method decorated with `@validator` or `@root_validator`.\n- The class contains an inner `Config` class.\n- The class contains only methods with no arguments other than `self`. These are assumed to be transformations on a data model.\n- The class contains an attribute annotated as a `ClassVar`.\n",
"bugtrack_url": null,
"license": "",
"summary": "",
"version": "0.1.11",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e1a4eab6745280e387badff127ddb003242cb06c0fb5e7515d9924f9811bf5ef",
"md5": "395daf9070d1be11ea60d8b1efbce66a",
"sha256": "1c3f1662f67af9cccccb46cd233d95bec43a0bd6e0a34ae0a6230813bbdbf1eb"
},
"downloads": -1,
"filename": "flake8-pydantic-fields-0.1.11.tar.gz",
"has_sig": false,
"md5_digest": "395daf9070d1be11ea60d8b1efbce66a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 4160,
"upload_time": "2023-06-19T22:25:34",
"upload_time_iso_8601": "2023-06-19T22:25:34.293755Z",
"url": "https://files.pythonhosted.org/packages/e1/a4/eab6745280e387badff127ddb003242cb06c0fb5e7515d9924f9811bf5ef/flake8-pydantic-fields-0.1.11.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-19 22:25:34",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "flake8-pydantic-fields"
}