ceos-ard-cli 0.5.2__tar.gz → 0.5.4__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 (28) hide show
  1. {ceos_ard_cli-0.5.2 → ceos_ard_cli-0.5.4}/PKG-INFO +1 -1
  2. {ceos_ard_cli-0.5.2 → ceos_ard_cli-0.5.4}/ceos_ard_cli/__init__.py +27 -6
  3. {ceos_ard_cli-0.5.2 → ceos_ard_cli-0.5.4}/ceos_ard_cli/compile.py +12 -1
  4. {ceos_ard_cli-0.5.2 → ceos_ard_cli-0.5.4}/ceos_ard_cli/generate.py +8 -5
  5. ceos_ard_cli-0.5.4/ceos_ard_cli/version.py +1 -0
  6. ceos_ard_cli-0.5.2/ceos_ard_cli/version.py +0 -1
  7. {ceos_ard_cli-0.5.2 → ceos_ard_cli-0.5.4}/.editorconfig +0 -0
  8. {ceos_ard_cli-0.5.2 → ceos_ard_cli-0.5.4}/.github/workflows/checks.yaml +0 -0
  9. {ceos_ard_cli-0.5.2 → ceos_ard_cli-0.5.4}/.github/workflows/publish.yml +0 -0
  10. {ceos_ard_cli-0.5.2 → ceos_ard_cli-0.5.4}/.gitignore +0 -0
  11. {ceos_ard_cli-0.5.2 → ceos_ard_cli-0.5.4}/.pre-commit-config.yaml +0 -0
  12. {ceos_ard_cli-0.5.2 → ceos_ard_cli-0.5.4}/LICENSE +0 -0
  13. {ceos_ard_cli-0.5.2 → ceos_ard_cli-0.5.4}/README.md +0 -0
  14. {ceos_ard_cli-0.5.2 → ceos_ard_cli-0.5.4}/ceos_ard_cli/schema.py +0 -0
  15. {ceos_ard_cli-0.5.2 → ceos_ard_cli-0.5.4}/ceos_ard_cli/strictyaml/__init__.py +0 -0
  16. {ceos_ard_cli-0.5.2 → ceos_ard_cli-0.5.4}/ceos_ard_cli/strictyaml/id_reference.py +0 -0
  17. {ceos_ard_cli-0.5.2 → ceos_ard_cli-0.5.4}/ceos_ard_cli/strictyaml/markdown.py +0 -0
  18. {ceos_ard_cli-0.5.2 → ceos_ard_cli-0.5.4}/ceos_ard_cli/utils/__init__.py +0 -0
  19. {ceos_ard_cli-0.5.2 → ceos_ard_cli-0.5.4}/ceos_ard_cli/utils/files.py +0 -0
  20. {ceos_ard_cli-0.5.2 → ceos_ard_cli-0.5.4}/ceos_ard_cli/utils/pfs.py +0 -0
  21. {ceos_ard_cli-0.5.2 → ceos_ard_cli-0.5.4}/ceos_ard_cli/utils/requirement.py +0 -0
  22. {ceos_ard_cli-0.5.2 → ceos_ard_cli-0.5.4}/ceos_ard_cli/utils/template.py +0 -0
  23. {ceos_ard_cli-0.5.2 → ceos_ard_cli-0.5.4}/ceos_ard_cli/utils/yaml.py +0 -0
  24. {ceos_ard_cli-0.5.2 → ceos_ard_cli-0.5.4}/ceos_ard_cli/validate.py +0 -0
  25. {ceos_ard_cli-0.5.2 → ceos_ard_cli-0.5.4}/pixi.lock +0 -0
  26. {ceos_ard_cli-0.5.2 → ceos_ard_cli-0.5.4}/pyproject.toml +0 -0
  27. {ceos_ard_cli-0.5.2 → ceos_ard_cli-0.5.4}/tests/__init__.py +0 -0
  28. {ceos_ard_cli-0.5.2 → ceos_ard_cli-0.5.4}/tests/test_cli.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ceos-ard-cli
3
- Version: 0.5.2
3
+ Version: 0.5.4
4
4
  Summary: CLI tools for CEOS-ARD to generate and validate PFS documents
5
5
  Project-URL: Homepage, https://github.com/ceos-org/ceos-ard-cli
