pz-scripts-data 1.2.0__tar.gz → 1.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (18) hide show
  1. {pz_scripts_data-1.2.0/src/pz_scripts_data.egg-info → pz_scripts_data-1.3.0}/PKG-INFO +1 -1
  2. {pz_scripts_data-1.2.0 → pz_scripts_data-1.3.0}/pyproject.toml +1 -1
  3. {pz_scripts_data-1.2.0 → pz_scripts_data-1.3.0}/src/pz_scripts_data/formatBlocks.py +7 -1
  4. {pz_scripts_data-1.2.0 → pz_scripts_data-1.3.0}/src/pz_scripts_data/schema.py +24 -0
  5. {pz_scripts_data-1.2.0 → pz_scripts_data-1.3.0/src/pz_scripts_data.egg-info}/PKG-INFO +1 -1
  6. {pz_scripts_data-1.2.0 → pz_scripts_data-1.3.0}/LICENSE +0 -0
  7. {pz_scripts_data-1.2.0 → pz_scripts_data-1.3.0}/README.md +0 -0
  8. {pz_scripts_data-1.2.0 → pz_scripts_data-1.3.0}/setup.cfg +0 -0
  9. {pz_scripts_data-1.2.0 → pz_scripts_data-1.3.0}/src/pz_scripts_data/blocks.py +0 -0
  10. {pz_scripts_data-1.2.0 → pz_scripts_data-1.3.0}/src/pz_scripts_data/py.typed +0 -0
  11. {pz_scripts_data-1.2.0 → pz_scripts_data-1.3.0}/src/pz_scripts_data/release.py +0 -0
  12. {pz_scripts_data-1.2.0 → pz_scripts_data-1.3.0}/src/pz_scripts_data/sortItemParameters.py +0 -0
  13. {pz_scripts_data-1.2.0 → pz_scripts_data-1.3.0}/src/pz_scripts_data/validateBlocks.py +0 -0
  14. {pz_scripts_data-1.2.0 → pz_scripts_data-1.3.0}/src/pz_scripts_data.egg-info/SOURCES.txt +0 -0
  15. {pz_scripts_data-1.2.0 → pz_scripts_data-1.3.0}/src/pz_scripts_data.egg-info/dependency_links.txt +0 -0
  16. {pz_scripts_data-1.2.0 → pz_scripts_data-1.3.0}/src/pz_scripts_data.egg-info/entry_points.txt +0 -0
  17. {pz_scripts_data-1.2.0 → pz_scripts_data-1.3.0}/src/pz_scripts_data.egg-info/requires.txt +0 -0
  18. {pz_scripts_data-1.2.0 → pz_scripts_data-1.3.0}/src/pz_scripts_data.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pz-scripts-data
3
- Version: 1.2.0
3
+ Version: 1.3.0
4
4
  Summary: Dataset for the Scripts of Project Zomboid.
5
5
  Author: SimKDT
6
6
  License-Expression: MIT
@@ -3,7 +3,7 @@ name = "pz-scripts-data"
3
3
  description = "Dataset for the Scripts of Project Zomboid."
4
4
  readme = { file = "README.md", content-type = "text/markdown" }
5
5
  requires-python = ">=3.12.3"
6
- version = "1.2.0"
6
+ version = "1.3.0"
7
7
  license = "MIT"
8
8
  authors = [
9
9
  { name = "SimKDT" },
@@ -62,7 +62,7 @@ items: list[Item] = [
62
62
  def fetchBlocks(item: Item):
63
63
  # combine all block yaml files into one, validating each against the schema
64
64
  blocks: dict[str, ScriptsBlock] = {}
65
- for file_path in item['input'].glob("*.yaml"):
65
+ for file_path in sorted(item['input'].glob("*.yaml")):
66
66
  with open(file_path, 'r', encoding='utf-8') as f:
67
67
  data = yaml.safe_load(f)
68
68
  try:
@@ -255,6 +255,12 @@ def prepare(item: Item, items: list[Item]):
255
255
  copy_block_ref(block, items)
256
256
  copy_parameters_ref(block.parameters, items)
257
257
 
258
+ # children and variants are appended in processing order, so sort them for stable output
259
+ for block in blocks.values():
260
+ if block.children:
261
+ block.children.sort()
262
+ if block.variants:
263
+ block.variants.sort()
258
264
 
259
265
  return blocks
260
266
 
@@ -30,6 +30,7 @@ CallBackType = Literal["callback"]
30
30
  BlockType = Literal["block"]
31
31
  ObjectType = Literal["object"]
32
32
  ArrayType = Literal["array"]
33
+ FileType = Literal["file"]
33
34
  ParameterMainType = (
34
35
  ScalarType
35
36
  | TranslationType
@@ -37,6 +38,7 @@ ParameterMainType = (
37
38
  | BlockType
38
39
  | ObjectType
39
40
  | ArrayType
41
+ | FileType
40
42
  )
41
43
 
42
44
 
@@ -132,6 +134,21 @@ class BlockDeprecation(SchemaModel):
132
134
  description="A brief description of why the block type is deprecated and any additional information about the deprecation.",
133
135
  )
134
136
 
137
+ class FileDefinition(SchemaModel):
138
+ """Describes the expected format of a file parameter."""
139
+
140
+ relative_to: str = Field(
141
+ description="The relative path of the file, relative to version and common folders.",
142
+ alias="relativeTo",
143
+ )
144
+ prefix: str | None = Field(
145
+ None,
146
+ description="An optional prefix for the file path.",
147
+ )
148
+ extension: str = Field(
149
+ description="The file extension for the file parameter.",
150
+ )
151
+
135
152
 
136
153
  class _ArrayBase(SchemaModel):
137
154
  separator: str = Field(description="Specifies the separator used to split the string into array items.")
@@ -268,6 +285,12 @@ class TranslationParameterType(ParameterType[TranslationType]):
268
285
  description="If the parameter is of type 'translation', this can be used to provide a description of the expected format of the translation.",
269
286
  )
270
287
 
288
+ class FileParameterType(ParameterType[FileType]):
289
+ main: FileType = Field(description="The main data type of the parameter.")
290
+ file: FileDefinition = Field(
291
+ description="If the parameter is of type 'file', this can be used to provide a description of the expected format of the file.",
292
+ )
293
+
271
294
 
272
295
  class ScalarParameterType(ParameterType[ScalarType]):
273
296
  main: ScalarType = Field(description="The main data type of the parameter.")
@@ -279,6 +302,7 @@ ParameterTypeUnion = (
279
302
  | BlockParameterType
280
303
  | CallbackParameterType
281
304
  | TranslationParameterType
305
+ | FileParameterType
282
306
  | ScalarParameterType
283
307
  )
284
308
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pz-scripts-data
3
- Version: 1.2.0
3
+ Version: 1.3.0
4
4
  Summary: Dataset for the Scripts of Project Zomboid.
5
5
  Author: SimKDT
6
6
  License-Expression: MIT
File without changes