Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Changelog
Development Version
====================

* Added support for specifying package-data for stub packages, #248.


Version 0.24.1
==============
Expand Down
9 changes: 9 additions & 0 deletions src/validate_pyproject/formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,15 @@ def python_module_name_relaxed(value: str) -> bool:
return python_module_name(value.replace("-", "_"))


def package_data_module_name_or_wildcard(value: str) -> bool:
"""Python module name, stubs package name or wildcard used for package-data."""
if value == "*":
return True
if python_module_name(value):
return True
return pep561_stub_name(value)


def python_entrypoint_group(value: str) -> bool:
"""See ``Data model > group`` in the :ref:`PyPA's entry-points specification
<pypa:entry-points>`.
Expand Down
8 changes: 2 additions & 6 deletions src/validate_pyproject/plugins/setuptools.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,7 @@
],
"type": "object",
"additionalProperties": false,
"propertyNames": {
"anyOf": [{"type": "string", "format": "python-module-name"}, {"const": "*"}]
},
"propertyNames": {"type": "string", "format": "package-data-module-name-or-wildcard"},
"patternProperties": {
"^.*$": {"type": "array", "items": {"type": "string"}}
}
Expand All @@ -139,9 +137,7 @@
],
"type": "object",
"additionalProperties": false,
"propertyNames": {
"anyOf": [{"type": "string", "format": "python-module-name"}, {"const": "*"}]
},
"propertyNames": {"type": "string", "format": "package-data-module-name-or-wildcard"},
"patternProperties": {
"^.*$": {"type": "array", "items": {"type": "string"}}
}
Expand Down
4 changes: 4 additions & 0 deletions tests/examples/setuptools/08-pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ packages = ["mypkg-stubs"]

[tool.setuptools.package-data]
"*" = ["*.pyi"]
"mypkg-stubs" = ["METADATA.toml"]

[tool.setuptools.exclude-package-data]
"mypkg-stubs" = ["*.rst"]