statcatlib 0.16.1__tar.gz → 0.16.2__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.
- {statcatlib-0.16.1 → statcatlib-0.16.2}/PKG-INFO +1 -1
- {statcatlib-0.16.1 → statcatlib-0.16.2}/pyproject.toml +1 -1
- {statcatlib-0.16.1 → statcatlib-0.16.2}/pyproject.toml.orig +1 -1
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/cli/EGM.md +5 -3
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/cli/__init__.py +38 -9
- {statcatlib-0.16.1 → statcatlib-0.16.2}/LICENSE +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/README.md +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/EGM.md +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/__init__.py +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/admin.py +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/bundle.py +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/catalog.py +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/checks.py +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/diagnostics.py +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/expr.py +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/model/EGM.md +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/model/__init__.py +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/model/agents.py +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/model/catalog.py +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/model/classification.py +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/model/dataset.py +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/model/distribution.py +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/model/licence.py +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/model/quality.py +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/model/skos.py +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/model/spatial.py +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/model/temporal.py +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/model/types.py +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/py.typed +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/query.py +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/sources/EGM.md +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/sources/__init__.py +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/sources/ckan.py +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/sources/sdmx.py +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/store/EGM.md +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/store/__init__.py +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/store/blob.py +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/store/cross_product.py +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/store/inventory.py +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/store/lance.py +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/store/row.py +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/store/schema.py +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/store/scopes.py +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/store/sentinel.py +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/store/store.py +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/store/working_copy.py +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/store/xhtml.py +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/testing.py +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/upload.py +0 -0
- {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/urn.py +0 -0
|
@@ -39,7 +39,7 @@ Commands:
|
|
|
39
39
|
| `statcat verify-catalog PATH` | `verify_catalog` | `diagnostics.verify_catalog(path)` | any finding, each printed as `FAIL <file>: <detail>`; exit 2 on `CatalogUnreadableError`. Each stale data edition prints as `STALE <StaleEdition>` and leaves the exit code alone |
|
|
40
40
|
| `statcat doctor PATH` | `doctor` | `diagnostics.doctor(path)` | the report holds a warning (topic `stale data editions`: a stale embargoed data edition is one; a stale live edition is `info` and leaves the exit code alone; topic `partials with no structure home`: each item is one) |
|
|
41
41
|
| `statcat prune PATH --older-than DAYS --reason TEXT [--apply]` | `prune` | `sc.CatalogAdmin.open(path).prune(older_than=timedelta(days=DAYS), reason=TEXT, dry_run=not apply)` | `catalog.json` is missing, the catalog cannot be opened, the retire commit is refused, or a deletion failed (each printed as `FAIL <path>: <error>`) |
|
|
42
|
-
| `statcat upload EDITION_DIR AZ_URL [--release-at TIME]` | `upload` | `upload_edition(edition_dir, location, release_at=)` | a finding, each printed as `FAIL <file>: <detail>`, or a `ManifestError`, `BlobStoreError` or `ClientAuthenticationError`, printed as `ERROR <message>`; exit 2 on a usage error, a bad `AZ_URL`, `s3://`, no `AZURE_STORAGE_ACCOUNT_NAME`, a refused `obstore` variable set, even empty, in any spelling `obstore` reads (`_REFUSED_VARIABLES`, matched by `_refused_variables`: `AZURE_` then any case), a naive time,
|
|
42
|
+
| `statcat upload EDITION_DIR AZ_URL [--release-at TIME]` | `upload` | `upload_edition(edition_dir, location, release_at=)` | a finding, each printed as `FAIL <file>: <detail>`, or a `ManifestError`, `BlobStoreError` or `ClientAuthenticationError`, printed as `ERROR <message>`; exit 2 on a usage error, a bad `AZ_URL`, `s3://`, no `AZURE_STORAGE_ACCOUNT_NAME`, a refused `obstore` variable set, even empty, in any spelling `obstore` reads (`_REFUSED_VARIABLES`, matched by `_refused_variables`: `AZURE_` then any case), a naive time, a missing `blob` extra, or an environment value `obstore` cannot parse, such as `AZURE_DISABLE_TAGGING=junk` (`GenericError` from the store build, before any request) |
|
|
43
43
|
|
|
44
44
|
`build-index` options and their `WorkingCopy.build_index` keyword:
|
|
45
45
|
|
|
@@ -78,8 +78,10 @@ Private helpers that tests and later commands rely on:
|
|
|
78
78
|
`_refused_variables()` lists the environment's names that `obstore` would parse as a
|
|
79
79
|
refused key, as spelled. `_azure_location(uri, account)` builds the store with `obstore.store.from_url`,
|
|
80
80
|
`TokenIdentity(AzureCredentialProvider(DefaultAzureCredential()))` and the one-hour
|
|
81
|
-
timeout
|
|
82
|
-
|
|
81
|
+
timeout, and turns obstore's `GenericError` from that build into `_usage`, with the text from
|
|
82
|
+
`_store_build_message(exc)`: obstore's first line, and the `AZURE_DISABLE_TAGGING` spelling the
|
|
83
|
+
environment sets, since obstore 0.12.1's message omits the variable. `upload` is the only code in
|
|
84
|
+
statcatlib that reads the environment for a store.
|
|
83
85
|
- `_parse_codelist_policy(raw)` — accepts only mode `fts_only`
|
|
84
86
|
(`_ACCEPTED_CODELIST_MODES`); raises `typer.BadParameter` otherwise.
|
|
85
87
|
- `_parse_reference_metadata_blend(raw)` — `max_chars` must be a positive
|
|
@@ -669,22 +669,49 @@ def _azure_account() -> str:
|
|
|
669
669
|
|
|
670
670
|
|
|
671
671
|
def _azure_location(uri: str, account: str) -> BlobLocation:
|
|
672
|
-
"""The catalog at *uri*, reached with `DefaultAzureCredential
|
|
672
|
+
"""The catalog at *uri*, reached with `DefaultAzureCredential`.
|
|
673
|
+
|
|
674
|
+
A missing ``blob`` extra exits 2, and so does an environment value `obstore` cannot parse, such as
|
|
675
|
+
``AZURE_DISABLE_TAGGING=junk``: obstore 0.12.1 raises `GenericError` from the store build, before any request.
|
|
676
|
+
"""
|
|
673
677
|
try:
|
|
674
678
|
from azure.identity import DefaultAzureCredential # noqa: PLC0415
|
|
675
679
|
from obstore.auth.azure import AzureCredentialProvider # noqa: PLC0415
|
|
680
|
+
from obstore.exceptions import GenericError # noqa: PLC0415
|
|
676
681
|
from obstore.store import from_url # noqa: PLC0415
|
|
677
682
|
except ImportError:
|
|
678
683
|
_usage("upload needs the blob extra: uv add 'statcatlib[blob]' (or pip install 'statcatlib[blob]')")
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
684
|
+
credential = TokenIdentity(AzureCredentialProvider(DefaultAzureCredential()))
|
|
685
|
+
try:
|
|
686
|
+
store = from_url(
|
|
687
|
+
uri.removesuffix("/"),
|
|
688
|
+
account_name=account,
|
|
689
|
+
credential_provider=credential,
|
|
690
|
+
client_options={"timeout": _UPLOAD_TIMEOUT},
|
|
691
|
+
)
|
|
692
|
+
except GenericError as exc:
|
|
693
|
+
_usage(_store_build_message(exc))
|
|
685
694
|
return BlobLocation(uri, store)
|
|
686
695
|
|
|
687
696
|
|
|
697
|
+
def _store_build_message(exc: Exception) -> str:
|
|
698
|
+
"""The exit-2 text for a store build that failed on the environment.
|
|
699
|
+
|
|
700
|
+
obstore 0.12.1's message names the value and omits the variable, so the text names
|
|
701
|
+
``AZURE_DISABLE_TAGGING`` when the environment sets it, in any case after ``AZURE_``.
|
|
702
|
+
"""
|
|
703
|
+
reason = str(exc).splitlines()[0] if str(exc) else type(exc).__name__
|
|
704
|
+
message = f"obstore cannot build the store from the environment ({reason})"
|
|
705
|
+
tagging = sorted(
|
|
706
|
+
name
|
|
707
|
+
for name in os.environ
|
|
708
|
+
if name.startswith("AZURE_") and name.isascii() and name.lower() == "azure_disable_tagging"
|
|
709
|
+
)
|
|
710
|
+
if tagging:
|
|
711
|
+
message += f"; {', '.join(tagging)} takes true or false"
|
|
712
|
+
return message
|
|
713
|
+
|
|
714
|
+
|
|
688
715
|
@app.command("upload")
|
|
689
716
|
def upload(
|
|
690
717
|
edition_dir: Path = typer.Argument(
|
|
@@ -709,8 +736,10 @@ def upload(
|
|
|
709
736
|
release job. It exits 0 when the edition is uploaded, or already registered
|
|
710
737
|
with the same bytes; 1 on any finding, each printed as ``FAIL <file>: <detail>``,
|
|
711
738
|
or on a store or credential failure, printed as ``ERROR <message>``; and 2 on
|
|
712
|
-
a usage error, a missing ``blob`` extra,
|
|
713
|
-
|
|
739
|
+
a usage error, a missing ``blob`` extra, an environment value ``obstore``
|
|
740
|
+
cannot parse, such as ``AZURE_DISABLE_TAGGING=junk``, or any of these
|
|
741
|
+
variables set, even empty: ``AZURE_STORAGE_ACCOUNT_KEY``,
|
|
742
|
+
``AZURE_STORAGE_ACCESS_KEY``,
|
|
714
743
|
``AZURE_STORAGE_MASTER_KEY``, ``AZURE_STORAGE_SAS_KEY``,
|
|
715
744
|
``AZURE_STORAGE_SAS_TOKEN``, ``AZURE_STORAGE_TOKEN``,
|
|
716
745
|
``AZURE_STORAGE_ENDPOINT``, ``AZURE_ENDPOINT``,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|