Skip to main content

flake8-has-docstring

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:

  • PYD001: A Pydantic field which has no default.
  • PYD002: A Pydantic field with a default that is not a Field.
  • PYD002: 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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flake8-pydantic-fields-0.1.0.tar.gz (3.7 kB view details)

Uploaded Source

File details

Details for the file flake8-pydantic-fields-0.1.0.tar.gz.

File metadata

  • Download URL: flake8-pydantic-fields-0.1.0.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.1

File hashes

Hashes for flake8-pydantic-fields-0.1.0.tar.gz
Algorithm Hash digest
SHA256 36ae8d323e204c5fce5cf8a569787fa6fed84648f385fff6886c5ed64d9df239
MD5 9be6dc9cc4c6fd6adf189db4db5c1edf
BLAKE2b-256 ac34a1c1291b3e2f40efa28c211f78629364c2973680724fddfe8536c3946249

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.11

1 file

0.1.10

1 file

0.1.9

1 file

0.1.8

1 file

0.1.7

1 file

0.1.6

1 file

0.1.5

1 file

0.1.4

1 file

0.1.2

1 file

0.1.1

1 file

This release

0.1.0 This release

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page