Skip to content

Commit 330035d

Browse files
committed
Improve error messages for pyproject.toml validation (#3838)
2 parents 865d790 + 04ac2e1 commit 330035d

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

changelog.d/3838.misc.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Improved error messages for ``pyproject.toml`` validations.

setuptools/config/_validate_pyproject/fastjsonschema_validations.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# *** PLEASE DO NOT MODIFY DIRECTLY: Automatically generated code ***
1111

1212

13-
VERSION = "2.16.2"
13+
VERSION = "2.16.3"
1414
import re
1515
from .fastjsonschema_exceptions import JsonSchemaValueException
1616

@@ -185,7 +185,7 @@ def validate_https___setuptools_pypa_io_en_latest_references_keywords_html(data,
185185
if data__packages_is_list:
186186
data__packages_len = len(data__packages)
187187
for data__packages_x, data__packages_item in enumerate(data__packages):
188-
validate_https___setuptools_pypa_io_en_latest_references_keywords_html__definitions_package_name(data__packages_item, custom_formats, (name_prefix or "data") + ".packages[{data__packages_x}]")
188+
validate_https___setuptools_pypa_io_en_latest_references_keywords_html__definitions_package_name(data__packages_item, custom_formats, (name_prefix or "data") + ".packages[{data__packages_x}]".format(**locals()))
189189
data__packages_one_of_count1 += 1
190190
except JsonSchemaValueException: pass
191191
if data__packages_one_of_count1 < 2:
@@ -462,7 +462,7 @@ def validate_https___setuptools_pypa_io_en_latest_references_keywords_html(data,
462462
if REGEX_PATTERNS['.+'].search(data__dynamic__optionaldependencies_key):
463463
if data__dynamic__optionaldependencies_key in data__dynamic__optionaldependencies_keys:
464464
data__dynamic__optionaldependencies_keys.remove(data__dynamic__optionaldependencies_key)
465-
validate_https___setuptools_pypa_io_en_latest_references_keywords_html__definitions_file_directive(data__dynamic__optionaldependencies_val, custom_formats, (name_prefix or "data") + ".dynamic.optional-dependencies.{data__dynamic__optionaldependencies_key}")
465+
validate_https___setuptools_pypa_io_en_latest_references_keywords_html__definitions_file_directive(data__dynamic__optionaldependencies_val, custom_formats, (name_prefix or "data") + ".dynamic.optional-dependencies.{data__dynamic__optionaldependencies_key}".format(**locals()))
466466
if data__dynamic__optionaldependencies_keys:
467467
raise JsonSchemaValueException("" + (name_prefix or "data") + ".dynamic.optional-dependencies must not contain "+str(data__dynamic__optionaldependencies_keys)+" properties", value=data__dynamic__optionaldependencies, name="" + (name_prefix or "data") + ".dynamic.optional-dependencies", definition={'type': 'object', 'propertyNames': {'format': 'python-identifier'}, 'additionalProperties': False, 'patternProperties': {'.+': {'$id': '#/definitions/file-directive', 'title': "'file:' directive", 'description': 'Value is read from a file (or list of files and then concatenated)', 'type': 'object', 'additionalProperties': False, 'properties': {'file': {'oneOf': [{'type': 'string'}, {'type': 'array', 'items': {'type': 'string'}}]}}, 'required': ['file']}}}, rule='additionalProperties')
468468
data__dynamic__optionaldependencies_len = len(data__dynamic__optionaldependencies)
@@ -810,7 +810,7 @@ def validate_https___packaging_python_org_en_latest_specifications_declaring_pro
810810
if data__authors_is_list:
811811
data__authors_len = len(data__authors)
812812
for data__authors_x, data__authors_item in enumerate(data__authors):
813-
validate_https___packaging_python_org_en_latest_specifications_declaring_project_metadata___definitions_author(data__authors_item, custom_formats, (name_prefix or "data") + ".authors[{data__authors_x}]")
813+
validate_https___packaging_python_org_en_latest_specifications_declaring_project_metadata___definitions_author(data__authors_item, custom_formats, (name_prefix or "data") + ".authors[{data__authors_x}]".format(**locals()))
814814
if "maintainers" in data_keys:
815815
data_keys.remove("maintainers")
816816
data__maintainers = data["maintainers"]
@@ -820,7 +820,7 @@ def validate_https___packaging_python_org_en_latest_specifications_declaring_pro
820820
if data__maintainers_is_list:
821821
data__maintainers_len = len(data__maintainers)
822822
for data__maintainers_x, data__maintainers_item in enumerate(data__maintainers):
823-
validate_https___packaging_python_org_en_latest_specifications_declaring_project_metadata___definitions_author(data__maintainers_item, custom_formats, (name_prefix or "data") + ".maintainers[{data__maintainers_x}]")
823+
validate_https___packaging_python_org_en_latest_specifications_declaring_project_metadata___definitions_author(data__maintainers_item, custom_formats, (name_prefix or "data") + ".maintainers[{data__maintainers_x}]".format(**locals()))
824824
if "keywords" in data_keys:
825825
data_keys.remove("keywords")
826826
data__keywords = data["keywords"]
@@ -883,7 +883,7 @@ def validate_https___packaging_python_org_en_latest_specifications_declaring_pro
883883
if REGEX_PATTERNS['^.+$'].search(data__entrypoints_key):
884884
if data__entrypoints_key in data__entrypoints_keys:
885885
data__entrypoints_keys.remove(data__entrypoints_key)
886-
validate_https___packaging_python_org_en_latest_specifications_declaring_project_metadata___definitions_entry_point_group(data__entrypoints_val, custom_formats, (name_prefix or "data") + ".entry-points.{data__entrypoints_key}")
886+
validate_https___packaging_python_org_en_latest_specifications_declaring_project_metadata___definitions_entry_point_group(data__entrypoints_val, custom_formats, (name_prefix or "data") + ".entry-points.{data__entrypoints_key}".format(**locals()))
887887
if data__entrypoints_keys:
888888
raise JsonSchemaValueException("" + (name_prefix or "data") + ".entry-points must not contain "+str(data__entrypoints_keys)+" properties", value=data__entrypoints, name="" + (name_prefix or "data") + ".entry-points", definition={'$$description': ['Instruct the installer to expose the given modules/functions via', '``entry-point`` discovery mechanism (useful for plugins).', 'More information available in the `Python packaging guide', '<https://packaging.python.org/specifications/entry-points/>`_.'], 'propertyNames': {'format': 'python-entrypoint-group'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'$id': '#/definitions/entry-point-group', 'title': 'Entry-points', 'type': 'object', '$$description': ['Entry-points are grouped together to indicate what sort of capabilities they', 'provide.', 'See the `packaging guides', '<https://packaging.python.org/specifications/entry-points/>`_', 'and `setuptools docs', '<https://setuptools.pypa.io/en/latest/userguide/entry_point.html>`_', 'for more information.'], 'propertyNames': {'format': 'python-entrypoint-name'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'type': 'string', '$$description': ['Reference to a Python object. It is either in the form', '``importable.module``, or ``importable.module:object.attr``.'], 'format': 'python-entrypoint-reference', '$comment': 'https://packaging.python.org/specifications/entry-points/'}}}}}, rule='additionalProperties')
889889
data__entrypoints_len = len(data__entrypoints)
@@ -907,7 +907,7 @@ def validate_https___packaging_python_org_en_latest_specifications_declaring_pro
907907
if data__dependencies_is_list:
908908
data__dependencies_len = len(data__dependencies)
909909
for data__dependencies_x, data__dependencies_item in enumerate(data__dependencies):
910-
validate_https___packaging_python_org_en_latest_specifications_declaring_project_metadata___definitions_dependency(data__dependencies_item, custom_formats, (name_prefix or "data") + ".dependencies[{data__dependencies_x}]")
910+
validate_https___packaging_python_org_en_latest_specifications_declaring_project_metadata___definitions_dependency(data__dependencies_item, custom_formats, (name_prefix or "data") + ".dependencies[{data__dependencies_x}]".format(**locals()))
911911
if "optional-dependencies" in data_keys:
912912
data_keys.remove("optional-dependencies")
913913
data__optionaldependencies = data["optional-dependencies"]
@@ -926,7 +926,7 @@ def validate_https___packaging_python_org_en_latest_specifications_declaring_pro
926926
if data__optionaldependencies_val_is_list:
927927
data__optionaldependencies_val_len = len(data__optionaldependencies_val)
928928
for data__optionaldependencies_val_x, data__optionaldependencies_val_item in enumerate(data__optionaldependencies_val):
929-
validate_https___packaging_python_org_en_latest_specifications_declaring_project_metadata___definitions_dependency(data__optionaldependencies_val_item, custom_formats, (name_prefix or "data") + ".optional-dependencies.{data__optionaldependencies_key}[{data__optionaldependencies_val_x}]")
929+
validate_https___packaging_python_org_en_latest_specifications_declaring_project_metadata___definitions_dependency(data__optionaldependencies_val_item, custom_formats, (name_prefix or "data") + ".optional-dependencies.{data__optionaldependencies_key}[{data__optionaldependencies_val_x}]".format(**locals()))
930930
if data__optionaldependencies_keys:
931931
raise JsonSchemaValueException("" + (name_prefix or "data") + ".optional-dependencies must not contain "+str(data__optionaldependencies_keys)+" properties", value=data__optionaldependencies, name="" + (name_prefix or "data") + ".optional-dependencies", definition={'type': 'object', 'description': 'Optional dependency for the project', 'propertyNames': {'format': 'pep508-identifier'}, 'additionalProperties': False, 'patternProperties': {'^.+$': {'type': 'array', 'items': {'$id': '#/definitions/dependency', 'title': 'Dependency', 'type': 'string', 'description': 'Project dependency specification according to PEP 508', 'format': 'pep508'}}}}, rule='additionalProperties')
932932
data__optionaldependencies_len = len(data__optionaldependencies)

0 commit comments

Comments
 (0)