opensdmx 0.26.0__tar.gz → 0.26.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 (23) hide show
  1. {opensdmx-0.26.0 → opensdmx-0.26.2}/PKG-INFO +1 -1
  2. {opensdmx-0.26.0 → opensdmx-0.26.2}/pyproject.toml +1 -1
  3. {opensdmx-0.26.0 → opensdmx-0.26.2}/src/opensdmx/cli.py +12 -0
  4. {opensdmx-0.26.0 → opensdmx-0.26.2}/src/opensdmx/discovery.py +14 -4
  5. {opensdmx-0.26.0 → opensdmx-0.26.2}/src/opensdmx/portals.json +1 -0
  6. {opensdmx-0.26.0 → opensdmx-0.26.2}/README.md +0 -0
  7. {opensdmx-0.26.0 → opensdmx-0.26.2}/src/opensdmx/__init__.py +0 -0
  8. {opensdmx-0.26.0 → opensdmx-0.26.2}/src/opensdmx/ai.py +0 -0
  9. {opensdmx-0.26.0 → opensdmx-0.26.2}/src/opensdmx/base.py +0 -0
  10. {opensdmx-0.26.0 → opensdmx-0.26.2}/src/opensdmx/cache_config.py +0 -0
  11. {opensdmx-0.26.0 → opensdmx-0.26.2}/src/opensdmx/categories.py +0 -0
  12. {opensdmx-0.26.0 → opensdmx-0.26.2}/src/opensdmx/data/descriptions/README.md +0 -0
  13. {opensdmx-0.26.0 → opensdmx-0.26.2}/src/opensdmx/data/descriptions/istat.parquet +0 -0
  14. {opensdmx-0.26.0 → opensdmx-0.26.2}/src/opensdmx/db_cache.py +0 -0
  15. {opensdmx-0.26.0 → opensdmx-0.26.2}/src/opensdmx/embed.py +0 -0
  16. {opensdmx-0.26.0 → opensdmx-0.26.2}/src/opensdmx/guide.py +0 -0
  17. {opensdmx-0.26.0 → opensdmx-0.26.2}/src/opensdmx/hub.py +0 -0
  18. {opensdmx-0.26.0 → opensdmx-0.26.2}/src/opensdmx/inps.py +0 -0
  19. {opensdmx-0.26.0 → opensdmx-0.26.2}/src/opensdmx/py.typed +0 -0
  20. {opensdmx-0.26.0 → opensdmx-0.26.2}/src/opensdmx/ranking.py +0 -0
  21. {opensdmx-0.26.0 → opensdmx-0.26.2}/src/opensdmx/retrieval.py +0 -0
  22. {opensdmx-0.26.0 → opensdmx-0.26.2}/src/opensdmx/utils.py +0 -0
  23. {opensdmx-0.26.0 → opensdmx-0.26.2}/src/opensdmx/which.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: opensdmx
3
- Version: 0.26.0
3
+ Version: 0.26.2
4
4
  Summary: Simple Python interface to any SDMX 2.1 REST API (Eurostat, ISTAT, and more)
5
5
  Keywords: sdmx,statistics,eurostat,istat,open-data,api
6
6
  Author: Andrea Borruso
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "opensdmx"
3
- version = "0.26.0"
3
+ version = "0.26.2"
4
4
  description = "Simple Python interface to any SDMX 2.1 REST API (Eurostat, ISTAT, and more)"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -937,6 +937,18 @@ def constraints(
937
937
  raise typer.Exit(1)
938
938
 
939
939
  if actual_dim not in avail:
940
+ if _output_mode != "table":
941
+ # Same shape as a missing dim in summary mode, so stdout stays
942
+ # parseable instead of being empty on exit 0.
943
+ missing = {
944
+ "dimension_id": actual_dim,
945
+ "n_values": None,
946
+ "codes": [],
947
+ "source": "missing",
948
+ "hint": f"opensdmx values {dataset_id} {actual_dim}",
949
+ }
950
+ _emit(missing, pl.DataFrame([missing]).drop("codes"))
951
+ return
940
952
  err_console.print(
941
953
  f"[yellow]Dimension {actual_dim} is not exposed by {constraint_endpoint}.[/yellow]\n"
942
954
  f"Fetch the full codelist instead: "
@@ -57,6 +57,16 @@ def _struct_path(endpoint: str) -> str:
57
57
  return f"{prefix}/{endpoint}" if prefix else endpoint
58
58
 
59
59
 
60
+ def _codelist_path(codelist_id: str) -> str:
61
+ """Build the SDMX-REST path for a codelist.
62
+
63
+ Most providers answer codelists from the catch-all agency `ALL`; a provider
64
+ whose server only answers for its own agency declares `codelist_agency`.
65
+ """
66
+ agency = get_provider().get("codelist_agency", "ALL")
67
+ return _struct_path(f"codelist/{agency}/{codelist_id}")
68
+
69
+
60
70
  def _dataflow_cache_path() -> Path:
61
71
  path: Path = get_cache_dir() / "dataflows.parquet"
62
72
  return path
@@ -584,10 +594,10 @@ def _get_dimension_description(codelist_id: str | None) -> str | None:
584
594
  return None
585
595
  from .db_cache import get_cached_codelist_info, is_codelist_info_cached, save_codelist_info
586
596
  if is_codelist_info_cached(codelist_id):
587
- explain_cached("GET", _struct_path(f"codelist/ALL/{codelist_id}"))
597
+ explain_cached("GET", _codelist_path(codelist_id))
588
598
  return get_cached_codelist_info(codelist_id)
589
599
  try:
590
- path = _struct_path(f"codelist/ALL/{codelist_id}")
600
+ path = _codelist_path(codelist_id)
591
601
  content = sdmx_request_xml(path)
592
602
  root, ns = xml_parse(content)
593
603
  struct_ns = ns.get("structure", "")
@@ -915,10 +925,10 @@ def _load_codelist_records(dataset: dict[str, Any], dimension_id: str) -> list[d
915
925
  from .db_cache import get_cached_codelist_values, save_codelist_values
916
926
  cached = get_cached_codelist_values(cache_key)
917
927
  if cached is not None:
918
- explain_cached("GET", f"codelist/ALL/{codelist_id}")
928
+ explain_cached("GET", _codelist_path(codelist_id))
919
929
  return cached
920
930
 
921
- path = f"codelist/ALL/{codelist_id}"
931
+ path = _codelist_path(codelist_id)
922
932
  content = sdmx_request_xml(path)
923
933
  root, ns = xml_parse(content)
924
934
 
@@ -119,6 +119,7 @@
119
119
  "agency_id": "BBK",
120
120
  "metadata_prefix": "metadata",
121
121
  "datastructure_agency": "BBK",
122
+ "codelist_agency": "BBK",
122
123
  "constraints_supported": false,
123
124
  "last_n_supported": true,
124
125
  "categories_supported": false
File without changes
File without changes
File without changes