Skip to content

Commit 931146e

Browse files
committed
pyproject: support for PEP 794
Signed-off-by: Henry Schreiner <[email protected]>
1 parent cceb8c0 commit 931146e

File tree

5 files changed

+78
-1
lines changed

5 files changed

+78
-1
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[project]
2+
name = "hi"
3+
version = "0.1.0"
4+
import-names = ["3three"]
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[project]
2+
name = "hi"
3+
version = "0.1.0"
4+
import-names = ["three; other"]
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[project]
2+
name = "hi"
3+
version = "0.1.0"
4+
import-names = ["three other"]

src/schemas/json/pyproject.json

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
"x-tombi-string-formats": ["email", "uri"],
88
"additionalProperties": false,
99
"definitions": {
10+
"importNames": {
11+
"type": "array",
12+
"items": {
13+
"type": "string",
14+
"pattern": "^[A-Za-z_][A-Za-z_0-9]*(?:\\.[A-Za-z_][A-Za-z_0-9]*)*(?:\\s*;\\s*private)?$"
15+
}
16+
},
1017
"projectAuthor": {
1118
"type": "object",
1219
"additionalProperties": false,
@@ -540,6 +547,30 @@
540547
}
541548
]
542549
},
550+
"import-names": {
551+
"$ref": "#/definitions/importNames",
552+
"description": "An array of strings specifying the import names that the project exclusively provides when installed.",
553+
"markdownDescription": "An array of strings specifying the import names that the project exclusively provides when installed.",
554+
"x-intellij-html-description": "An array of strings specifying the import names that the project exclusively provides when installed.",
555+
"x-taplo": {
556+
"links": {
557+
"key": "https://packaging.python.org/en/latest/specifications/pyproject-toml/#import-names"
558+
}
559+
},
560+
"examples": [["my_package", "_internal ; private"]]
561+
},
562+
"import-namespaces": {
563+
"$ref": "#/definitions/importNames",
564+
"description": "An array of strings specifying the import names that the project provides when installed, but not exclusively.",
565+
"markdownDescription": "An array of strings specifying the import names that the project provides when installed, but not exclusively.",
566+
"x-intellij-html-description": "An array of strings specifying the import names that the project provides when installed, but not exclusively.",
567+
"x-taplo": {
568+
"links": {
569+
"key": "https://packaging.python.org/en/latest/specifications/pyproject-toml/#import-namespaces"
570+
}
571+
},
572+
"examples": [["my_package", "_internal ; private"]]
573+
},
543574
"dynamic": {
544575
"type": "array",
545576
"items": {
@@ -560,7 +591,9 @@
560591
"gui-scripts",
561592
"entry-points",
562593
"dependencies",
563-
"optional-dependencies"
594+
"optional-dependencies",
595+
"import-names",
596+
"import-namespaces"
564597
]
565598
},
566599
"uniqueItems": true,
@@ -815,6 +848,32 @@
815848
}
816849
}
817850
}
851+
},
852+
"import-names": {
853+
"not": {
854+
"required": ["dynamic"],
855+
"properties": {
856+
"dynamic": {
857+
"type": "array",
858+
"contains": {
859+
"const": "import-names"
860+
}
861+
}
862+
}
863+
}
864+
},
865+
"import-namespaces": {
866+
"not": {
867+
"required": ["dynamic"],
868+
"properties": {
869+
"dynamic": {
870+
"type": "array",
871+
"contains": {
872+
"const": "import-namespaces"
873+
}
874+
}
875+
}
876+
}
818877
}
819878
}
820879
},

src/test/pyproject/pep794.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#:schema ../../schemas/json/pyproject.json
2+
[project]
3+
name = "hi"
4+
version = "0.1.0"
5+
import-names = ["example", "something ; private", "_other;private"]
6+
import-namespaces = ["other", "more; private"]

0 commit comments

Comments
 (0)