6
6
  Project-URL: Repository, https://github.com/ceos-org/ceos-ard-cli
@@ -39,13 +39,20 @@ def cli():
39
39
  default=False,
40
40
  help="Adds an 'Assessment' section to the requirements (for editable Word documents)",
41
41
  )
42
+ @click.option(
43
+ "--stable",
44
+ "-r",
45
+ is_flag=True,
46
+ default=False,
47
+ help="Removes the '-draft' suffix from the version number, e.g. 0.1.0-draft becomes 0.1.0",
48
+ )
42
49
  @click.option(
43
50
  "--debug",
44
51
  is_flag=True,
45
52
  default=False,
46
53
  help="Enables debugging mode, e.g. outputs a JSON file for debugging purposes and gives a stacktrace",
47
54
  )
48
- def compile(pfs, output, input_dir, editable, debug):
55
+ def compile(pfs, output, input_dir, editable, stable, debug):
49
56
  """
50
57
  Compiles the Markdown file for the given PFS.
51
58
  """
@@ -56,7 +63,7 @@ def compile(pfs, output, input_dir, editable, debug):
56
63
  output = "-".join(pfs)
57
64
 
58
65
  try:
59
- compile_(pfs, output, input_dir, editable=editable, debug=debug)
66
+ compile_(pfs, output, input_dir, editable=editable, stable=stable, debug=debug)
60
67
  except Exception as e:
61
68
  if debug:
62
69
  raise e
@@ -88,6 +95,13 @@ def compile(pfs, output, input_dir, editable, debug):
88
95
  )
89
96
  @click.option("--pdf", is_flag=True, default=True, help="Enable/disable PDF generation")
90
97
  @click.option("--docx", is_flag=True, default=True, help="Enable/disable Word (docx) generation")
98
+ @click.option(
99
+ "--stable",
100
+ "-r",
101
+ is_flag=True,
102
+ default=False,
103
+ help="Removes the '-draft' suffix from the version number, e.g. 0.1.0-draft becomes 0.1.0",
104
+ )
91
105
  @click.option(
92
106
  "--id",
93
107
  default=None,
@@ -108,7 +122,7 @@ def compile(pfs, output, input_dir, editable, debug):
108
122
  default=None,
109
123
  help="Overrides the PFS type of the document",
110
124
  )
111
- def generate(pfs, output, input_dir, self_contained, pdf, docx, id, title, version, pfs_type):
125
+ def generate(pfs, output, input_dir, self_contained, pdf, docx, stable, id, title, version, pfs_type):
112
126
  """
113
127
  Generates the Word and HTML files for the given PFS.
114
128
 
@@ -128,7 +142,7 @@ def generate(pfs, output, input_dir, self_contained, pdf, docx, id, title, versi
128
142
  }
129
143
 
130
144
  try:
131
- generate_(pfs, output, input_dir, self_contained, pdf, docx, metadata)
145
+ generate_(pfs, output, input_dir, self_contained, pdf, docx, stable, metadata)
132
146
  except Exception as e:
133
147
  print(e)
134
148
  sys.exit(1)
@@ -162,7 +176,14 @@ def generate(pfs, output, input_dir, self_contained, pdf, docx, id, title, versi
162
176
  multiple=True,
163
177
  help="PFS to generate, if not specified all PFS will be generated",
164
178
  )
165
- def generate_all(output, input_dir, self_contained, pdf, docx, pfs):
179
+ @click.option(
180
+ "--stable",
181
+ "-r",
182
+ is_flag=True,
183
+ default=False,
184
+ help="Removes the '-draft' suffix from the version number, e.g. 0.1.0-draft becomes 0.1.0",
185
+ )
186
+ def generate_all(output, input_dir, self_contained, pdf, docx, pfs, stable):
166
187
  """
167
188
  Generates all files for all PFS.
168
189
 
@@ -171,7 +192,7 @@ def generate_all(output, input_dir, self_contained, pdf, docx, pfs):
171
192
  print(f"CEOS-ARD CLI {__version__} - Generate all PFS\n")
172
193
  pfs = list(pfs) if pfs is not None else []
173
194
  try:
174
- errors = generate_all_(output, input_dir, self_contained, pdf, docx, pfs)
195
+ errors = generate_all_(output, input_dir, self_contained, pdf, docx, pfs, stable)
175
196
  print()
