Skip to content

Commit

Permalink
feat: support PEP 735
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii committed Oct 11, 2024
1 parent 435e09f commit 0a2ed51
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 1 deletion.
31 changes: 30 additions & 1 deletion src/validate_pyproject/pyproject_toml.schema.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",

"$id": "https://packaging.python.org/en/latest/specifications/declaring-build-dependencies/",
"title": "Data structure for ``pyproject.toml`` files",
"$$description": [
Expand Down Expand Up @@ -60,6 +59,36 @@

"tool": {
"type": "object"
},
"dependency-groups": {
"type": "object",
"description": "Dependency groups following PEP 735",
"additionalProperties": false,
"patternProperties": {
"^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9])$": {
"type": "array",
"items": {
"oneOf": [
{
"type": "string",
"description": "Python package specifiers following PEP 508",
"format": "pep508"
},
{
"type": "object",
"additionalProperties": false,
"properties": {
"include-group": {
"description": "Another dependency group to include in this one",
"type": "string",
"pattern": "^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9])$"
}
}
}
]
}
}
}
}
}
}
3 changes: 3 additions & 0 deletions tests/examples/simple/depgroups.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[dependency-groups]
test = ["one", "two"]
other = ["one", {include-group = "test"}]
1 change: 1 addition & 0 deletions tests/invalid-examples/pep735/invalid-group.errors.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dependency-groups` must not contain {'a b'} properties
2 changes: 2 additions & 0 deletions tests/invalid-examples/pep735/invalid-group.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[dependency-groups]
"a b" = ["one"]
1 change: 1 addition & 0 deletions tests/invalid-examples/pep735/invalid-key.errors.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`dependency-groups.mydep[1]` must be valid exactly by one definition
2 changes: 2 additions & 0 deletions tests/invalid-examples/pep735/invalid-key.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[dependency-groups]
mydep = ["one", {other = "two"}]
1 change: 1 addition & 0 deletions tests/invalid-examples/pep735/not-pep508.errors.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`dependency-groups.test[0]` must be valid exactly by one definition (0 matches found)
2 changes: 2 additions & 0 deletions tests/invalid-examples/pep735/not-pep508.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[dependency-groups]
test = [" "]

0 comments on commit 0a2ed51

Please sign in to comment.