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.
Files changed (50) hide show
  1. {statcatlib-0.16.1 → statcatlib-0.16.2}/PKG-INFO +1 -1
  2. {statcatlib-0.16.1 → statcatlib-0.16.2}/pyproject.toml +1 -1
  3. {statcatlib-0.16.1 → statcatlib-0.16.2}/pyproject.toml.orig +1 -1
  4. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/cli/EGM.md +5 -3
  5. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/cli/__init__.py +38 -9
  6. {statcatlib-0.16.1 → statcatlib-0.16.2}/LICENSE +0 -0
  7. {statcatlib-0.16.1 → statcatlib-0.16.2}/README.md +0 -0
  8. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/EGM.md +0 -0
  9. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/__init__.py +0 -0
  10. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/admin.py +0 -0
  11. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/bundle.py +0 -0
  12. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/catalog.py +0 -0
  13. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/checks.py +0 -0
  14. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/diagnostics.py +0 -0
  15. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/expr.py +0 -0
  16. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/model/EGM.md +0 -0
  17. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/model/__init__.py +0 -0
  18. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/model/agents.py +0 -0
  19. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/model/catalog.py +0 -0
  20. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/model/classification.py +0 -0
  21. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/model/dataset.py +0 -0
  22. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/model/distribution.py +0 -0
  23. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/model/licence.py +0 -0
  24. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/model/quality.py +0 -0
  25. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/model/skos.py +0 -0
  26. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/model/spatial.py +0 -0
  27. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/model/temporal.py +0 -0
  28. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/model/types.py +0 -0
  29. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/py.typed +0 -0
  30. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/query.py +0 -0
  31. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/sources/EGM.md +0 -0
  32. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/sources/__init__.py +0 -0
  33. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/sources/ckan.py +0 -0
  34. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/sources/sdmx.py +0 -0
  35. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/store/EGM.md +0 -0
  36. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/store/__init__.py +0 -0
  37. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/store/blob.py +0 -0
  38. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/store/cross_product.py +0 -0
  39. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/store/inventory.py +0 -0
  40. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/store/lance.py +0 -0
  41. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/store/row.py +0 -0
  42. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/store/schema.py +0 -0
  43. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/store/scopes.py +0 -0
  44. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/store/sentinel.py +0 -0
  45. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/store/store.py +0 -0
  46. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/store/working_copy.py +0 -0
  47. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/store/xhtml.py +0 -0
  48. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/testing.py +0 -0
  49. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/upload.py +0 -0
  50. {statcatlib-0.16.1 → statcatlib-0.16.2}/src/statcatlib/urn.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: statcatlib
3
- Version: 0.16.1
3
+ Version: 0.16.2
4
4
  Summary: Queryable open data catalog engine for DCAT-AP, StatDCAT-AP, CKAN, and SDMX
5
5
  Keywords: sdmx,dcat,open-data,catalog,duckdb,statistical-data,ckan
6
6
  Author: gabrielgellner
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "statcatlib"
3
- version = "0.16.1"
3
+ version = "0.16.2"
4
4
  description = "Queryable open data catalog engine for DCAT-AP, StatDCAT-AP, CKAN, and SDMX"
5
5
  license = "Apache-2.0"
6
6
  license-files = ["LICENSE"]
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "statcatlib"
3
- version = "0.16.1"
3
+ version = "0.16.2"
4
4
  description = "Queryable open data catalog engine for DCAT-AP, StatDCAT-AP, CKAN, and SDMX"
5
5
  license = "Apache-2.0"
6
6
  license-files = ["LICENSE"]
@@ -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, or a missing `blob` extra |
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; `upload` is the only code in statcatlib that reads the environment for a
82
- store.
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`; a missing ``blob`` extra exits 2."""
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
- store = from_url(
680
- uri.removesuffix("/"),
681
- account_name=account,
682
- credential_provider=TokenIdentity(AzureCredentialProvider(DefaultAzureCredential())),
683
- client_options={"timeout": _UPLOAD_TIMEOUT},
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, or any of these variables set, even
713
- empty: ``AZURE_STORAGE_ACCOUNT_KEY``, ``AZURE_STORAGE_ACCESS_KEY``,
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