176
197
  print(f"Done with {errors} errors")
177
198
  sys.exit(errors)
@@ -305,6 +305,7 @@ def compile(
305
305
  out: Union[Path, str],
306
306
  input_dir: Union[Path, str],
307
307
  editable: bool = False,
308
+ stable: bool = False,
308
309
  metadata: dict = {},
309
310
  debug: bool = False,
310
311
  ):
@@ -333,6 +334,8 @@ def compile(
333
334
  else:
334
335
  data = multi_pfs[pfs[0]]
335
336
 
337
+ data["stable"] = stable
338
+
336
339
  if isinstance(data["authors"], list):
337
340
  # Convert list of authors to Markdown
338
341
  data["authors"] = "\n".join(map(lambda a: f"- {a}", data["authors"]))
@@ -340,8 +343,14 @@ def compile(
340
343
  # Override metadata if provided
341
344
  data["id"] = metadata.get("id") or data["id"]
342
345
  data["title"] = metadata.get("title") or data["title"]
343
- data["version"] = metadata.get("version") or data["version"]
344
346
  data["type"] = metadata.get("type") or data["type"]
347
+ if metadata.get("version"):
348
+ data["version"] = metadata["version"]
349
+ elif not stable:
350
+ data["version"] = data["version"] + "-draft"
351
+
352
+ if stable:
353
+ out = out.parent / f"{out.stem}-v{data['version']}"
345
354
 
346
355
  # write a json file for debugging
347
356
  if debug:
@@ -354,6 +363,8 @@ def compile(
354
363
  # write bibtex file to disk
355
364
  compile_bibtex(data, f"{out}.bib", input_dir)
356
365
 
366
+ return out
367
+
357
368
 
358
369
  def compile_bibtex(data, out, input_dir: Path):
359
370
  input_dir = Path(input_dir).resolve()
@@ -15,6 +15,7 @@ def generate_all(
15
15
  pdf: bool = True,
16
16
  docx: bool = True,
17
17
  pfs_list: list = [],
18
+ stable: bool = False,
18
19
  ):
19
20
  # read all folders from the pfs folder
20
21
  input_dir = Path(input_dir).resolve()
@@ -35,6 +36,7 @@ def generate_all(
35
36
  self_contained,
36
37
  pdf,
37
38
  docx,
39
+ stable,
38
40
  )
39
41
  except Exception as e:
40
42
  print(f"Error generating {folder}: {e}")
@@ -50,6 +52,7 @@ def generate(
50
52
  self_contained: bool = True,
51
53
  pdf: bool = True,
52
54
  docx: bool = True,
55
+ stable: bool = False,
53
56
  metadata: dict = {},
54
57
  ):
55
58
  if isinstance(pfs, str):
@@ -60,20 +63,20 @@ def generate(
60
63
 
61
64
  if docx:
62
65
  print("- Generating editable Markdown")
63
- compile(pfs, output, input_dir, editable=True, metadata=metadata)
66
+ target = compile(pfs, output, input_dir, editable=True, stable=stable, metadata=metadata)
64
67
 
65
68
  print("- Generating Word")
66
- run_pandoc(output, "docx", input_dir, self_contained)
69
+ run_pandoc(target, "docx", input_dir, self_contained)
67
70
 
68
71
  print("- Generating read-only Markdown")
69
- compile(pfs, output, input_dir, editable=False, metadata=metadata)
72
+ target = compile(pfs, output, input_dir, editable=False, stable=stable, metadata=metadata)
70
73
 
71
74
  print("- Generating HTML")
72
- run_pandoc(output, "html", input_dir, self_contained)
75
+ run_pandoc(target, "html", input_dir, self_contained)
73
76
 
74
77
  if pdf:
75
78
  print("- Generating PDF")
76
- run_playwright(output, input_dir)
79
+ run_playwright(target, input_dir)
77
80
 
78
81
 
79
82
  def run_playwright(out: Path, input_dir: Path):
@@ -0,0 +1 @@
1
+ __version__ = "0.5.4"
@@ -1 +0,0 @@
1
- __version__ = "0.5.2"
File without changes
File without changes
File without changes
File without changes
File without changes