Skip to content

Commit e3b02cf

Browse files
authored
Merge pull request #1889 from edgarrmondragon/host-json-schemas
Host PyPA spec schemas in packaging.python.org/
2 parents e3f4631 + e1f29ae commit e3b02cf

File tree

8 files changed

+455
-121
lines changed

8 files changed

+455
-121
lines changed

source/conf.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,6 @@
8383
# https://plausible.io/packaging.python.org
8484
html_js_files.extend(_metrics_js_files)
8585

86-
html_extra_path = [
87-
"../extra",
88-
]
89-
9086
# -- Options for HTML help output ------------------------------------------------------
9187
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-help-output
9288

source/specifications/build-details/v1.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
Specification
99
-------------
1010

11-
.. jsonschema:: ../../../extra/specifications/schemas/build-details-v1.0.schema.json
11+
.. jsonschema:: ../schemas/build-details-v1.0.schema.json
1212
:lift_title: false
1313

1414

source/specifications/direct-url-data-structure.rst

Lines changed: 1 addition & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -236,122 +236,7 @@ JSON Schema
236236

237237
The following JSON Schema can be used to validate the contents of ``direct_url.json``:
238238

239-
.. code-block::
240-
241-
{
242-
"$schema": "https://json-schema.org/draft/2019-09/schema",
243-
"title": "Direct URL Data",
244-
"description": "Data structure that can represent URLs to python projects and distribution artifacts such as VCS source trees, local source trees, source distributions and wheels.",
245-
"definitions": {
246-
"URL": {
247-
"type": "string",
248-
"format": "uri"
249-
},
250-
"DirInfo": {
251-
"type": "object",
252-
"properties": {
253-
"editable": {
254-
"type": ["boolean", "null"]
255-
}
256-
}
257-
},
258-
"VCSInfo": {
259-
"type": "object",
260-
"properties": {
261-
"vcs": {
262-
"type": "string",
263-
"enum": [
264-
"git",
265-
"hg",
266-
"bzr",
267-
"svn"
268-
]
269-
},
270-
"requested_revision": {
271-
"type": "string"
272-
},
273-
"commit_id": {
274-
"type": "string"
275-
},
276-
"resolved_revision": {
277-
"type": "string"
278-
}
279-
},
280-
"required": [
281-
"vcs",
282-
"commit_id"
283-
]
284-
},
285-
"ArchiveInfo": {
286-
"type": "object",
287-
"properties": {
288-
"hash": {
289-
"type": "string",
290-
"pattern": "^\\w+=[a-f0-9]+$",
291-
"deprecated": true
292-
},
293-
"hashes": {
294-
"type": "object",
295-
"patternProperties": {
296-
"^[a-f0-9]+$": {
297-
"type": "string"
298-
}
299-
}
300-
}
301-
}
302-
}
303-
},
304-
"allOf": [
305-
{
306-
"type": "object",
307-
"properties": {
308-
"url": {
309-
"$ref": "#/definitions/URL"
310-
}
311-
},
312-
"required": [
313-
"url"
314-
]
315-
},
316-
{
317-
"anyOf": [
318-
{
319-
"type": "object",
320-
"properties": {
321-
"dir_info": {
322-
"$ref": "#/definitions/DirInfo"
323-
}
324-
},
325-
"required": [
326-
"dir_info"
327-
]
328-
},
329-
{
330-
"type": "object",
331-
"properties": {
332-
"vcs_info": {
333-
"$ref": "#/definitions/VCSInfo"
334-
}
335-
},
336-
"required": [
337-
"vcs_info"
338-
]
339-
},
340-
{
341-
"type": "object",
342-
"properties": {
343-
"archive_info": {
344-
"$ref": "#/definitions/ArchiveInfo"
345-
}
346-
},
347-
"required": [
348-
"archive_info"
349-
]
350-
}
351-
]
352-
}
353-
]
354-
}
239+
.. literalinclude:: schemas/direct-url.schema.json
355240

356241
Examples
357242
========

source/specifications/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ and for proposing new ones, is documented on
1717
section-package-indices
1818
section-python-description-formats
1919
section-reproducible-environments
20+
schemas/index.rst
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2019-09/schema",
3+
"$id": "https://packaging.python.org/en/latest/specifications/schemas/direct-url.schema.json",
4+
"title": "Direct URL Data",
5+
"description": "Data structure that can represent URLs to python projects and distribution artifacts such as VCS source trees, local source trees, source distributions and wheels.",
6+
"definitions": {
7+
"url": {
8+
"type": "string",
9+
"format": "uri"
10+
},
11+
"DirInfo": {
12+
"type": "object",
13+
"properties": {
14+
"editable": {
15+
"type": ["boolean", "null"]
16+
}
17+
}
18+
},
19+
"VCSInfo": {
20+
"type": "object",
21+
"properties": {
22+
"vcs": {
23+
"type": "string",
24+
"enum": ["git", "hg", "bzr", "svn"]
25+
},
26+
"requested_revision": {
27+
"type": "string"
28+
},
29+
"commit_id": {
30+
"type": "string"
31+
},
32+
"resolved_revision": {
33+
"type": "string"
34+
}
35+
},
36+
"required": ["vcs", "commit_id"]
37+
},
38+
"ArchiveInfo": {
39+
"type": "object",
40+
"properties": {
41+
"hash": {
42+
"type": "string",
43+
"pattern": "^\\w+=[a-f0-9]+$",
44+
"deprecated": true
45+
},
46+
"hashes": {
47+
"type": "object",
48+
"patternProperties": {
49+
"^[a-f0-9]+$": {
50+
"type": "string"
51+
}
52+
}
53+
}
54+
}
55+
}
56+
},
57+
"allOf": [
58+
{
59+
"type": "object",
60+
"properties": {
61+
"url": {
62+
"$ref": "#/definitions/url"
63+
}
64+
},
65+
"required": ["url"]
66+
},
67+
{
68+
"anyOf": [
69+
{
70+
"type": "object",
71+
"properties": {
72+
"dir_info": {
73+
"$ref": "#/definitions/DirInfo"
74+
}
75+
},
76+
"required": ["dir_info"]
77+
},
78+
{
79+
"type": "object",
80+
"properties": {
81+
"vcs_info": {
82+
"$ref": "#/definitions/VCSInfo"
83+
}
84+
},
85+
"required": ["vcs_info"]
86+
},
87+
{
88+
"type": "object",
89+
"properties": {
90+
"archive_info": {
91+
"$ref": "#/definitions/ArchiveInfo"
92+
}
93+
},
94+
"required": ["archive_info"]
95+
}
96+
]
97+
}
98+
]
99+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.. _`packaging-schemas`:
2+
3+
PyPA schemas
4+
############
5+
6+
- `direct_url.json <direct-url.schema.json>`_
7+
- `build-details.json <build-details-v1.0.schema.json>`_
8+
- `pylock.toml <pylock.schema.json>`_

0 commit comments

Comments
 (0)