Skip to content
Back to top
View this page

# `validate_pyproject.api`

Retrieve JSON schemas for validating dicts representing a `pyproject.toml` file.

class validate_pyproject.api.Validator(plugins: Sequence[PluginProtocol] | AllPlugins = AllPlugins.ALL_PLUGINS, format_validators: Mapping[str, FormatValidationFn] = mappingproxy({'chain': <class 'itertools.chain'>, 'pep440': <function pep440>, 'pep508-identifier': <function pep508_identifier>, 'pep508': <function pep508>, 'pep508-versionspec': <function pep508_versionspec>, 'pep517-backend-reference': <function pep517_backend_reference>, 'trove-classifier': <validate_pyproject.formats._TroveClassifier object>, 'pep561-stub-name': <function pep561_stub_name>, 'url': <function url>, 'python-identifier': <function python_identifier>, 'python-qualified-identifier': <function python_qualified_identifier>, 'python-module-name': <function python_module_name>, 'python-module-name-relaxed': <function python_module_name_relaxed>, 'python-entrypoint-group': <function python_entrypoint_group>, 'python-entrypoint-name': <function python_entrypoint_name>, 'python-entrypoint-reference': <function python_entrypoint_reference>, 'uint8': <function uint8>, 'uint16': <function uint16>, 'uint32': <function uint32>, 'uint64': <function uint64>, 'uint': <function uint>, 'int8': <function int8>, 'int16': <function int16>, 'int32': <function int32>, 'int64': <function int64>, 'int': <function int>, 'SPDX': <function SPDX>, 'import-name': <function import_name>}), extra_validations: Sequence[ValidationFn] = (<function validate_project_dynamic>, <function validate_include_depenency>, <function validate_import_name_issues>), *, extra_plugins: Sequence[PluginProtocol] = ())

  Bases: `object`

  __call__(pyproject: T) → T

    Checks a parsed `pyproject.toml` file (given as `typing.Mapping`) and raises an exception when it is not a valid.

  property extra_validations: Sequence[Callable[[T], T]]

    List of extra validation functions that run after the JSON Schema check

  property formats: Mapping[str, Callable[[str], bool]]

    Mapping between JSON Schema formats and functions that validates them

  property generated_code: str
  property registry: SchemaRegistry
  property schema: Schema

    Top level `pyproject.toml` JSON Schema