Skip to content

Commit 885ffdc

Browse files
Add schema for PEP 751 lock files (SchemaStore#4632)
* Add schema for PEP 751 lock files * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent ba8239f commit 885ffdc

File tree

3 files changed

+352
-0
lines changed

3 files changed

+352
-0
lines changed

src/api/json/catalog.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7890,6 +7890,12 @@
78907890
"description": "JSON-encoded statement list in a well-known location on a principal",
78917891
"fileMatch": ["assetlinks.json"],
78927892
"url": "https://json.schemastore.org/assetlinks.json"
7893+
},
7894+
{
7895+
"name": "Pylock",
7896+
"description": "PEP 751 lock file",
7897+
"fileMatch": ["pylock.toml", "pylock.*.toml"],
7898+
"url": "https://json.schemastore.org/pylock.json"
78937899
}
78947900
]
78957901
}

src/schema-validation.jsonc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@
183183
"pull-request-labeler-5.json",
184184
"putout.json",
185185
"pyrseas-0.8.json",
186+
"pylock.json",
186187
"rehyperc.json",
187188
"remarkrc.json",
188189
"resjson.json",

src/schemas/json/pylock.json

Lines changed: 345 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,345 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://json.schemastore.org/pylock.json",
4+
"additionalProperties": false,
5+
"definitions": {
6+
"tool": {
7+
"type": "object",
8+
"markdownDescription": "Similar usage as that of the `[tool]` table from the [pyproject.toml specification](https://packaging.python.org/en/latest/specifications/pyproject-toml/#pyproject-toml-spec), but at the package version level instead of at the lock file level (which is also available via `[tool]`).",
9+
"additionalProperties": {
10+
"type": "object",
11+
"additionalProperties": true
12+
}
13+
},
14+
"url": {
15+
"type": "string",
16+
"markdownDescription": "The URL to the source tree."
17+
},
18+
"path": {
19+
"type": "string",
20+
"markdownDescription": "The path to the local directory of the source tree."
21+
},
22+
"upload-time": {
23+
"markdownDescription": "The time the file was uploaded (UTC). Must be specified as a datetime literal."
24+
},
25+
"size": {
26+
"type": "integer",
27+
"markdownDescription": "The size of the archive file."
28+
},
29+
"hashes": {
30+
"type": "object",
31+
"description": "Known hash values of the file where the key is the hash algorithm and the value is the hash value.",
32+
"additionalProperties": {
33+
"type": "string"
34+
}
35+
},
36+
"subdirectory": {
37+
"type": "string",
38+
"markdownDescription": "The subdirectory within the [source tree](https://packaging.python.org/en/latest/specifications/source-distribution-format/#source-distribution-format-source-tree) where the project root of the project is (e.g. the location of the `pyproject.toml` file)."
39+
},
40+
"vcs": {
41+
"type": "object",
42+
"markdownDescription": "Record the version control system details for the [source tree](https://packaging.python.org/en/latest/specifications/source-distribution-format/#source-distribution-format-source-tree) it contains.",
43+
"additionalProperties": false,
44+
"properties": {
45+
"type": {
46+
"type": "string",
47+
"markdownDescription": "The type of version control system used."
48+
},
49+
"url": {
50+
"$ref": "#/definitions/url"
51+
},
52+
"path": {
53+
"$ref": "#/definitions/path"
54+
},
55+
"requested-revision": {
56+
"type": "string",
57+
"markdownDescription": "The branch/tag/ref/commit/revision/etc. that the user requested."
58+
},
59+
"commit-id": {
60+
"type": "string",
61+
"markdownDescription": "The exact commit/revision number that is to be installed."
62+
},
63+
"subdirectory": {
64+
"$ref": "#/definitions/subdirectory"
65+
}
66+
}
67+
},
68+
"directory": {
69+
"type": "object",
70+
"markdownDescription": "Record the local directory details for the [source tree](https://packaging.python.org/en/latest/specifications/source-distribution-format/#source-distribution-format-source-tree) it contains.",
71+
"additionalProperties": false,
72+
"properties": {
73+
"path": {
74+
"type": "string",
75+
"markdownDescription": "The local directory where the source tree is."
76+
},
77+
"editable": {
78+
"type": "boolean",
79+
"default": false,
80+
"markdownDescription": "A flag representing whether the source tree was an editable install at lock time."
81+
},
82+
"subdirectory": {
83+
"$ref": "#/definitions/subdirectory"
84+
}
85+
}
86+
},
87+
"archive": {
88+
"type": "object",
89+
"additionalProperties": false,
90+
"markdownDescription": "A direct reference to an archive file to install from (this can include wheels and sdists, as well as other archive formats containing a source tree).",
91+
"properties": {
92+
"url": {
93+
"$ref": "#/definitions/url"
94+
},
95+
"path": {
96+
"$ref": "#/definitions/path"
97+
},
98+
"size": {
99+
"$ref": "#/definitions/size"
100+
},
101+
"upload-time": {
102+
"$ref": "#/definitions/upload-time"
103+
},
104+
"hashes": {
105+
"$ref": "#/definitions/hashes"
106+
},
107+
"subdirectory": {
108+
"$ref": "#/definitions/subdirectory"
109+
}
110+
}
111+
},
112+
"sdist": {
113+
"type": "object",
114+
"additionalProperties": false,
115+
"markdownDescription": "Details of a [source distribution file name](https://packaging.python.org/en/latest/specifications/source-distribution-format/#source-distribution-format-sdist) for the package.",
116+
"properties": {
117+
"name": {
118+
"type": "string",
119+
"markdownDescription": "The file name of the [source distribution file name](https://packaging.python.org/en/latest/specifications/source-distribution-format/#source-distribution-format-sdist) file."
120+
},
121+
"upload-time": {
122+
"$ref": "#/definitions/upload-time"
123+
},
124+
"url": {
125+
"$ref": "#/definitions/url"
126+
},
127+
"path": {
128+
"$ref": "#/definitions/path"
129+
},
130+
"size": {
131+
"$ref": "#/definitions/size"
132+
},
133+
"hashes": {
134+
"$ref": "#/definitions/hashes"
135+
}
136+
}
137+
},
138+
"wheels": {
139+
"type": "array",
140+
"markdownDescription": "For recording the wheel files as specified by [Binary distribution format](https://packaging.python.org/en/latest/specifications/binary-distribution-format/#binary-distribution-format) for the package.",
141+
"items": {
142+
"type": "object",
143+
"additionalProperties": false,
144+
"properties": {
145+
"name": {
146+
"type": "string",
147+
"markdownDescription": "The file name of the [Binary distribution format](https://packaging.python.org/en/latest/specifications/binary-distribution-format/#binary-distribution-format) file."
148+
},
149+
"upload-time": {
150+
"$ref": "#/definitions/upload-time"
151+
},
152+
"url": {
153+
"$ref": "#/definitions/url"
154+
},
155+
"path": {
156+
"$ref": "#/definitions/path"
157+
},
158+
"size": {
159+
"$ref": "#/definitions/size"
160+
},
161+
"hashes": {
162+
"$ref": "#/definitions/hashes"
163+
}
164+
}
165+
}
166+
},
167+
"1.0": {
168+
"required": ["lock-version", "created-by", "packages"],
169+
"properties": {
170+
"lock-version": {
171+
"type": "string",
172+
"enum": ["1.0"],
173+
"description": "Record the file format version that the file adheres to."
174+
},
175+
"environments": {
176+
"type": "array",
177+
"markdownDescription": "A list of [environment markers](https://packaging.python.org/en/latest/specifications/dependency-specifiers/#dependency-specifiers-environment-markers) for which the lock file is considered compatible with.",
178+
"items": {
179+
"type": "string",
180+
"description": "Environment marker"
181+
}
182+
},
183+
"requires-python": {
184+
"type": "string",
185+
"markdownDescription": "Specifies the [Requires-Python](https://packaging.python.org/en/latest/specifications/core-metadata/#core-metadata-requires-python) for the minimum Python version compatible for any environment supported by the lock file (i.e. the minimum viable Python version for the lock file)."
186+
},
187+
"extras": {
188+
"type": "array",
189+
"markdownDescription": "The list of [extras](https://packaging.python.org/en/latest/specifications/core-metadata/#core-metadata-provides-extra) supported by this lock file.",
190+
"default": [],
191+
"items": {
192+
"type": "string",
193+
"description": "Extra name"
194+
}
195+
},
196+
"dependency-groups": {
197+
"type": "array",
198+
"markdownDescription": "The list of [dependency groups](https://packaging.python.org/en/latest/specifications/dependency-groups/#dependency-groups) publicly supported by this lock file (i.e. dependency groups users are expected to be able to specify via a tool’s UI).",
199+
"default": [],
200+
"items": {
201+
"type": "string",
202+
"description": "Dependency group name"
203+
}
204+
},
205+
"default-groups": {
206+
"type": "array",
207+
"markdownDescription": "The name of synthetic dependency groups to represent what should be installed by default (e.g. what `project.dependencies` implicitly represents).",
208+
"default": [],
209+
"items": {
210+
"type": "string",
211+
"description": "Dependency group name"
212+
}
213+
},
214+
"created-by": {
215+
"type": "string",
216+
"markdownDescription": "Records the name of the tool used to create the lock file."
217+
},
218+
"packages": {
219+
"type": "array",
220+
"markdownDescription": "An array containing all packages that may be installed.",
221+
"items": {
222+
"type": "object",
223+
"additionalProperties": false,
224+
"required": ["name"],
225+
"allOf": [
226+
{
227+
"if": {
228+
"required": ["vcs"]
229+
},
230+
"then": {
231+
"not": {
232+
"required": ["directory", "archive", "sdist", "wheels"]
233+
}
234+
}
235+
},
236+
{
237+
"if": {
238+
"required": ["directory"]
239+
},
240+
"then": {
241+
"not": {
242+
"required": ["vcs", "archive", "sdist", "wheels"]
243+
}
244+
}
245+
},
246+
{
247+
"if": {
248+
"required": ["sdist"]
249+
},
250+
"then": {
251+
"not": {
252+
"required": ["vcs", "directory", "archive"]
253+
}
254+
}
255+
},
256+
{
257+
"if": {
258+
"required": ["wheels"]
259+
},
260+
"then": {
261+
"not": {
262+
"required": ["vcs", "directory", "archive"]
263+
}
264+
}
265+
}
266+
],
267+
"properties": {
268+
"name": {
269+
"type": "string",
270+
"markdownDescription": "The name of the package, [normalized](https://packaging.python.org/en/latest/specifications/name-normalization/#name-normalization)."
271+
},
272+
"version": {
273+
"type": "string",
274+
"description": "The version of the package."
275+
},
276+
"marker": {
277+
"type": "string",
278+
"markdownDescription": "The [environment marker](https://packaging.python.org/en/latest/specifications/dependency-specifiers/#dependency-specifiers-environment-markers) which specify when the package should be installed."
279+
},
280+
"requires-python": {
281+
"type": "string",
282+
"markdownDescription": "Holds the [version specifiers](https://packaging.python.org/en/latest/specifications/version-specifiers/#version-specifiers) for Python version compatibility for the package."
283+
},
284+
"dependencies": {
285+
"type": "array",
286+
"markdownDescription": "Records the other entries in `[[packages]]` which are direct dependencies of this package.",
287+
"items": {
288+
"type": "object",
289+
"markdownDescription": "A table which contains the minimum information required to tell which other package entry it corresponds to where doing a key-by-key comparison would find the appropriate package with no ambiguity (e.g. if there are two entries for the `spam` package, then you can include the version number like `{name = \"spam\", version = \"1.0.0\"}`, or by source like `{name = \"spam\", vcs = { url = \"...\"}`).",
290+
"additionalProperties": true
291+
}
292+
},
293+
"vcs": {
294+
"$ref": "#/definitions/vcs"
295+
},
296+
"directory": {
297+
"$ref": "#/definitions/directory"
298+
},
299+
"archive": {
300+
"$ref": "#/definitions/archive"
301+
},
302+
"index": {
303+
"type": "string",
304+
"markdownDescription": "The base URL for the package index from [simple repository API](https://packaging.python.org/en/latest/specifications/simple-repository-api/#simple-repository-api) where the sdist and/or wheels were found (e.g. `https://pypi.org/simple/`)."
305+
},
306+
"sdist": {
307+
"$ref": "#/definitions/sdist"
308+
},
309+
"wheels": {
310+
"$ref": "#/definitions/wheels"
311+
},
312+
"attestation-identities": {
313+
"type": "array",
314+
"markdownDescription": "A recording of the attestations for any file recorded for this package.",
315+
"items": {
316+
"type": "object",
317+
"additionalProperties": false,
318+
"required": ["kind"],
319+
"properties": {
320+
"kind": {
321+
"type": "string",
322+
"markdownDescription": "The unique identity of the Trusted Publisher."
323+
}
324+
}
325+
}
326+
},
327+
"tool": {
328+
"$ref": "#/definitions/tool"
329+
}
330+
}
331+
}
332+
},
333+
"tool": {
334+
"$ref": "#/definitions/tool"
335+
}
336+
}
337+
}
338+
},
339+
"oneOf": [
340+
{
341+
"$ref": "#/definitions/1.0"
342+
}
343+
],
344+
"type": "object"
345+
}

0 commit comments

Comments
 (0)