sdmxlib-cli 0.79.0__tar.gz → 0.80.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.
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sdmxlib-cli
3
- Version: 0.79.0
4
- Summary: sdmxlib from the command line: check SDMX bundles
3
+ Version: 0.80.0
4
+ Summary: sdmxlib from the command line: check SDMX editions
5
5
  Keywords: sdmx,statistics,metadata,cli
6
6
  Author: gabrielgellner
7
7
  Author-email: gabrielgellner <gabrielgellner@gmail.com>
@@ -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.79.0
14
+ Requires-Dist: sdmxlib==0.80.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
@@ -29,10 +29,10 @@ separate install, so the library itself carries no CLI dependency:
29
29
  ```sh
30
30
  uv tool install sdmxlib-cli
31
31
  # or: pip install sdmxlib-cli
32
- sdmxlib bundle check path/to/publication --at publish
32
+ sdmxlib edition check path/to/edition --at publish
33
33
  ```
34
34
 
35
- `sdmxlib bundle check` runs `sdmxlib.bundle.check_bundle` at the profile
35
+ `sdmxlib edition check` runs `sdmxlib.edition.check_edition` at the profile
36
36
  `--at` names. `publish` checks the manifest, every file's checksum, the
37
37
  DuckLake catalog, the bindings' observation counts, the structural closure
38
38
  and the fingerprints. `receive` checks data files by size and leaves the
@@ -6,10 +6,10 @@ separate install, so the library itself carries no CLI dependency:
6
6
  ```sh
7
7
  uv tool install sdmxlib-cli
8
8
  # or: pip install sdmxlib-cli
9
- sdmxlib bundle check path/to/publication --at publish
9
+ sdmxlib edition check path/to/edition --at publish
10
10
  ```
11
11
 
12
- `sdmxlib bundle check` runs `sdmxlib.bundle.check_bundle` at the profile
12
+ `sdmxlib edition check` runs `sdmxlib.edition.check_edition` at the profile
13
13
  `--at` names. `publish` checks the manifest, every file's checksum, the
14
14
  DuckLake catalog, the bindings' observation counts, the structural closure
15
15
  and the fingerprints. `receive` checks data files by size and leaves the
@@ -1,7 +1,7 @@
1
1
  [project]
2
2
  name = "sdmxlib-cli"
3
- version = "0.79.0"
4
- description = "sdmxlib from the command line: check SDMX bundles"
3
+ version = "0.80.0"
4
+ description = "sdmxlib from the command line: check SDMX editions"
5
5
  readme = "README.md"
6
6
  license = "Apache-2.0"
7
7
  license-files = ["LICENSE"]
@@ -19,7 +19,7 @@ classifiers = [
19
19
  "Programming Language :: Python :: 3.14",
20
20
  ]
21
21
  dependencies = [
22
- "sdmxlib==0.79.0",
22
+ "sdmxlib==0.80.0",
23
23
  "typer>=0.27.3,<0.28",
24
24
  ]
25
25
 
@@ -3,8 +3,8 @@ 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.79.0"
7
- description = "sdmxlib from the command line: check SDMX bundles"
6
+ version = "0.80.0"
7
+ description = "sdmxlib from the command line: check SDMX editions"
8
8
  readme = "README.md"
9
9
  license = "Apache-2.0"
10
10
  # Its own copy, as PEP 639 keeps `license-files` inside the package directory;
@@ -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.79.0",
25
+ "sdmxlib==0.80.0",
26
26
  # Pre-1.0, so capped at the minor.
27
27
  "typer>=0.27.3,<0.28",
28
28
  ]
@@ -4,7 +4,7 @@
4
4
 
5
5
  The `sdmxlib` command, a typer app shipped as the separate `sdmxlib-cli`
6
6
  distribution so that `sdmxlib` itself never depends on typer (GH-67). Each
7
- command is a thin wrapper over `sdmxlib.bundle`: the module parses arguments,
7
+ command is a thin wrapper over `sdmxlib.edition`: the module parses arguments,
8
8
  calls one library function, and prints its result. The library tests the
9
9
  behaviour behind each command; `tests/unit/test_cli.py` tests the wrapping.
