Skip to content

Commit

Permalink
Update setuptools.schema.json (#206)
Browse files Browse the repository at this point in the history
  • Loading branch information
abravalheri authored Sep 25, 2024
2 parents 6a9d2ed + d1ea8f3 commit 18b3595
Show file tree
Hide file tree
Showing 9 changed files with 100 additions and 0 deletions.
81 changes: 81 additions & 0 deletions src/validate_pyproject/plugins/setuptools.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@
"items": {"type": "string", "format": "python-module-name-relaxed"},
"$comment": "TODO: clarify the relationship with ``packages``"
},
"ext-modules": {
"description": "Extension modules to be compiled by setuptools",
"type": "array",
"items": {"$ref": "#/definitions/ext-module"}
},
"data-files": {
"$$description": [
"``dict``-like structure where each key represents a directory and",
Expand Down Expand Up @@ -254,6 +259,82 @@
{"type": "string", "format": "pep561-stub-name"}
]
},
"ext-module": {
"$id": "#/definitions/ext-module",
"title": "Extension module",
"description": "Parameters to construct a :class:`setuptools.Extension` object",
"type": "object",
"required": ["name", "sources"],
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"format": "python-module-name-relaxed"
},
"sources": {
"type": "array",
"items": {"type": "string"}
},
"include-dirs":{
"type": "array",
"items": {"type": "string"}
},
"define-macros": {
"type": "array",
"items": {
"type": "array",
"items": [
{"description": "macro name", "type": "string"},
{"description": "macro value", "oneOf": [{"type": "string"}, {"type": "null"}]}
],
"additionalItems": false
}
},
"undef-macros": {
"type": "array",
"items": {"type": "string"}
},
"library-dirs": {
"type": "array",
"items": {"type": "string"}
},
"libraries": {
"type": "array",
"items": {"type": "string"}
},
"runtime-library-dirs": {
"type": "array",
"items": {"type": "string"}
},
"extra-objects": {
"type": "array",
"items": {"type": "string"}
},
"extra-compile-args": {
"type": "array",
"items": {"type": "string"}
},
"extra-link-args": {
"type": "array",
"items": {"type": "string"}
},
"export-symbols": {
"type": "array",
"items": {"type": "string"}
},
"swig-opts": {
"type": "array",
"items": {"type": "string"}
},
"depends": {
"type": "array",
"items": {"type": "string"}
},
"language": {"type": "string"},
"optional": {"type": "boolean"},
"py-limited-api": {"type": "boolean"}
}
},
"file-directive": {
"$id": "#/definitions/file-directive",
"title": "'file:' directive",
Expand Down
4 changes: 4 additions & 0 deletions tests/examples/setuptools/11-pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[tool.setuptools]
ext-modules = [
{name = "my.ext", sources = ["hello.c", "world.c"]}
]
3 changes: 3 additions & 0 deletions tests/examples/setuptools/12-pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[[tool.setuptools.ext-modules]]
name = "my.ext"
sources = ["hello.c", "world.c"]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
must not contain {'non-existing-field'}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[[tool.setuptools.ext-modules]]
name = "hello.world"
sources = ["hello.c"]
non-existing-field = "hello"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
must be array
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[[tool.setuptools.ext-modules]]
name = "hello.world"
sources = "hello.c"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
must contain ['name']
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[[tool.setuptools.ext-modules]]
sources = ["hello.c", "world.c"]

0 comments on commit 18b3595

Please sign in to comment.