sdmxlib 0.71.0__tar.gz → 0.72.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.
Files changed (169) hide show
  1. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/PKG-INFO +1 -1
  2. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/pyproject.toml +8 -1
  3. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/pyproject.toml.orig +12 -1
  4. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/__init__.py +2 -0
  5. sdmxlib-0.72.0/src/sdmxlib/bundle/__init__.py +99 -0
  6. sdmxlib-0.72.0/src/sdmxlib/bundle/_check.py +217 -0
  7. sdmxlib-0.72.0/src/sdmxlib/bundle/_fetch.py +161 -0
  8. sdmxlib-0.72.0/src/sdmxlib/bundle/_overlay.py +377 -0
  9. sdmxlib-0.72.0/src/sdmxlib/bundle/_write.py +109 -0
  10. sdmxlib-0.72.0/src/sdmxlib/bundle/manifest.schema.json +212 -0
  11. sdmxlib-0.72.0/src/sdmxlib/bundle/overlay.schema.json +127 -0
  12. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/local/data_store.py +26 -0
  13. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/local/registry.py +50 -1
  14. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/validation.py +31 -10
  15. sdmxlib-0.72.0/src/sdmxlib/storage/_manifest.py +184 -0
  16. sdmxlib-0.72.0/src/sdmxlib/storage/_synthetic.py +46 -0
  17. sdmxlib-0.72.0/src/sdmxlib/testing.py +373 -0
  18. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/README.md +0 -0
  19. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/_duckdb.py +0 -0
  20. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/_singleflight.py +0 -0
  21. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/_time.py +0 -0
  22. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/api/__init__.py +0 -0
  23. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/api/_freshness.py +0 -0
  24. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/api/client.py +0 -0
  25. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/api/federated.py +0 -0
  26. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/api/policy.py +0 -0
  27. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/api/providers.py +0 -0
  28. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/api/registry.py +0 -0
  29. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/api/session.py +0 -0
  30. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/builders/__init__.py +0 -0
  31. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/builders/contentconstraint.py +0 -0
  32. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/builders/metadata_annotation.py +0 -0
  33. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/data_store.py +0 -0
  34. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/__init__.py +0 -0
  35. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/_arrow.py +0 -0
  36. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/_attachment.py +0 -0
  37. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/_coerce.py +0 -0
  38. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/_index.py +0 -0
  39. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/_positions.py +0 -0
  40. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/_refuse.py +0 -0
  41. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/data_format.py +0 -0
  42. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/gaps.py +0 -0
  43. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_csv/__init__.py +0 -0
  44. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_csv/reader.py +0 -0
  45. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_csv/writer.py +0 -0
  46. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_json/__init__.py +0 -0
  47. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_json/_data_common.py +0 -0
  48. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_json/_dto.py +0 -0
  49. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_json/_header.py +0 -0
  50. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_json/_losses.py +0 -0
  51. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_json/_periods.py +0 -0
  52. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_json/_resolve.py +0 -0
  53. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_json/_structure_dto.py +0 -0
  54. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_json/_structure_ingest.py +0 -0
  55. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_json/data.py +0 -0
  56. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_json/data_v1.py +0 -0
  57. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_json/data_v2.py +0 -0
  58. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_json/metadata.py +0 -0
  59. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_json/reader.py +0 -0
  60. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_json/structure_values.py +0 -0
  61. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_json/writer.py +0 -0
  62. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_json_1_0/__init__.py +0 -0
  63. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_json_1_0/writer.py +0 -0
  64. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_ml/__init__.py +0 -0
  65. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_ml/_allowed_children.py +0 -0
  66. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_ml/_closed_world.py +0 -0
  67. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_ml/_common.py +0 -0
  68. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_ml/_header.py +0 -0
  69. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_ml/_losses.py +0 -0
  70. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_ml/_v3_reader.py +0 -0
  71. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_ml/_v3_writer.py +0 -0
  72. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_ml21/__init__.py +0 -0
  73. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_ml21/_providers.py +0 -0
  74. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_ml21/_synthetic.py +0 -0
  75. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_ml21/namespaces.py +0 -0
  76. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_ml21/reader.py +0 -0
  77. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_ml21/writer.py +0 -0
  78. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_ml30/__init__.py +0 -0
  79. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_ml30/metadata.py +0 -0
  80. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_ml30/namespaces.py +0 -0
  81. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_ml30/reader.py +0 -0
  82. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_ml30/writer.py +0 -0
  83. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_ml31/__init__.py +0 -0
  84. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_ml31/namespaces.py +0 -0
  85. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_ml31/reader.py +0 -0
  86. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/formats/sdmx_ml31/writer.py +0 -0
  87. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/local/__init__.py +0 -0
  88. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/local/_scan.py +0 -0
  89. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/local/sql.py +0 -0
  90. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/__init__.py +0 -0
  91. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/_binding.py +0 -0
  92. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/_container.py +0 -0
  93. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/_invariants.py +0 -0
  94. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/_items.py +0 -0
  95. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/_label_match.py +0 -0
  96. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/_rebind.py +0 -0
  97. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/_referenceable.py +0 -0
  98. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/_refshape.py +0 -0
  99. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/_resolvers.py +0 -0
  100. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/_rules.py +0 -0
  101. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/_tree.py +0 -0
  102. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/annotations.py +0 -0
  103. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/base.py +0 -0
  104. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/binding.py +0 -0
  105. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/category.py +0 -0
  106. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/codelist.py +0 -0
  107. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/collections.py +0 -0
  108. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/concept.py +0 -0
  109. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/constraint.py +0 -0
  110. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/convert.py +0 -0
  111. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/dataflow.py +0 -0
  112. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/datastructure.py +0 -0
  113. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/errors.py +0 -0
  114. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/expr.py +0 -0
  115. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/header.py +0 -0
  116. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/hierarchy.py +0 -0
  117. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/in_memory_registry.py +0 -0
  118. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/istring.py +0 -0
  119. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/link.py +0 -0
  120. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/mapping.py +0 -0
  121. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/message.py +0 -0
  122. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/metadata_provision.py +0 -0
  123. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/metadataflow.py +0 -0
  124. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/metadataset.py +0 -0
  125. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/metadatastructure.py +0 -0
  126. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/organisation.py +0 -0
  127. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/provision.py +0 -0
  128. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/ref.py +0 -0
  129. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/registry.py +0 -0
  130. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/representation.py +0 -0
  131. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/rest_api.py +0 -0
  132. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/rollup.py +0 -0
  133. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/urn.py +0 -0
  134. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/valuelist.py +0 -0
  135. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/version.py +0 -0
  136. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/model/version_rewrite.py +0 -0
  137. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/polars.py +0 -0
  138. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/py.typed +0 -0
  139. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/query/__init__.py +0 -0
  140. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/query/_closure.py +0 -0
  141. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/query/_common.py +0 -0
  142. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/query/_compile.py +0 -0
  143. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/query/_edges.py +0 -0
  144. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/query/_execute.py +0 -0
  145. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/query/_expr.py +0 -0
  146. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/query/_joins.py +0 -0
  147. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/query/_plan.py +0 -0
  148. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/query/_pushdown.py +0 -0
  149. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/query/_rebase.py +0 -0
  150. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/query/_rest.py +0 -0
  151. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/query/accessors.py +0 -0
  152. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/query/observations.py +0 -0
  153. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/query/query.py +0 -0
  154. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/query/raw.py +0 -0
  155. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/query/schema.py +0 -0
  156. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/rest.py +0 -0
  157. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/session.py +0 -0
  158. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/sql.py +0 -0
  159. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/storage/__init__.py +0 -0
  160. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/storage/_checked.py +0 -0
  161. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/storage/_kinds.py +0 -0
  162. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/storage/_parsed.py +0 -0
  163. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/storage/_projections.py +0 -0
  164. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/storage/lazy.py +0 -0
  165. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/storage/readers.py +0 -0
  166. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/storage/resolve.py +0 -0
  167. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/storage/schema.py +0 -0
  168. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/storage/writers.py +0 -0
  169. {sdmxlib-0.71.0 → sdmxlib-0.72.0}/src/sdmxlib/versions.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: sdmxlib