10
10
 
@@ -12,24 +12,24 @@ behaviour behind each command; `tests/unit/test_cli.py` tests the wrapping.
12
12
 
13
13
  - `app` — the root `typer.Typer`; the console script `sdmxlib = "sdmxlib_cli:app"`
14
14
  in `cli/pyproject.toml`. It holds one sub-app, `bundle`.
15
- - `sdmxlib bundle check PATH --at {publish,receive,open} [--expect EARLIER]` —
16
- `check(path, *, at, expect)` calls `check_bundle(path, at=..., expect=...)`,
15
+ - `sdmxlib edition check PATH --at {publish,receive,open} [--expect EARLIER]` —
16
+ `check(path, *, at, expect)` calls `check_edition(path, at=..., expect=...)`,
17
17
  prints each finding and a summary line
18
18
  (`<path>: N finding(s); checked ...`), and exits 1 when the report is not
19
19
  `ok`, 0 otherwise. `--at` is required.
20
- - `sdmxlib bundle fetch SOURCE FLOW PATH [--key] [--start] [--end]
20
+ - `sdmxlib edition fetch SOURCE FLOW PATH [--key] [--start] [--end]
21
21
  [--structures-only] [--api 2.1] [--source-id]` — `fetch(...)` calls
22
- `fetch_bundle` and prints `<path>/<token>: <bundle_id>, <counts>; token <token>`.
23
- `PATH` must be absent or empty (`fetch_bundle` raises `FileExistsError`
24
- otherwise); the publication lands in `<path>/<token>/` and its data files in
22
+ `fetch_edition` and prints `<path>/<edition_id>: <product_id>, <counts>; edition id <edition_id>`.
23
+ `PATH` must be absent or empty (`fetch_edition` raises `FileExistsError`
24
+ otherwise); the edition lands in `<path>/<edition_id>/` and its data files in
25
25
  `<path>/data/`. `--api` and `--source-id` apply only to a URL `SOURCE`; a
26
26
  provider carries its own API version.
27
- - `sdmxlib bundle copy SOURCE DESTINATION [--tiers 1,2,3]` — `copy(...)` calls
28
- `copy_bundle` and prints the destination, bundle id, token and file count.
29
- - `sdmxlib bundle files MANIFEST [--tiers 1,2,3] [--manifest]` — `files(...)`
30
- reads the manifest with `read_manifest` and prints `bundle_files(...)` one
27
+ - `sdmxlib edition copy SOURCE DESTINATION [--tiers 1,2,3]` — `copy(...)` calls
28
+ `copy_edition` and prints the destination, product id, edition id and file count.
29
+ - `sdmxlib edition files MANIFEST [--tiers 1,2,3] [--manifest]` — `files(...)`
30
+ reads the manifest with `read_manifest` and prints `edition_files(...)` one
31
31
  path per line, for `rclone --files-from -` or azcopy; `--manifest` prints
32
- only `<token>/bundle.manifest.json`.
32
+ only `<edition_id>/manifest.json`.
33
33
  - `At` — `StrEnum` of `--at`'s choices (`publish`, `receive`, `open`), mapped
34
34
  to the library's `Profile` literals by `_PROFILES`.
35
35
  - Private parsers: `_source(text)` (a `sl.Provider` by case-insensitive name,
@@ -40,14 +40,14 @@ behaviour behind each command; `tests/unit/test_cli.py` tests the wrapping.
40
40
  ## Invariants
41
41
 
42
42
  - Commands hold no logic of their own beyond argument parsing and printing;
43
- behaviour changes belong in `sdmxlib.bundle`.
43
+ behaviour changes belong in `sdmxlib.edition`.
44
44
  - A bad `SOURCE`, `FLOW` or tier raises `typer.BadParameter` naming the
45
45
  accepted forms, so the CLI prints usage rather than a traceback. `_flow`
46
46
  converts the library's `SdmxParseError` (a malformed URN, agency or id) and
47
47
  refuses a version that is neither `latest` nor an SDMX version
48
48
  (`model.version.compliance`), in either form (GH-265).
49
- - `bundle files` accepts either a publication directory or a
50
- `bundle.manifest.json` staged elsewhere (its parent is used). Its listing
49
+ - `edition files` accepts either an edition directory or a
50
+ `manifest.json` staged elsewhere (its parent is used). Its listing
51
51
  leaves the manifest out and `--manifest` prints the manifest's path alone,
52
52
  so a copy tool moves the manifest in a second step, after every other file.
53
53
  - `cli/pyproject.toml`'s version and its `sdmxlib==` pin equal sdmxlib's
@@ -57,10 +57,10 @@ behaviour behind each command; `tests/unit/test_cli.py` tests the wrapping.
57
57
 
58
58
  ## Side Effects
59
59
 
60
- - `check` and `files` read the bundle (manifest, files, DuckDB catalog) and
60
+ - `check` and `files` read the edition (manifest, files, DuckDB catalog) and
61
61
  write nothing.
62
62
  - `fetch` makes HTTP requests to the SDMX REST source and creates a new
63
- publication directory under `PATH`.
63
+ edition directory under `PATH`.
64
64
  - `copy` writes files to `DESTINATION` and the shared data directory beside
65
65
  it, verifies them, and writes the manifest last.
66
66
  - All commands write to stdout; `check` sets the process exit status.
@@ -1,4 +1,4 @@
1
- """``sdmxlib``: the command line over the library's bundle tools (GH-67).
1
+ """``sdmxlib``: the command line over the library's edition tools (GH-67).
2
2
 
3
3
  A separate distribution, ``sdmxlib-cli``, so ``sdmxlib`` itself never depends on
4
4
  typer. Each command is a thin wrapper: the work is the library's, and is
@@ -13,14 +13,14 @@ 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.edition import (
17
17
  MANIFEST_NAME,
18
18
  Profile,
19
19
  Tier,
20
- bundle_files,
21
- check_bundle,
22
- copy_bundle,
23
- fetch_bundle,
20
+ edition_files,
21
+ check_edition,
22
+ copy_edition,
23
+ fetch_edition,
24
24
  read_manifest,
25
25
  )
26
26
  from sdmxlib.model.dataflow import Dataflow
@@ -39,13 +39,13 @@ class At(StrEnum):
39
39
  _PROFILES: dict[At, Profile] = {At.PUBLISH: "publish", At.RECEIVE: "receive", At.OPEN: "open"}
40
40
 
41
41
  app = typer.Typer(help="sdmxlib from the command line.", no_args_is_help=True)
42
- bundle = typer.Typer(help="Published SDMX bundles.", no_args_is_help=True)
43
- app.add_typer(bundle, name="bundle")
42
+ edition = typer.Typer(help="Sealed editions of SDMX products.", no_args_is_help=True)
43
+ app.add_typer(edition, name="edition")
44
44
 
45
45
 
46
- @bundle.command("check")
46
+ @edition.command("check")
47
47
  def check(
48
- path: Annotated[Path, typer.Argument(help="The bundle directory.")],
48
+ path: Annotated[Path, typer.Argument(help="The edition directory.")],
49
49
  *,
50
50
  at: Annotated[
51
51
  At,
@@ -57,20 +57,20 @@ def check(
57
57
  expect: Annotated[
58
58
  Path | None,
59
59
  typer.Option(
60
- help="An earlier publication whose content this one must have: each fingerprint that differs is a finding.",
60
+ help="An earlier edition whose content this one must have: each fingerprint that differs is a finding.",
61
61
  ),
62
62
  ] = None,
63
63
  ) -> None:
64
- """Check a published bundle against its manifest and against itself.
64
+ """Check a sealed edition against its manifest and against itself.
65
65
 
66
66
  Prints each finding and what was checked. Exits 1 if anything was found.
67
67
  ``--expect`` guards a republish that is to change no content, such as a
68
68
  rebuild at a new store schema.
69
69
 
70
70
  Raises:
71
- Exit: With status 1 when the bundle has findings, 0 otherwise.
71
+ Exit: With status 1 when the edition has findings, 0 otherwise.
72
72
  """
73
- report = check_bundle(path, at=_PROFILES[at], expect=expect)
73
+ report = check_edition(path, at=_PROFILES[at], expect=expect)
74
74
  for finding in report.findings:
75
75
  typer.echo(str(finding))
76
76
  found = len(report.findings)
@@ -118,11 +118,11 @@ def _flow(text: str) -> SdmxUrn[Dataflow]:
118
118
  return urn
119
119
 
120
120
 
121
- @bundle.command("fetch")
121
+ @edition.command("fetch")
122
122
  def fetch(
123
123
  source: Annotated[str, typer.Argument(help="A provider (ECB, ESTAT, BIS, OECD, ...) or a REST endpoint URL.")],
124
124
  flow: Annotated[str, typer.Argument(help="The dataflow: AGENCY:ID(VERSION), AGENCY:ID, or a URN.")],
125
- path: Annotated[Path, typer.Argument(help="The bundle directory; the publication is created inside it.")],
125
+ path: Annotated[Path, typer.Argument(help="The product directory; the edition is created inside it.")],
126
126
  *,
127
127
  key: Annotated[str | None, typer.Option(help="SDMX key, e.g. M.USD+GBP.EUR.SP00.A.")] = None,
128
128
  start: Annotated[str | None, typer.Option(help="Inclusive startPeriod.")] = None,
@@ -131,11 +131,11 @@ def fetch(
131
131
  api: Annotated[str, typer.Option(help="REST API version of a URL source.")] = "2.1",
132
132
  source_id: Annotated[str | None, typer.Option(help="Registry id of a URL source, recorded as provenance.")] = None,
133
133
  ) -> None:
134
- """Fetch one dataflow, narrowed by key and period, into a new published bundle.
134
+ """Fetch one dataflow, narrowed by key and period, into a new sealed edition.
135
135
 
136
- Prints the publication directory, its token and what it holds.
136
+ Prints the edition directory, its product and what it holds.
137
137
  """
138
- manifest = fetch_bundle(
138
+ manifest = fetch_edition(
139
139
  _source(source),
140
140
  _flow(flow),
141
141
  path,
@@ -147,61 +147,59 @@ def fetch(
147
147
  source_id=source_id,
148
148
  )
149
149
  counts = ", ".join(f"{b.observations} observations" for b in manifest.bindings) or "structures only"
150
- typer.echo(f"{path / manifest.token}: {manifest.bundle_id}, {counts}; token {manifest.token}")
150
+ typer.echo(f"{path / manifest.edition_id}: {manifest.product_id}, {counts}")
151
151
 
152
152
 
153
- @bundle.command("copy")
153
+ @edition.command("copy")
154
154
  def copy(
155
- source: Annotated[Path, typer.Argument(help="The published publication directory.")],
156
- destination: Annotated[Path, typer.Argument(help="The publication directory to create.")],
155
+ source: Annotated[Path, typer.Argument(help="The sealed edition directory.")],
156
+ destination: Annotated[Path, typer.Argument(help="The edition directory to create.")],
157
157
  *,
158
158
  tiers: Annotated[
159
- str, typer.Option(help="Placement tiers to copy, comma-separated: 1,2 for what a server holds.")
160
- ] = "1,2,3",
159
+ str, typer.Option(help="Placement tiers to copy, comma-separated: required,lazy for what a server holds.")
160
+ ] = "required,lazy,remote",
161
161
  ) -> None:
162
- """Copy a publication's listed files, verify them, and write its manifest last.
162
+ """Copy an edition's listed files, verify them, and write its manifest last.
163
163
 
164
164
  Data files go to the shared data directory beside the destination, and one
165
- already there at the listed digest is kept. Prints the token copied.
165
+ already there at the listed digest is kept. Prints the edition copied.
166
166
 
167
167
  Raises:
168
- BadParameter: If a tier is not 1, 2 or 3.
168
+ BadParameter: If a tier is not required, lazy or remote.
169
169
  """
170
- manifest = copy_bundle(source, destination, tiers=_tiers(tiers))
171
- typer.echo(f"{destination}: {manifest.bundle_id}, token {manifest.token}; {len(manifest.files)} files")
170
+ manifest = copy_edition(source, destination, tiers=_tiers(tiers))
171
+ typer.echo(f"{destination}: {manifest.product_id}, edition {manifest.edition_id}; {len(manifest.files)} files")
172
172
 
173
173
 
174
- @bundle.command("files")
174
+ @edition.command("files")
175
175
  def files(
176
- manifest: Annotated[
177
- Path, typer.Argument(help="A publication directory, or its bundle.manifest.json wherever it is staged.")
178
- ],
176
+ manifest: Annotated[Path, typer.Argument(help="An edition directory, or its manifest.json wherever it is staged.")],
179
177
  *,
180
178
  tiers: Annotated[
181
- str, typer.Option(help="Placement tiers to list, comma-separated: 1,2 for what a server holds.")
182
- ] = "1,2,3",
179
+ str, typer.Option(help="Placement tiers to list, comma-separated: required,lazy for what a server holds.")
180
+ ] = "required,lazy,remote",
183
181
  manifest_only: Annotated[
184
182
  bool, typer.Option("--manifest", help="Print only the manifest's path, for the copy's second step.")
185
183
  ] = False,
186
184
  ) -> None:
187
- r"""Print the files a copy of a publication needs, one path per line, for rclone or azcopy.
185
+ r"""Print the files a copy of an edition needs, one path per line, for rclone or azcopy.
188
186
 
189
- Paths are under the bundle directory: ``<token>/meta.duckdb``,
187
+ Paths are under the product directory: ``<edition_id>/metadata.duckdb``,
190
188
  ``data/<schema>/<table>/ducklake-….parquet``. The manifest is left out,
191
189
  and ``--manifest`` prints its path alone: copy tools move several files at
192
190
  once, so the manifest is copied in a second step, after every other file.
193
191
 
194
- sdmxlib bundle files /stage/census --tiers 1,2 \
195
- | rclone copy --files-from - store:bundles/census /var/bundles/census
196
- sdmxlib bundle files /stage/census --manifest \
197
- | rclone copy --files-from - store:bundles/census /var/bundles/census
192
+ sdmxlib edition files /stage/census --tiers required,lazy \
193
+ | rclone copy --files-from - store:products/census /var/products/census
194
+ sdmxlib edition files /stage/census --manifest \
195
+ | rclone copy --files-from - store:products/census /var/products/census
198
196
 
199
197
  Raises:
200
- BadParameter: If a tier is not 1, 2 or 3.
198
+ BadParameter: If a tier is not required, lazy or remote.
201
199
  """
202
200
  root = manifest.parent if manifest.name == MANIFEST_NAME else manifest
203
201
  read = read_manifest(root)
204
- listed = [f"{read.token}/{MANIFEST_NAME}"] if manifest_only else bundle_files(read, tiers=_tiers(tiers))
202
+ listed = [f"{read.edition_id}/{MANIFEST_NAME}"] if manifest_only else edition_files(read, tiers=_tiers(tiers))
205
203
  for path in listed:
206
204
  typer.echo(path)
207
205
 
@@ -210,18 +208,18 @@ def _tiers(text: str) -> list[Tier]:
210
208
  """The placement tiers `text` names, comma-separated.
211
209
 
212
210
  Raises:
213
- BadParameter: If one is not 1, 2 or 3.
211
+ BadParameter: If one is not required, lazy or remote.
214
212
  """
215
213
  chosen: list[Tier] = []
216
214
  for part in text.split(","):
217
215
  match part.strip():
218
- case "1":
219
- chosen.append(1)
220
- case "2":
221
- chosen.append(2)
222
- case "3":
223
- chosen.append(3)
216
+ case "required":
217
+ chosen.append("required")
218
+ case "lazy":
219
+ chosen.append("lazy")
220
+ case "remote":
221
+ chosen.append("remote")
224
222
  case other:
225
- msg = f"{other!r} is not a tier; give 1, 2 or 3, comma-separated"
223
+ msg = f"{other!r} is not a tier; give required, lazy or remote, comma-separated"
226
224
  raise typer.BadParameter(msg)
227
225
  return chosen
File without changes