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 6fbb97e
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 1 deletion.
28 changes: 27 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,33 @@

"tool": {
"type": "object"
},
"dependency-groups": {
"type": "object",
"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",
"format": "pep508"
},
{
"type": "object",
"additionalProperties": false,
"properties": {
"include-group": {
"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 6fbb97e

Please sign in to comment.