3
- Version: 0.71.0
3
+ Version: 0.72.0
4
4
  Summary: SDMX structural metadata library for Python
5
5
  Keywords: sdmx,statistics,metadata,datastructure
6
6
  Author: gabrielgellner
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "sdmxlib"
3
- version = "0.71.0"
3
+ version = "0.72.0"
4
4
  description = "SDMX structural metadata library for Python"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.14"
@@ -97,8 +97,15 @@ mutate_only_covered_lines = false
97
97
  process_isolation = "forkserver"
98
98
  forkserver_warmup = "none"
99
99
 
100
+ [tool.uv.workspace]
101
+ members = ["cli"]
102
+
103
+ [tool.uv.sources.sdmxlib-cli]
104
+ workspace = true
105
+
100
106
  [dependency-groups]
101
107
  dev = [
108
+ "sdmxlib-cli",
102
109
  "catppuccin[pygments]>=2.5.0",
103
110
  "types-lxml>=2025.3.30",
104
111
  "types-jsonschema>=4.21.0",
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "sdmxlib"
3
- version = "0.71.0"
3
+ version = "0.72.0"
4
4
  description = "SDMX structural metadata library for Python"
5
5
  readme = "README.md"
6
6
  license = { text = "Apache-2.0" }
@@ -103,6 +103,9 @@ exclude_lines = [
103
103
 
104
104
  [dependency-groups]
105
105
  dev = [
106
+ # The CLI, a workspace member released with sdmxlib (GH-67): installed here so
107
+ # its tests run in `just ci` with everything else.
108
+ "sdmxlib-cli",
106
109
  # Checker versions carry UPPER bounds. uv.lock is gitignored (published
107
110
  # library), so CI resolves the dev group fresh on every pipeline — an
108
111
  # unbounded floor means a checker release lands in CI unannounced. With
@@ -225,3 +228,11 @@ process_isolation = "forkserver"
225
228
  # never mutated. Its mutants are booked as survivors: 282 for `_v3_writer.py`,
226
229
  # where a fresh process kills `__init__`'s outright (#458).
227
230
  forkserver_warmup = "none"
231
+
232
+ [tool.uv.workspace]
233
+ # `cli/` is `sdmxlib-cli`, the command line, a separate distribution so the
234
+ # library never depends on typer (GH-67).
235
+ members = ["cli"]
236
+
237
+ [tool.uv.sources]
238
+ sdmxlib-cli = { workspace = true }
@@ -49,6 +49,7 @@ from sdmxlib.rest import ComponentFilter, parse_components, widen_key
49
49
  from sdmxlib.query._common import Descending
50
50
  from sdmxlib.model.convert import from_dict, to_dict
51
51
  from sdmxlib.model.errors import ImRuleWarning, ReadAssumption, ReadGap, SdmxWarning
52
+ from sdmxlib.storage._manifest import ManifestError
52
53
  from sdmxlib.storage.schema import StoreSchemaError
53
54
  from sdmxlib.model.validation import (
54
55
  LossyReadError,
@@ -326,6 +327,7 @@ __all__ = [
326
327
  "LossyReadError",
327
328
  "Maintainable",
328
329
  "MaintainableArtefact",
330
+ "ManifestError",
329
331
  "Measure",
330
332
  "MeasureDimension",
331
333
  "MemberValue",
@@ -0,0 +1,99 @@
1
+ """A bundle as a published artefact: its manifest, and what identifies it (GH-56).
2
+
3
+ `LocalRegistry.bundle` opens the layout — ``meta.duckdb``, ``lake.ducklake``,
4
+ ``parquet/`` — and this names what a given bundle is. `write_manifest`
5
+ publishes one: a file inventory with a sha256 per file, observation counts per
6
+ binding, and a fresh ``token``, the value a cache or an ETag keys on.
7
+ `read_manifest` reads it back, refusing a format it cannot read, and
8
+ `check_bundle` checks a bundle against it and against itself, and
9
+ `fetch_bundle` lands one dataflow from an SDMX REST source as a published
10
+ bundle, its provenance recorded. `apply_overlays` changes display annotations
11
+ without a rebuild, `effective_token` is what a cache keys on when it does, and
12
+ `fold_overlays` writes overlays into a bundle for good. The manifest's
13
+ JSON Schema ships beside it, for producers outside Python: `manifest_schema`.
14
+
15
+ From a shell, ``sdmxlib bundle check PATH`` and ``sdmxlib bundle fetch`` run
16
+ these: they are the
17
+ ``sdmxlib-cli`` package (``uv tool install sdmxlib-cli``), released with this one,
18
+ so the library itself never depends on typer.
19
+
20
+ Example:
21
+ from sdmxlib.bundle import Producer, write_manifest
22
+
23
+ manifest = write_manifest("out/cenprof", bundle_id="cenprof-2021",
24
+ producer=Producer(name="my-builder", version="1.2"))
25
+ with sl.LocalRegistry.bundle("out/cenprof", require_manifest=True) as reg:
26
+ reg.manifest.token
27
+ """
28
+
29
+ from importlib import resources
30
+
31
+ from sdmxlib.bundle._check import Check, Finding, Report, check_bundle
32
+ from sdmxlib.bundle._fetch import fetch_bundle
33
+ from sdmxlib.bundle._overlay import (
34
+ OVERLAY_FORMAT,
35
+ Merge,
36
+ Overlay,
37
+ OverlayAnnotation,
38
+ OverlayEntry,
39
+ OverlayError,
40
+ apply_overlays,
41
+ effective_token,
42
+ fold_overlays,
43
+ overlay_digest,
44
+ read_overlay,
45
+ )
46
+ from sdmxlib.bundle._write import inventory, write_manifest
47
+ from sdmxlib.storage._manifest import (
48
+ FORMAT_VERSION,
49
+ MANIFEST_NAME,
50
+ BindingCount,
51
+ BundleFile,
52
+ Manifest,
53
+ ManifestError,
54
+ Producer,
55
+ Provenance,
56
+ read_manifest,
57
+ )
58
+
59
+ __all__ = [
60
+ "FORMAT_VERSION",
61
+ "MANIFEST_NAME",
62
+ "OVERLAY_FORMAT",
63
+ "BindingCount",
64
+ "BundleFile",
65
+ "Check",
66
+ "Finding",
67
+ "Manifest",
68
+ "ManifestError",
69
+ "Merge",
70
+ "Overlay",
71
+ "OverlayAnnotation",
72
+ "OverlayEntry",
73
+ "OverlayError",
74
+ "Producer",
75
+ "Provenance",
76
+ "Report",
77
+ "apply_overlays",
78
+ "check_bundle",
79
+ "effective_token",
80
+ "fetch_bundle",
81
+ "fold_overlays",
82
+ "inventory",
83
+ "manifest_schema",
84
+ "overlay_digest",
85
+ "overlay_schema",
86
+ "read_manifest",
87
+ "read_overlay",
88
+ "write_manifest",
89
+ ]
90
+
91
+
92
+ def overlay_schema() -> bytes:
93
+ """The JSON Schema for an overlay document, as shipped (`overlay.schema.json`)."""
94
+ return resources.files(__package__).joinpath("overlay.schema.json").read_bytes()
95
+
96
+
97
+ def manifest_schema() -> bytes:
98
+ """The JSON Schema for ``bundle.manifest.json``, as shipped (`manifest.schema.json`)."""
99
+ return resources.files(__package__).joinpath("manifest.schema.json").read_bytes()
@@ -0,0 +1,217 @@
1
+ """Checking a published bundle against its manifest and against itself (GH-67).
2
+
3
+ Run once, by whoever builds or receives a bundle — never on the path that
4
+ opens one to serve it, which reads only the manifest. Each check names what it
5
+ found rather than stopping at the first, so one run lists everything wrong.
6
+ """
7
+
8
+ from collections.abc import Callable, Iterable, Mapping
9
+ from pathlib import Path
10
+
11
+ import duckdb
12
+ from attrs import frozen
13
+
14
+ from sdmxlib.bundle._write import sha256_of
15
+ from sdmxlib.local.registry import LocalRegistry
16
+ from sdmxlib.model.base import MaintainableArtefact
17
+ from sdmxlib.model.binding import DataflowBinding
18
+ from sdmxlib.model.metadataset import MetadataSet
19
+ from sdmxlib.model.validation import reference_issues
20
+ from sdmxlib.storage._manifest import MANIFEST_NAME, Manifest, ManifestError, read_manifest
21
+ from sdmxlib.storage.schema import StoreSchemaError
22
+
23
+ #: The ATTACH alias `LocalRegistry.bundle` gives the bundle's DuckLake catalog.
24
+ _LAKE = "lake"
25
+
26
+
27
+ @frozen
28
+ class Finding:
29
+ """One thing a check found wrong.
30
+
31
+ Attributes:
32
+ check: Which check: ``manifest``, ``files``, ``lake``, ``bindings``,
33
+ ``references``, or an extension's name.
34
+ subject: What it is about: a path from the bundle root, a URN, or the
35
+ artefact a reference sits in.
36
+ detail: What is wrong with it.
37
+ """
38
+
39
+ check: str
40
+ subject: str
41
+ detail: str
42
+
43
+ def __str__(self) -> str:
44
+ """``[check] subject: detail``."""
45
+ return f"[{self.check}] {self.subject}: {self.detail}"
46
+
47
+
48
+ @frozen
49
+ class Report:
50
+ """What `check_bundle` checked, and what it found.
51
+
52
+ Attributes:
53
+ path: The bundle checked.
54
+ checked: The checks that ran, in order — a skipped or unreachable one
55
+ is absent, so a clean report says how much it covered.
56
+ findings: Everything found wrong, by check.
57
+ """
58
+
59
+ path: Path
60
+ checked: tuple[str, ...]
61
+ findings: tuple[Finding, ...]
62
+
63
+ @property
64
+ def ok(self) -> bool:
65
+ """Whether nothing was found wrong."""
66
+ return not self.findings
67
+
68
+
69
+ #: An extension's check: given the bundle root, its manifest and an open
70
+ #: registry over it, what is wrong with the extension's part of it.
71
+ type Check = Callable[[Path, Manifest, LocalRegistry], Iterable[Finding]]
72
+
73
+
74
+ def check_bundle(path: str | Path, *, references: bool = True, extensions: Mapping[str, Check] | None = None) -> Report:
75
+ """Check a published bundle: its manifest, files, lake, bindings and references.
76
+
77
+ - **manifest** — it parses, in a format this build reads.
78
+ - **files** — every file the manifest lists is present with its size and
79
+ sha256, and nothing else is in the directory.
80
+ - **lake** — every file DuckLake references exists at the size it recorded,
81
+ and DuckLake reports no orphan in its directories.
82
+ - **bindings** — the store's dataflow bindings are the manifest's, and each
83
+ holds the observations the manifest counts.
84
+ - **references** — every reference in the store resolves within it: the
85
+ structural closure is complete. Loads every artefact, so it is the costly
86
+ one (about 30 s and 5 GB on a 2.6 GB census bundle); ``references=False``
87
+ skips it.
88
+
89
+ A manifest that cannot be read, or a store on another schema version, ends
90
+ the run there: nothing after it can be checked against either.
91
+
92
+ Args:
93
+ path: The bundle directory.
94
+ references: Whether to check the structural closure.
95
+ extensions: More checks, by name, for parts of the bundle other
96
+ packages own (statcatlib's search index, say).
97
+
98
+ Returns:
99
+ What was checked and what was found.
100
+ """
101
+ root = Path(path)
102
+ checked: list[str] = ["manifest"]
103
+ try:
104
+ manifest = read_manifest(root)
105
+ except ManifestError as exc:
106
+ return Report(root, tuple(checked), (Finding("manifest", MANIFEST_NAME, str(exc)),))
107
+ findings = list(_files(root, manifest))
108
+ checked.append("files")
109
+ try:
110
+ reg = LocalRegistry.bundle(root)
111
+ except (StoreSchemaError, ManifestError) as exc:
112
+ return Report(root, tuple(checked), (*findings, Finding("manifest", "meta.duckdb", str(exc))))
113
+ with reg:
114
+ if (root / "lake.ducklake").exists():
115
+ findings += _lake(root, reg)
116
+ checked.append("lake")
117
+ findings += _bindings(manifest, reg)
118
+ checked.append("bindings")
119
+ if references:
120
+ findings += _references(reg)
121
+ checked.append("references")
122
+ for name, check in (extensions or {}).items():
123
+ findings += check(root, manifest, reg)
124
+ checked.append(name)
125
+ return Report(root, tuple(checked), tuple(findings))
126
+
127
+
128
+ def _files(root: Path, manifest: Manifest) -> Iterable[Finding]:
129
+ on_disk = {
130
+ p.relative_to(root).as_posix(): p
131
+ for p in sorted(root.rglob("*"))
132
+ if p.is_file() and p.name not in {MANIFEST_NAME, f"{MANIFEST_NAME}.tmp"}
133
+ }
134
+ for entry in manifest.files:
135
+ found = on_disk.pop(entry.path, None)
136
+ if found is None:
137
+ yield Finding("files", entry.path, "listed in the manifest but missing")
138
+ elif (size := found.stat().st_size) != entry.size:
139
+ yield Finding("files", entry.path, f"{size} bytes, the manifest says {entry.size}")
140
+ elif sha256_of(found) != entry.sha256:
141
+ yield Finding("files", entry.path, "contents differ from the manifest's sha256")
142
+ for extra in on_disk:
143
+ yield Finding("files", extra, "in the bundle but not in the manifest")
144
+
145
+
146
+ def _lake(root: Path, reg: LocalRegistry) -> list[Finding]:
147
+ """What DuckLake records against what is on disk, asked through its own functions."""
148
+ reg._data_plane() # ATTACHes the lake
149
+ conn = reg.connection
150
+ findings: list[Finding] = []
151
+ tables = conn.execute(
152
+ "SELECT schema_name, table_name FROM duckdb_tables() WHERE database_name = ? ORDER BY ALL", [_LAKE]
153
+ ).fetchall()
154
+ for schema, table in tables:
155
+ listed = conn.execute(
156
+ "SELECT data_file, data_file_size_bytes, delete_file, delete_file_size_bytes "
157
+ "FROM ducklake_list_files(?, ?, schema => ?)",
158
+ [_LAKE, table, schema],
159
+ ).fetchall()
160
+ for data_file, data_size, delete_file, delete_size in listed:
161
+ for file, size in ((data_file, data_size), (delete_file, delete_size)):
162
+ if file is not None:
163
+ findings += _lake_file(root, Path(file), size)
164
+ orphans = conn.execute(
165
+ "SELECT path FROM ducklake_delete_orphaned_files(?, dry_run => true, cleanup_all => true)", [_LAKE]
166
+ ).fetchall()
167
+ findings += [
168
+ Finding("lake", _relative(root, Path(path)), "not referenced by the DuckLake catalog") for (path,) in orphans
169
+ ]
170
+ return findings
171
+
172
+
173
+ def _lake_file(root: Path, file: Path, size: int) -> list[Finding]:
174
+ if not file.is_file():
175
+ return [Finding("lake", _relative(root, file), "referenced by the DuckLake catalog but missing")]
176
+ if (actual := file.stat().st_size) != size:
177
+ return [Finding("lake", _relative(root, file), f"{actual} bytes, DuckLake recorded {size}")]
178
+ return []
179
+
180
+
181
+ def _relative(root: Path, file: Path) -> str:
182
+ try:
183
+ return file.resolve().relative_to(root.resolve()).as_posix()
184
+ except ValueError:
185
+ return str(file)
186
+
187
+
188
+ def _bindings(manifest: Manifest, reg: LocalRegistry) -> list[Finding]:
189
+ stored = {str(b.dataflow.urn): b for b in reg.get_all(DataflowBinding)}
190
+ declared = {b.dataflow: b.observations for b in manifest.bindings}
191
+ findings = [
192
+ Finding("bindings", urn, "bound in the store but not in the manifest")
193
+ for urn in sorted(stored.keys() - declared.keys())
194
+ ]
195
+ findings += [
196
+ Finding("bindings", urn, "in the manifest but not bound in the store")
197
+ for urn in sorted(declared.keys() - stored.keys())
198
+ ]
199
+ for urn in sorted(stored.keys() & declared.keys()):
200
+ try:
201
+ count = reg.obs(stored[urn].dataflow).count()
202
+ except (duckdb.Error, ValueError) as exc:
203
+ findings.append(Finding("bindings", urn, f"its observations cannot be read: {exc}"))
204
+ continue
205
+ if count != declared[urn]:
206
+ findings.append(Finding("bindings", urn, f"{count} observations, the manifest says {declared[urn]}"))
207
+ return findings
208
+
209
+
210
+ def _references(reg: LocalRegistry) -> list[Finding]:
211
+ loaded = [a for a in reg.to_registry()._store.values() if isinstance(a, MaintainableArtefact)]
212
+ structural = [a for a in loaded if not isinstance(a, MetadataSet)]
213
+ metadata = [a for a in loaded if isinstance(a, MetadataSet)]
214
+ return [
215
+ Finding("references", issue.source, f"refers to {issue.target_urn}, which is not in the bundle")
216
+ for issue in reference_issues(structural, also=metadata)
217
+ ]
@@ -0,0 +1,161 @@
1
+ """Landing one dataflow from an SDMX REST source as a published bundle (GH-68).
2
+
3
+ A thin composition of what already exists: a `RestRegistry` writing through to
4
+ a fresh bundle's store fetches the dataflow's structural closure; its
5
+ observation query fetches the rows, the key and periods pushed into the
6
+ request; the bundle's lake takes them in batches; a `DataflowBinding` names
7
+ the table; and `write_manifest` publishes the result, provenance included.
8
+
9
+ **Flow-scoped by design.** One dataflow, optionally narrowed, never a whole
10
+ registry: public endpoints rate-limit, and mirroring is a different tool.
11
+ Bundles are built locally; redistributing one is the user's responsibility
12
+ under the provider's terms.
13
+ """
14
+
15
+ from datetime import UTC, datetime
16
+ from importlib import metadata
17
+ from pathlib import Path
18
+ from typing import Unpack
19
+
20
+ from sdmxlib.api.client import HttpxOptions
21
+ from sdmxlib.api.providers import ProviderInfo
22
+ from sdmxlib.api.registry import RestRegistry
23
+ from sdmxlib.bundle._write import write_manifest
24
+ from sdmxlib.local.registry import LocalRegistry
25
+ from sdmxlib.model.binding import DataflowBinding
26
+ from sdmxlib.model.dataflow import Dataflow
27
+ from sdmxlib.model.datastructure import DataStructure
28
+ from sdmxlib.model.ref import Ref
29
+ from sdmxlib.model.rest_api import ApiVersion
30
+ from sdmxlib.model.urn import SdmxUrn
31
+ from sdmxlib.query.observations import ObsQuery
32
+ from sdmxlib.storage._manifest import Manifest, Producer, Provenance
33
+
34
+ #: The lake schema a fetched dataflow's observations are written to.
35
+ _SCHEMA = "obs"
36
+
37
+
38
+ def fetch_bundle(
39
+ source: ProviderInfo | str,
40
+ flow: SdmxUrn[Dataflow],
41
+ path: str | Path,
42
+ *,
43
+ key: str | None = None,
44
+ start: str | None = None,
45
+ end: str | None = None,
46
+ structures_only: bool = False,
47
+ api: str = "2.1",
48
+ source_id: str | None = None,
49
+ **options: Unpack[HttpxOptions],
50
+ ) -> Manifest:
51
+ """Fetch one dataflow, narrowed by an SDMX key and periods, into a new published bundle.
52
+
53
+ The bundle is `path`, which must not exist or be empty: ``meta.duckdb``
54
+ holds the dataflow's structural closure and its `DataflowBinding`,
55
+ ``lake.ducklake`` and ``parquet/`` its observations, and the manifest is
56
+ written last, with `Provenance` naming the source, the request and every
57
+ artefact fetched. It then passes `check_bundle`.
58
+
59
+ Args:
60
+ source: A `Provider` entry, or a REST endpoint URL (then give ``api``
61
+ and ``source_id``).
62
+ flow: The dataflow. An unpinned version is fetched at the version it
63
+ resolves to, which the manifest records.
64
+ path: The bundle directory to create.
65
+ key: The SDMX-REST data key, one segment per key dimension in the
66
+ DSD's order, ``+`` between codes and empty for any:
67
+ ``M.USD+GBP.EUR.SP00.A``. None fetches every series.
68
+ start: Inclusive ``startPeriod``.
69
+ end: Inclusive ``endPeriod``.
70
+ structures_only: Fetch the structural closure and no observations.
71
+ api: The REST API version of a URL ``source``.
72
+ source_id: The registry id of a URL ``source``, recorded as provenance.
73
+ **options: Passed to the `RestRegistry` (timeouts, a transport).
74
+
75
+ Returns:
76
+ The manifest written.
77
+
78
+ Raises:
79
+ FileExistsError: If `path` exists and is not empty.
80
+ ValueError: If `key` has the wrong number of segments for the DSD,
81
+ naming its key dimensions in order.
82
+ """
83
+ root = Path(path)
84
+ if root.exists() and any(root.iterdir()):
85
+ msg = f"{root} exists and is not empty; fetch_bundle creates a new bundle"
86
+ raise FileExistsError(msg)
87
+ root.mkdir(parents=True, exist_ok=True)
88
+ endpoint, api = (source.url, source.api) if isinstance(source, ProviderInfo) else (source, api)
89
+ retrieved_at = datetime.now(UTC)
90
+ with (
91
+ LocalRegistry.bundle(root) as bundle,
92
+ RestRegistry(source, store=bundle, api=api, id=source_id, **options) as remote,
93
+ ):
94
+ resolved = remote.get(flow, resolve=True)
95
+ if not isinstance(resolved, Dataflow):
96
+ msg = f"{flow} is not a dataflow at {remote}"
97
+ raise TypeError(msg)
98
+ dsd = bundle.dsd(resolved.urn)
99
+ if dsd is None:
100
+ msg = f"{resolved.urn} has no data structure at {remote}, so its observations have no key order"
101
+ raise ValueError(msg)
102
+ if not structures_only:
103
+ # The client's own API generation: what `obs()` builds the request
104
+ # for, so the key is checked against the same slots it fills.
105
+ query = _narrowed(remote.obs(resolved.urn), dsd, remote._client.api, key=key, start=start, end=end)
106
+ table = _table_for(resolved.urn)
107
+ bundle._data_plane().write_observations(schema=_SCHEMA, table=table, source=query.stream())
108
+ bundle.add(
109
+ DataflowBinding.from_dsd(
110
+ dsd, dataflow=Ref[Dataflow].unresolved(resolved.urn), schema=_SCHEMA, table=table
111
+ )
112
+ )
113
+ fetched = bundle.connection.execute(
114
+ "SELECT urn FROM sdmx.artefact WHERE artefact_type <> 'DataflowBinding' ORDER BY urn"
115
+ ).fetchall()
116
+ provenance = Provenance(
117
+ source=remote.id or "",
118
+ endpoint=endpoint,
119
+ api=api,
120
+ retrieved_at=retrieved_at,
121
+ dataflow=str(resolved.urn),
122
+ key=key,
123
+ start=start,
124
+ end=end,
125
+ structures_only=structures_only,
126
+ artefacts=tuple(urn for (urn,) in fetched),
127
+ )
128
+ return write_manifest(
129
+ root,
130
+ bundle_id=str(resolved.urn),
131
+ producer=Producer(name="sdmxlib.bundle.fetch_bundle", version=metadata.version("sdmxlib")),
132
+ provenance=provenance,
133
+ )
134
+
135
+
136
+ def _narrowed(
137
+ query: ObsQuery, dsd: DataStructure, api: ApiVersion, *, key: str | None, start: str | None, end: str | None
138
+ ) -> ObsQuery:
139
+ """`query` filtered by an SDMX key and periods, in the form the REST request carries."""
140
+ if key is not None:
141
+ slots = dsd.key_slot_ids(api)
142
+ segments = key.split(".")
143
+ if len(segments) != len(slots):
144
+ msg = f"key {key!r} has {len(segments)} segments; {dsd.urn}'s key is {len(slots)}: {'.'.join(slots)}"
145
+ raise ValueError(msg)
146
+ for slot, segment in zip(slots, segments, strict=True):
147
+ if segment:
148
+ query = query.filter(query.col(slot).is_in(segment.split("+")))
149
+ if (start is not None or end is not None) and dsd.time_dimension is not None:
150
+ time = query.col(dsd.time_dimension.id)
151
+ if start is not None:
152
+ query = query.filter(time >= start)
153
+ if end is not None:
154
+ query = query.filter(time <= end)
155
+ return query
156
+
157
+
158
+ def _table_for(urn: SdmxUrn[Dataflow]) -> str:
159
+ """The lake table a dataflow's observations go in: its URN's parts, as an identifier."""
160
+ parts = f"{urn.agency}_{urn.id}_{urn.version}"
161
+ return "".join(c if c.isalnum() else "_" for c in parts).lower()