sdmxlib-cli 0.73.0__tar.gz → 0.75.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.
- {sdmxlib_cli-0.73.0 → sdmxlib_cli-0.75.0}/PKG-INFO +2 -2
- {sdmxlib_cli-0.73.0 → sdmxlib_cli-0.75.0}/pyproject.toml +2 -2
- {sdmxlib_cli-0.73.0 → sdmxlib_cli-0.75.0}/pyproject.toml.orig +2 -2
- {sdmxlib_cli-0.73.0 → sdmxlib_cli-0.75.0}/src/sdmxlib_cli/__init__.py +66 -5
- {sdmxlib_cli-0.73.0 → sdmxlib_cli-0.75.0}/LICENSE +0 -0
- {sdmxlib_cli-0.73.0 → sdmxlib_cli-0.75.0}/README.md +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sdmxlib-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.75.0
|
|
4
4
|
Summary: sdmxlib from the command line: check SDMX bundles
|
|
5
5
|
Keywords: sdmx,statistics,metadata,cli
|
|
6
6
|
Author: gabrielgellner
|
|
@@ -11,7 +11,7 @@ Classifier: Development Status :: 4 - Beta
|
|
|
11
11
|
Classifier: Environment :: Console
|
|
12
12
|
Classifier: Programming Language :: Python :: 3
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.14
|
|
14
|
-
Requires-Dist: sdmxlib==0.
|
|
14
|
+
Requires-Dist: sdmxlib==0.75.0
|
|
15
15
|
Requires-Dist: typer>=0.27.3,<0.28
|
|
16
16
|
Requires-Python: >=3.14
|
|
17
17
|
Project-URL: Homepage, https://github.com/StatCat-Suite/sdmxlib
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "sdmxlib-cli"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.75.0"
|
|
4
4
|
description = "sdmxlib from the command line: check SDMX bundles"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "Apache-2.0"
|
|
@@ -19,7 +19,7 @@ classifiers = [
|
|
|
19
19
|
"Programming Language :: Python :: 3.14",
|
|
20
20
|
]
|
|
21
21
|
dependencies = [
|
|
22
|
-
"sdmxlib==0.
|
|
22
|
+
"sdmxlib==0.75.0",
|
|
23
23
|
"typer>=0.27.3,<0.28",
|
|
24
24
|
]
|
|
25
25
|
|
|
@@ -3,7 +3,7 @@ name = "sdmxlib-cli"
|
|
|
3
3
|
# Locked to sdmxlib's version and released with it (GH-67): the release steps
|
|
4
4
|
# bump both and the pin below, and a test asserts the three agree, so the
|
|
5
5
|
# command can never be installed against an sdmxlib it was not tested with.
|
|
6
|
-
version = "0.
|
|
6
|
+
version = "0.75.0"
|
|
7
7
|
description = "sdmxlib from the command line: check SDMX bundles"
|
|
8
8
|
readme = "README.md"
|
|
9
9
|
license = "Apache-2.0"
|
|
@@ -22,7 +22,7 @@ classifiers = [
|
|
|
22
22
|
# A standalone install, so sdmxlib itself never depends on typer:
|
|
23
23
|
# `uv tool install sdmxlib-cli` gives an `sdmxlib` command.
|
|
24
24
|
dependencies = [
|
|
25
|
-
"sdmxlib==0.
|
|
25
|
+
"sdmxlib==0.75.0",
|
|
26
26
|
# Pre-1.0, so capped at the minor.
|
|
27
27
|
"typer>=0.27.3,<0.28",
|
|
28
28
|
]
|
|
@@ -13,7 +13,16 @@ import typer
|
|
|
13
13
|
|
|
14
14
|
import sdmxlib as sl
|
|
15
15
|
from sdmxlib.api.providers import ProviderInfo
|
|
16
|
-
from sdmxlib.bundle import
|
|
16
|
+
from sdmxlib.bundle import (
|
|
17
|
+
MANIFEST_NAME,
|
|
18
|
+
Profile,
|
|
19
|
+
Tier,
|
|
20
|
+
bundle_files,
|
|
21
|
+
check_bundle,
|
|
22
|
+
copy_bundle,
|
|
23
|
+
fetch_bundle,
|
|
24
|
+
read_manifest,
|
|
25
|
+
)
|
|
17
26
|
from sdmxlib.model.dataflow import Dataflow
|
|
18
27
|
from sdmxlib.model.urn import SdmxUrn
|
|
19
28
|
|
|
@@ -44,15 +53,23 @@ def check(
|
|
|
44
53
|
help="The profile: publish (hashes everything), receive (data files by size) or open (sizes only).",
|
|
45
54
|
),
|
|
46
55
|
],
|
|
56
|
+
expect: Annotated[
|
|
57
|
+
Path | None,
|
|
58
|
+
typer.Option(
|
|
59
|
+
help="An earlier publication whose content this one must have: each fingerprint that differs is a finding.",
|
|
60
|
+
),
|
|
61
|
+
] = None,
|
|
47
62
|
) -> None:
|
|
48
63
|
"""Check a published bundle against its manifest and against itself.
|
|
49
64
|
|
|
50
65
|
Prints each finding and what was checked. Exits 1 if anything was found.
|
|
66
|
+
``--expect`` guards a republish that is to change no content, such as a
|
|
67
|
+
rebuild at a new store schema.
|
|
51
68
|
|
|
52
69
|
Raises:
|
|
53
70
|
Exit: With status 1 when the bundle has findings, 0 otherwise.
|
|
54
71
|
"""
|
|
55
|
-
report = check_bundle(path, at=_PROFILES[at])
|
|
72
|
+
report = check_bundle(path, at=_PROFILES[at], expect=expect)
|
|
56
73
|
for finding in report.findings:
|
|
57
74
|
typer.echo(str(finding))
|
|
58
75
|
found = len(report.findings)
|
|
@@ -132,8 +149,53 @@ def copy(
|
|
|
132
149
|
Raises:
|
|
133
150
|
BadParameter: If a tier is not 1, 2 or 3.
|
|
134
151
|
"""
|
|
152
|
+
manifest = copy_bundle(source, destination, tiers=_tiers(tiers))
|
|
153
|
+
typer.echo(f"{destination}: {manifest.bundle_id}, token {manifest.token}; {len(manifest.files)} files")
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
@bundle.command("files")
|
|
157
|
+
def files(
|
|
158
|
+
manifest: Annotated[
|
|
159
|
+
Path, typer.Argument(help="A publication directory, or its bundle.manifest.json wherever it is staged.")
|
|
160
|
+
],
|
|
161
|
+
*,
|
|
162
|
+
tiers: Annotated[
|
|
163
|
+
str, typer.Option(help="Placement tiers to list, comma-separated: 1,2 for what a server holds.")
|
|
164
|
+
] = "1,2,3",
|
|
165
|
+
manifest_only: Annotated[
|
|
166
|
+
bool, typer.Option("--manifest", help="Print only the manifest's path, for the copy's second step.")
|
|
167
|
+
] = False,
|
|
168
|
+
) -> None:
|
|
169
|
+
r"""Print the files a copy of a publication needs, one path per line, for rclone or azcopy.
|
|
170
|
+
|
|
171
|
+
Paths are under the bundle directory: ``<token>/meta.duckdb``,
|
|
172
|
+
``data/<schema>/<table>/ducklake-….parquet``. The manifest is left out,
|
|
173
|
+
and ``--manifest`` prints its path alone: copy tools move several files at
|
|
174
|
+
once, so the manifest is copied in a second step, after every other file.
|
|
175
|
+
|
|
176
|
+
sdmxlib bundle files /stage/census --tiers 1,2 \
|
|
177
|
+
| rclone copy --files-from - store:bundles/census /var/bundles/census
|
|
178
|
+
sdmxlib bundle files /stage/census --manifest \
|
|
179
|
+
| rclone copy --files-from - store:bundles/census /var/bundles/census
|
|
180
|
+
|
|
181
|
+
Raises:
|
|
182
|
+
BadParameter: If a tier is not 1, 2 or 3.
|
|
183
|
+
"""
|
|
184
|
+
root = manifest.parent if manifest.name == MANIFEST_NAME else manifest
|
|
185
|
+
read = read_manifest(root)
|
|
186
|
+
listed = [f"{read.token}/{MANIFEST_NAME}"] if manifest_only else bundle_files(read, tiers=_tiers(tiers))
|
|
187
|
+
for path in listed:
|
|
188
|
+
typer.echo(path)
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
def _tiers(text: str) -> list[Tier]:
|
|
192
|
+
"""The placement tiers `text` names, comma-separated.
|
|
193
|
+
|
|
194
|
+
Raises:
|
|
195
|
+
BadParameter: If one is not 1, 2 or 3.
|
|
196
|
+
"""
|
|
135
197
|
chosen: list[Tier] = []
|
|
136
|
-
for part in
|
|
198
|
+
for part in text.split(","):
|
|
137
199
|
match part.strip():
|
|
138
200
|
case "1":
|
|
139
201
|
chosen.append(1)
|
|
@@ -144,5 +206,4 @@ def copy(
|
|
|
144
206
|
case other:
|
|
145
207
|
msg = f"{other!r} is not a tier; give 1, 2 or 3, comma-separated"
|
|
146
208
|
raise typer.BadParameter(msg)
|
|
147
|
-
|
|
148
|
-
typer.echo(f"{destination}: {manifest.bundle_id}, token {manifest.token}; {len(manifest.files)} files")
|
|
209
|
+
return chosen
|
|
File without changes
|
|
File without changes
|