Skip to content

Commit 884b741

Browse files
authored
Add setuptools ext-modules schema support (SchemaStore#5795)
1 parent dd22b5c commit 884b741

3 files changed

Lines changed: 185 additions & 0 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#:schema ../../schemas/json/pyproject.json
2+
[build-system]
3+
requires = ["setuptools", "wheel"]
4+
build-backend = "setuptools.build_meta"
5+
6+
[project]
7+
name = "extension-project"
8+
version = "0.1.0"
9+
10+
[tool.setuptools]
11+
ext-modules = [{ name = "extension_project.foo" }]

src/schemas/json/partial-setuptools.json

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,14 @@
152152
"format": "python-module-name"
153153
}
154154
},
155+
"ext-modules": {
156+
"$comment": "https://setuptools.pypa.io/en/latest/userguide/ext_modules.html",
157+
"description": "Extension modules to be compiled by setuptools",
158+
"type": "array",
159+
"items": {
160+
"$ref": "#/definitions/ext-module"
161+
}
162+
},
155163
"data-files": {
156164
"type": "object",
157165
"patternProperties": {
@@ -309,6 +317,126 @@
309317
"required": ["attr"],
310318
"description": "Value is read from a module attribute. Supports callables and iterables; unsupported types are cast via ``str()``"
311319
},
320+
"ext-module": {
321+
"title": "Extension module",
322+
"description": "Parameters to construct a :class:`setuptools.Extension` object",
323+
"type": "object",
324+
"required": ["name", "sources"],
325+
"additionalProperties": false,
326+
"properties": {
327+
"name": {
328+
"type": "string",
329+
"format": "python-module-name"
330+
},
331+
"sources": {
332+
"type": "array",
333+
"items": {
334+
"type": "string"
335+
}
336+
},
337+
"include-dirs": {
338+
"type": "array",
339+
"items": {
340+
"type": "string"
341+
}
342+
},
343+
"define-macros": {
344+
"type": "array",
345+
"items": {
346+
"type": "array",
347+
"minItems": 2,
348+
"maxItems": 2,
349+
"items": [
350+
{
351+
"description": "macro name",
352+
"type": "string"
353+
},
354+
{
355+
"description": "macro value",
356+
"oneOf": [
357+
{
358+
"type": "string"
359+
},
360+
{
361+
"type": "null"
362+
}
363+
]
364+
}
365+
],
366+
"additionalItems": false
367+
}
368+
},
369+
"undef-macros": {
370+
"type": "array",
371+
"items": {
372+
"type": "string"
373+
}
374+
},
375+
"library-dirs": {
376+
"type": "array",
377+
"items": {
378+
"type": "string"
379+
}
380+
},
381+
"libraries": {
382+
"type": "array",
383+
"items": {
384+
"type": "string"
385+
}
386+
},
387+
"runtime-library-dirs": {
388+
"type": "array",
389+
"items": {
390+
"type": "string"
391+
}
392+
},
393+
"extra-objects": {
394+
"type": "array",
395+
"items": {
396+
"type": "string"
397+
}
398+
},
399+
"extra-compile-args": {
400+
"type": "array",
401+
"items": {
402+
"type": "string"
403+
}
404+
},
405+
"extra-link-args": {
406+
"type": "array",
407+
"items": {
408+
"type": "string"
409+
}
410+
},
411+
"export-symbols": {
412+
"type": "array",
413+
"items": {
414+
"type": "string"
415+
}
416+
},
417+
"swig-opts": {
418+
"type": "array",
419+
"items": {
420+
"type": "string"
421+
}
422+
},
423+
"depends": {
424+
"type": "array",
425+
"items": {
426+
"type": "string"
427+
}
428+
},
429+
"language": {
430+
"type": "string"
431+
},
432+
"optional": {
433+
"type": "boolean"
434+
},
435+
"py-limited-api": {
436+
"type": "boolean"
437+
}
438+
}
439+
},
312440
"find-directive": {
313441
"title": "'find:' directive",
314442
"type": "object",
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#:schema ../../schemas/json/pyproject.json
2+
[build-system]
3+
requires = ["setuptools", "wheel"]
4+
build-backend = "setuptools.build_meta"
5+
6+
[project]
7+
name = "extension-project"
8+
version = "0.1.0"
9+
10+
[tool.setuptools]
11+
ext-modules = [
12+
{ name = "extension_project.foo", sources = [
13+
"src/extension_project/foo.c",
14+
], include-dirs = [
15+
"include",
16+
], define-macros = [
17+
[
18+
"FOO",
19+
"1",
20+
],
21+
[
22+
"BAR",
23+
"",
24+
],
25+
], undef-macros = [
26+
"BAZ",
27+
], library-dirs = [
28+
"lib",
29+
], libraries = [
30+
"foo",
31+
], runtime-library-dirs = [
32+
"runtime-lib",
33+
], extra-objects = [
34+
"build/helper.o",
35+
], extra-compile-args = [
36+
"-Wall",
37+
], extra-link-args = [
38+
"-Wl,--as-needed",
39+
], export-symbols = [
40+
"PyInit_foo",
41+
], swig-opts = [
42+
"-modern",
43+
], depends = [
44+
"src/extension_project/foo.h",
45+
], language = "c", optional = true, py-limited-api = true },
46+
]

0 commit comments

Comments
 (0)