sdmxlib 0.74.0__tar.gz → 0.75.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 (183) hide show
  1. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/PKG-INFO +3 -2
  2. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/pyproject.toml +5 -3
  3. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/pyproject.toml.orig +15 -9
  4. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/__init__.py +4 -0
  5. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/api/client.py +33 -33
  6. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/api/federated.py +2 -2
  7. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/api/policy.py +1 -1
  8. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/api/registry.py +1 -1
  9. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/bundle/__init__.py +9 -6
  10. sdmxlib-0.75.0/src/sdmxlib/bundle/_availability.py +116 -0
  11. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/bundle/_check.py +207 -33
  12. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/bundle/_copy.py +49 -2
  13. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/bundle/_fetch.py +1 -1
  14. sdmxlib-0.75.0/src/sdmxlib/bundle/_remote.py +130 -0
  15. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/bundle/_write.py +96 -28
  16. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/bundle/manifest.schema.json +7 -8
  17. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/local/_scan.py +5 -4
  18. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/local/data_store.py +47 -38
  19. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/local/engine.py +39 -8
  20. sdmxlib-0.75.0/src/sdmxlib/local/object_store.py +244 -0
  21. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/local/registry.py +151 -10
  22. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/validation.py +12 -6
  23. sdmxlib-0.75.0/src/sdmxlib/storage/_columns.py +23 -0
  24. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/storage/_manifest.py +29 -8
  25. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/storage/readers.py +23 -0
  26. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/storage/schema.py +29 -1
  27. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/storage/writers.py +29 -1
  28. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/testing.py +1 -1
  29. sdmxlib-0.74.0/src/sdmxlib/bundle/_remote.py +0 -85
  30. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/LICENSE +0 -0
  31. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/README.md +0 -0
  32. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/_duckdb.py +0 -0
  33. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/_singleflight.py +0 -0
  34. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/_time.py +0 -0
  35. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/api/__init__.py +0 -0
  36. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/api/_freshness.py +0 -0
  37. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/api/providers.py +0 -0
  38. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/api/session.py +0 -0
  39. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/builders/__init__.py +0 -0
  40. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/builders/contentconstraint.py +0 -0
  41. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/builders/metadata_annotation.py +0 -0
  42. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/bundle/_canonical.py +0 -0
  43. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/bundle/_finding.py +0 -0
  44. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/bundle/_fingerprint.py +0 -0
  45. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/bundle/_overlay.py +0 -0
  46. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/bundle/overlay.schema.json +0 -0
  47. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/data_store.py +0 -0
  48. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/__init__.py +0 -0
  49. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/_arrow.py +0 -0
  50. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/_attachment.py +0 -0
  51. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/_coerce.py +0 -0
  52. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/_index.py +0 -0
  53. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/_positions.py +0 -0
  54. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/_refuse.py +0 -0
  55. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/data_format.py +0 -0
  56. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/gaps.py +0 -0
  57. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/render.py +0 -0
  58. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_csv/__init__.py +0 -0
  59. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_csv/reader.py +0 -0
  60. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_csv/writer.py +0 -0
  61. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_json/__init__.py +0 -0
  62. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_json/_data_common.py +0 -0
  63. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_json/_dto.py +0 -0
  64. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_json/_header.py +0 -0
  65. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_json/_losses.py +0 -0
  66. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_json/_periods.py +0 -0
  67. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_json/_resolve.py +0 -0
  68. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_json/_structure_dto.py +0 -0
  69. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_json/_structure_ingest.py +0 -0
  70. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_json/data.py +0 -0
  71. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_json/data_v1.py +0 -0
  72. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_json/data_v2.py +0 -0
  73. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_json/metadata.py +0 -0
  74. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_json/reader.py +0 -0
  75. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_json/structure_values.py +0 -0
  76. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_json/writer.py +0 -0
  77. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_json_1_0/__init__.py +0 -0
  78. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_json_1_0/writer.py +0 -0
  79. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_ml/__init__.py +0 -0
  80. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_ml/_allowed_children.py +0 -0
  81. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_ml/_closed_world.py +0 -0
  82. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_ml/_common.py +0 -0
  83. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_ml/_header.py +0 -0
  84. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_ml/_losses.py +0 -0
  85. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_ml/_v3_reader.py +0 -0
  86. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_ml/_v3_writer.py +0 -0
  87. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_ml21/__init__.py +0 -0
  88. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_ml21/_providers.py +0 -0
  89. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_ml21/_synthetic.py +0 -0
  90. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_ml21/namespaces.py +0 -0
  91. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_ml21/reader.py +0 -0
  92. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_ml21/writer.py +0 -0
  93. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_ml30/__init__.py +0 -0
  94. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_ml30/metadata.py +0 -0
  95. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_ml30/namespaces.py +0 -0
  96. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_ml30/reader.py +0 -0
  97. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_ml30/writer.py +0 -0
  98. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_ml31/__init__.py +0 -0
  99. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_ml31/namespaces.py +0 -0
  100. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_ml31/reader.py +0 -0
  101. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/formats/sdmx_ml31/writer.py +0 -0
  102. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/local/__init__.py +0 -0
  103. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/local/sql.py +0 -0
  104. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/__init__.py +0 -0
  105. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/_binding.py +0 -0
  106. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/_container.py +0 -0
  107. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/_invariants.py +0 -0
  108. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/_items.py +0 -0
  109. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/_label_match.py +0 -0
  110. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/_rebind.py +0 -0
  111. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/_referenceable.py +0 -0
  112. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/_refshape.py +0 -0
  113. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/_resolvers.py +0 -0
  114. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/_rules.py +0 -0
  115. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/_tree.py +0 -0
  116. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/annotations.py +0 -0
  117. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/base.py +0 -0
  118. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/binding.py +0 -0
  119. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/category.py +0 -0
  120. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/codelist.py +0 -0
  121. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/collections.py +0 -0
  122. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/concept.py +0 -0
  123. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/constraint.py +0 -0
  124. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/convert.py +0 -0
  125. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/dataflow.py +0 -0
  126. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/datastructure.py +0 -0
  127. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/errors.py +0 -0
  128. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/expr.py +0 -0
  129. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/header.py +0 -0
  130. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/hierarchy.py +0 -0
  131. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/in_memory_registry.py +0 -0
  132. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/istring.py +0 -0
  133. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/link.py +0 -0
  134. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/mapping.py +0 -0
  135. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/message.py +0 -0
  136. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/metadata_provision.py +0 -0
  137. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/metadataflow.py +0 -0
  138. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/metadataset.py +0 -0
  139. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/metadatastructure.py +0 -0
  140. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/organisation.py +0 -0
  141. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/provision.py +0 -0
  142. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/ref.py +0 -0
  143. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/registry.py +0 -0
  144. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/representation.py +0 -0
  145. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/rest_api.py +0 -0
  146. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/rollup.py +0 -0
  147. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/urn.py +0 -0
  148. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/valuelist.py +0 -0
  149. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/version.py +0 -0
  150. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/model/version_rewrite.py +0 -0
  151. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/polars.py +0 -0
  152. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/py.typed +0 -0
  153. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/query/__init__.py +0 -0
  154. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/query/_closure.py +0 -0
  155. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/query/_common.py +0 -0
  156. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/query/_compile.py +0 -0
  157. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/query/_edges.py +0 -0
  158. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/query/_execute.py +0 -0
  159. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/query/_expr.py +0 -0
  160. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/query/_joins.py +0 -0
  161. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/query/_plan.py +0 -0
  162. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/query/_pushdown.py +0 -0
  163. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/query/_rebase.py +0 -0
  164. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/query/_rest.py +0 -0
  165. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/query/accessors.py +0 -0
  166. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/query/observations.py +0 -0
  167. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/query/query.py +0 -0
  168. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/query/raw.py +0 -0
  169. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/query/schema.py +0 -0
  170. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/rest.py +0 -0
  171. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/session.py +0 -0
  172. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/sql.py +0 -0
  173. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/storage/__init__.py +0 -0
  174. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/storage/_checked.py +0 -0
  175. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/storage/_kinds.py +0 -0
  176. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/storage/_parsed.py +0 -0
  177. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/storage/_projections.py +0 -0
  178. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/storage/_references.py +0 -0
  179. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/storage/_synthetic.py +0 -0
  180. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/storage/_trim.py +0 -0
  181. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/storage/lazy.py +0 -0
  182. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/storage/resolve.py +0 -0
  183. {sdmxlib-0.74.0 → sdmxlib-0.75.0}/src/sdmxlib/versions.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sdmxlib
3
- Version: 0.74.0
3
+ Version: 0.75.0
4
4
  Summary: SDMX for Python: structures, reference metadata and observation data, from REST, files or a local DuckDB store.
5
5
  Keywords: sdmx,statistics,metadata,datastructure
6
6
  Author: gabrielgellner
@@ -15,7 +15,8 @@ Classifier: Programming Language :: Python :: 3.14
15
15
  Classifier: Topic :: Scientific/Engineering :: Information Analysis
16
16
  Requires-Dist: attrs>=26.1.0
17
17
  Requires-Dist: duckdb>=2.0.0
18
- Requires-Dist: httpx>=0.28.1
18
+ Requires-Dist: httpx2>=2.16.0
19
+ Requires-Dist: google-crc32c>=1.9.0
19
20
  Requires-Dist: lxml>=6.1.3
20
21
  Requires-Dist: msgspec>=0.22.0
21
22
  Requires-Dist: polars>=2.0.0
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "sdmxlib"
3
- version = "0.74.0"
3
+ version = "0.75.0"
4
4
  description = "SDMX for Python: structures, reference metadata and observation data, from REST, files or a local DuckDB store."
5
5
  readme = "README.md"
6
6
  license = "Apache-2.0"
@@ -23,7 +23,8 @@ classifiers = [
23
23
  dependencies = [
24
24
  "attrs>=26.1.0",
25
25
  "duckdb>=2.0.0",
26
- "httpx>=0.28.1",
26
+ "httpx2>=2.16.0",
27
+ "google-crc32c>=1.9.0",
27
28
  "lxml>=6.1.3",
28
29
  "msgspec>=0.22.0",
29
30
  "polars>=2.0.0",
@@ -57,6 +58,7 @@ markers = [
57
58
  "slow: tests that dominate suite wall-time; deselect for tight loops",
58
59
  "serial: thread-heavy tests `just test` runs alone, after the parallel phase; under -n they starve",
59
60
  "bench: performance benchmarks; excluded from default test runs",
61
+ "stores: object-store emulators in containers; skipped, and said so, without a container runtime",
60
62
  "bundle: benchmarks against a real SDMX bundle; need $SDMXLIB_BENCH_BUNDLE",
61
63
  "recompute: bundle-tier assertions that recompute what publishing computed; in `just bench-bundle`, not `just ci`",
62
64
  ]
@@ -121,6 +123,7 @@ dev = [
121
123
  "pytest-xdist>=3.8.0",
122
124
  "pytest-memray>=1.7.0",
123
125
  "pytest-recording>=0.13.4",
126
+ "vcrpy>=8.3.0",
124
127
  "pydoclint>=0.11.1,<0.12",
125
128
  "pyrefly>=1.4.0,<1.5",
126
129
  "ruff>=0.17.1,<0.18",
@@ -128,7 +131,6 @@ dev = [
128
131
  "hypothesis>=6.140,<7",
129
132
  "sqlglot>=27.0",
130
133
  "fastapi>=0.115",
131
- "httpx2>=2.12",
132
134
  ]
133
135
  bench-compete = [
134
136
  "sdmx1>=2.27.0",
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "sdmxlib"
3
- version = "0.74.0"
3
+ version = "0.75.0"
4
4
  description = "SDMX for Python: structures, reference metadata and observation data, from REST, files or a local DuckDB store."
5
5
  readme = "README.md"
6
6
  license = "Apache-2.0"
@@ -23,7 +23,14 @@ dependencies = [
23
23
  # unfinished result raises rather than clobbering it (`session.completed`).
24
24
  # The tests assert 2.0's profile JSON, error text and sort costs.
25
25
  "duckdb>=2.0.0",
26
- "httpx>=0.28.1",
26
+ # httpx2: Pydantic's maintained fork of httpx 0.28.1 (GH-141), which
27
+ # Starlette's TestClient and sdmxlib-rest also use, so the suite installs
28
+ # one HTTP stack. It verifies TLS against the system trust store.
29
+ "httpx2>=2.16.0",
30
+ # CRC32C, the digest S3 (full-object, any upload) and GCS (always) keep:
31
+ # the manifest records it so a store can verify a file without a
32
+ # download (GH-181). The standard library has only CRC-32.
33
+ "google-crc32c>=1.9.0",
27
34
  # >=6.1: `resolve_entities` defaults to 'internal' (CVE-2026-41066), so no
28
35
  # parse expands an external entity.
29
36
  "lxml>=6.1.3",
@@ -38,8 +45,8 @@ dependencies = [
38
45
  "pyarrow>=26.0.0",
39
46
  # PEP 728's `closed=True` TypedDict, which `typing` gains only in 3.15: a
40
47
  # TypedDict unpacked into a constructor (`**read_reference_attrs(el)`) must
41
- # be closed for a checker to know it holds no other key. httpx already
42
- # brings it in, through anyio; declared because we now import it.
48
+ # be closed for a checker to know it holds no other key. Declared because
49
+ # we import it.
43
50
  "typing-extensions>=4.16.0",
44
51
  ]
45
52
 
@@ -83,6 +90,7 @@ markers = [
83
90
  "slow: tests that dominate suite wall-time; deselect for tight loops",
84
91
  "serial: thread-heavy tests `just test` runs alone, after the parallel phase; under -n they starve",
85
92
  "bench: performance benchmarks; excluded from default test runs",
93
+ "stores: object-store emulators in containers; skipped, and said so, without a container runtime",
86
94
  # The bundle tier (#379) reads a real 2.6 GB SDMX bundle that is not, and
87
95
  # cannot be, in the repo. Split from `bench` so `just bench` means the same
88
96
  # thing on every machine and `bench/baselines/` stays comparable across them.
@@ -135,6 +143,9 @@ dev = [
135
143
  "pytest-xdist>=3.8.0",
136
144
  "pytest-memray>=1.7.0",
137
145
  "pytest-recording>=0.13.4",
146
+ # 8.3 patches httpx2's transports, so the integration tier's cassettes replay
147
+ # sdmxlib's requests; an older vcrpy lets them reach the network.
148
+ "vcrpy>=8.3.0",
138
149
  "pydoclint>=0.11.1,<0.12",
139
150
  "pyrefly>=1.4.0,<1.5",
140
151
  "ruff>=0.17.1,<0.18",
@@ -155,11 +166,6 @@ dev = [
155
166
  # an undefined `Request` and an undefined `parse_c_params`. Not a runtime
156
167
  # dependency and must not become one: sdmxlib has no web framework.
157
168
  "fastapi>=0.115",
158
- # Starlette's TestClient asks for this by name — on plain `httpx` it emits a
159
- # StarletteDeprecationWarning, which `filterwarnings = ["error"]` turns into
160
- # a failure. Taking the fix it names beats ignoring the warning it raises.
161
- # Test-only, like fastapi; sdmxlib's own client stays on httpx.
162
- "httpx2>=2.12",
163
169
  ]
164
170
  # Optional: third-party SDMX libraries for the competitive benchmarks
165
171
  # (tests/bench/test_compete.py, and `just bench-compete` — bench/compete/).
@@ -56,6 +56,7 @@ from sdmxlib.local import (
56
56
  SchemaInspector,
57
57
  )
58
58
  from sdmxlib.local.data_store import DuckDBDataStore, DuckLakeVersionError
59
+ from sdmxlib.local.object_store import StoreSecret
59
60
  from sdmxlib.local.sql import SidecarNotUniqueError
60
61
  from sdmxlib.rest import ComponentFilter, parse_components, widen_key
61
62
  from sdmxlib.query._common import Descending
@@ -72,6 +73,7 @@ from sdmxlib.model.validation import (
72
73
  SdmxParseError,
73
74
  ValidationError,
74
75
  ValidationIssue,
76
+ check_serialisable,
75
77
  validate,
76
78
  validate_references,
77
79
  )
@@ -414,6 +416,7 @@ __all__ = [
414
416
  "SqlRelation",
415
417
  "StoreFormatError",
416
418
  "StoreSchemaError",
419
+ "StoreSecret",
417
420
  "Str",
418
421
  "StructureMap",
419
422
  "StructureMessage",
@@ -436,6 +439,7 @@ __all__ = [
436
439
  "WinPred",
437
440
  "WriteSource",
438
441
  "artefact_urn",
442
+ "check_serialisable",
439
443
  "dropped",
440
444
  "from_dict",
441
445
  "item",
@@ -1,4 +1,4 @@
1
- """SdmxClient — thin httpx wrapper around the SDMX REST API."""
1
+ """SdmxClient — thin httpx2 wrapper around the SDMX REST API."""
2
2
 
3
3
  import ssl
4
4
  import threading
@@ -9,7 +9,7 @@ from http.cookiejar import CookieJar
9
9
  from pathlib import Path
10
10
  from typing import Self, Unpack
11
11
 
12
- import httpx
12
+ import httpx2
13
13
  from typing_extensions import TypedDict
14
14
 
15
15
  from sdmxlib.api._freshness import Freshness, read_freshness
@@ -19,27 +19,27 @@ from sdmxlib.formats.data_format import DataFormat
19
19
  from sdmxlib.model.message import StructureMessage
20
20
  from sdmxlib.model.rest_api import ApiVersion
21
21
 
22
- # Mirrors httpx's private `_types.PrimitiveData`. Spelled out rather than
23
- # imported because `httpx._types` is not public API.
22
+ # Mirrors httpx2's private `_types.PrimitiveData`. Spelled out rather than
23
+ # imported because `httpx2._types` is not public API.
24
24
  type _PrimitiveData = str | int | float | bool | None
25
25
 
26
26
 
27
27
  class _HttpxTransportFields(TypedDict, total=False):
28
28
  """`HttpxOptions` minus ``auth`` — see there for the full rationale.
29
29
 
30
- Split out because `GlobalRegistry` exposes its own richer ``auth``
30
+ Split out because `FmrRegistry` exposes its own richer ``auth``
31
31
  parameter (it also accepts a ``BearerToken``, which becomes a header
32
- rather than an httpx auth object). A caller-facing ``auth`` keyword and an
32
+ rather than an httpx2 auth object). A caller-facing ``auth`` keyword and an
33
33
  ``Unpack`` shape that also carries ``auth`` are a static conflict, so that
34
34
  constructor accepts this narrower set and supplies ``auth`` itself.
35
35
  """
36
36
 
37
- # `params` and `cookies` mirror httpx's `QueryParamTypes` / `CookieTypes`
37
+ # `params` and `cookies` mirror httpx2's `QueryParamTypes` / `CookieTypes`
38
38
  # in full. The tuple/list spellings are exact rather than widened to
39
- # `Sequence[...]`: httpx's own aliases name `list` and `tuple` concretely,
39
+ # `Sequence[...]`: httpx2's own aliases name `list` and `tuple` concretely,
40
40
  # and a `Sequence` here would not be assignable at the forwarding call.
41
41
  params: (
42
- httpx.QueryParams
42
+ httpx2.QueryParams
43
43
  | Mapping[str, _PrimitiveData | Sequence[_PrimitiveData]]
44
44
  | list[tuple[str, _PrimitiveData]]
45
45
  | tuple[tuple[str, _PrimitiveData], ...]
@@ -47,31 +47,31 @@ class _HttpxTransportFields(TypedDict, total=False):
47
47
  | bytes
48
48
  | None
49
49
  )
50
- cookies: httpx.Cookies | CookieJar | dict[str, str] | list[tuple[str, str]] | None
50
+ cookies: httpx2.Cookies | CookieJar | dict[str, str] | list[tuple[str, str]] | None
51
51
  verify: ssl.SSLContext | str | bool
52
52
  cert: str | tuple[str, str] | tuple[str, str, str] | None
53
53
  trust_env: bool
54
54
  http1: bool
55
55
  http2: bool
56
- proxy: httpx.Proxy | httpx.URL | str | None
57
- mounts: Mapping[str, httpx.BaseTransport | None] | None
56
+ proxy: httpx2.Proxy | httpx2.URL | str | None
57
+ mounts: Mapping[str, httpx2.BaseTransport | None] | None
58
58
  follow_redirects: bool
59
- limits: httpx.Limits
59
+ limits: httpx2.Limits
60
60
  max_redirects: int
61
- transport: httpx.BaseTransport | None
61
+ transport: httpx2.BaseTransport | None
62
62
  default_encoding: str | Callable[[bytes], str]
63
63
 
64
64
 
65
65
  class _HttpxAuthField(TypedDict, total=False):
66
66
  """Just ``auth``, so it can be unpacked alongside `HttpxTransportOptions`.
67
67
 
68
- `GlobalRegistry` supplies ``auth`` itself and forwards the rest untouched.
68
+ `FmrRegistry` supplies ``auth`` itself and forwards the rest untouched.
69
69
  Both halves have to be separate shapes for that to type-check: two ``**``
70
70
  unpackings in one call must have provably disjoint key sets, which they do
71
71
  not if either side is the combined `HttpxOptions`.
72
72
  """
73
73
 
74
- auth: httpx.Auth | tuple[str | bytes, str | bytes] | Callable[[httpx.Request], httpx.Request] | None
74
+ auth: httpx2.Auth | tuple[str | bytes, str | bytes] | Callable[[httpx2.Request], httpx2.Request] | None
75
75
 
76
76
 
77
77
  class HttpxTransportOptions(_HttpxTransportFields, total=False, closed=True):
@@ -87,28 +87,28 @@ class HttpxAuthOption(_HttpxAuthField, total=False, closed=True):
87
87
 
88
88
 
89
89
  class HttpxOptions(_HttpxTransportFields, _HttpxAuthField, total=False, closed=True):
90
- """The `httpx.Client` options sdmxlib forwards, as a PEP 692 kwargs shape.
90
+ """The `httpx2.Client` options sdmxlib forwards, as a PEP 692 kwargs shape.
91
91
 
92
- This is the *supported surface*, not a mirror of httpx: `headers`,
92
+ This is the *supported surface*, not a mirror of httpx2: `headers`,
93
93
  `timeout` and `base_url` are deliberately absent because `SdmxClient` owns
94
94
  them — passing one used to be a runtime ``TypeError`` from a duplicate
95
95
  keyword, and is now a type error at the call site.
96
96
 
97
- Every option that *is* here carries httpx's own type in full. Narrowing one
98
- below httpx would reject a call httpx would have accepted, and there is no
99
- SDMX-level reason to: none of these values is read by sdmxlib, and httpx
100
- normalises them at construction (``params`` becomes a `httpx.QueryParams`
97
+ Every option that *is* here carries httpx2's own type in full. Narrowing one
98
+ below httpx2 would reject a call httpx2 would have accepted, and there is no
99
+ SDMX-level reason to: none of these values is read by sdmxlib, and httpx2
100
+ normalises them at construction (``params`` becomes a `httpx2.QueryParams`
101
101
  before any request is built), so all accepted spellings behave identically.
102
102
  The only legitimate narrowing is dropping an option entirely, as above.
103
103
 
104
104
  Used as ``**httpx_kwargs: Unpack[HttpxOptions]`` so the pass-through stays
105
105
  fully checked end to end. The alternative shapes both cost something the
106
106
  library should not pay: ``**kwargs: object`` is *provably* wrong at the
107
- httpx boundary (every one of its parameters rejects `object`, which is why
107
+ httpx2 boundary (every one of its parameters rejects `object`, which is why
108
108
  a single blanket suppression was hiding 17 errors), and ``**kwargs: Any``
109
109
  is honest but silently accepts typos and wrong types at a public API.
110
110
 
111
- ``event_hooks`` is omitted on purpose: httpx types its hooks as
111
+ ``event_hooks`` is omitted on purpose: httpx2 types its hooks as
112
112
  ``Callable[..., Any]``, which would put `Any` back into this signature for
113
113
  a rarely-used option. Add it — with a narrower callable type — if a real
114
114
  caller needs it.
@@ -176,7 +176,7 @@ def _version_parts(version: str) -> tuple[int, ...]:
176
176
  return tuple(parts)
177
177
 
178
178
 
179
- def _check_content_type(response: httpx.Response, fmt: DataFormat, *, url: str) -> None:
179
+ def _check_content_type(response: httpx2.Response, fmt: DataFormat, *, url: str) -> None:
180
180
  """Refuse a response that is not the format that was asked for.
181
181
 
182
182
  Without this the format argument is decorative — which is precisely the
@@ -216,7 +216,7 @@ def _check_content_type(response: httpx.Response, fmt: DataFormat, *, url: str)
216
216
  raise ValueError(msg)
217
217
 
218
218
 
219
- def _require_csv(response: httpx.Response, *, accept: str, url: str) -> None:
219
+ def _require_csv(response: httpx2.Response, *, accept: str, url: str) -> None:
220
220
  """Refuse an observation fetch's response that is not CSV (GH-50).
221
221
 
222
222
  The data plane hands the body to DuckDB's CSV reader, which reads an
@@ -243,10 +243,10 @@ def _require_csv(response: httpx.Response, *, accept: str, url: str) -> None:
243
243
  raise ValueError(msg)
244
244
 
245
245
 
246
- def _raise_for_status(response: httpx.Response, *, url: str) -> None:
246
+ def _raise_for_status(response: httpx2.Response, *, url: str) -> None:
247
247
  """`raise_for_status`, with the two size refusals named.
248
248
 
249
- Everything else keeps httpx's own error — there is nothing this layer can
249
+ Everything else keeps httpx2's own error — there is nothing this layer can
250
250
  add to a 500 that the message does not already say.
251
251
  """
252
252
  reason = _TOO_LARGE.get(response.status_code)
@@ -280,7 +280,7 @@ NOT_MODIFIED = object()
280
280
 
281
281
 
282
282
  class SdmxClient:
283
- """Thin httpx wrapper that fetches SDMX REST resources and parses them.
283
+ """Thin httpx2 wrapper that fetches SDMX REST resources and parses them.
284
284
 
285
285
  Handles URL construction, Accept headers, and response parsing.
286
286
 
@@ -342,7 +342,7 @@ class SdmxClient:
342
342
  default_headers = {"Accept": "application/xml"}
343
343
  if headers:
344
344
  default_headers.update(headers)
345
- self._client = httpx.Client(
345
+ self._client = httpx2.Client(
346
346
  headers=default_headers,
347
347
  timeout=timeout,
348
348
  **httpx_kwargs,
@@ -510,12 +510,12 @@ class SdmxClient:
510
510
 
511
511
  with self._reaching(url):
512
512
  response = self._client.get(url, params=params, headers=validators or None)
513
- if response.status_code == httpx.codes.NOT_FOUND:
513
+ if response.status_code == httpx2.codes.NOT_FOUND:
514
514
  err = f"{resource} {agency}:{id}({version}) not found at {self._endpoint}"
515
515
  raise KeyError(err)
516
516
  if cache_key is not None:
517
517
  self._remember(cache_key, response.headers)
518
- if response.status_code == httpx.codes.NOT_MODIFIED:
518
+ if response.status_code == httpx2.codes.NOT_MODIFIED:
519
519
  # The provider confirmed the pointer has not moved. There is no
520
520
  # body to parse — that is the whole saving — so the caller reuses
521
521
  # what it resolved last time.
@@ -569,7 +569,7 @@ class SdmxClient:
569
569
  """
570
570
  try:
571
571
  yield
572
- except (httpx.TransportError, OSError) as exc:
572
+ except (httpx2.TransportError, OSError) as exc:
573
573
  raise RegistryUnavailable(self._endpoint, exc, tried=url) from exc
574
574
 
575
575
  def _data_url(
@@ -38,7 +38,7 @@ import inspect
38
38
  from collections.abc import Sequence
39
39
  from typing import overload
40
40
 
41
- import httpx
41
+ import httpx2
42
42
 
43
43
  from sdmxlib.api.policy import RegistryUnavailable
44
44
  from sdmxlib.model.binding import DataflowBinding, DriftError, DriftIssue, _validate_binding
@@ -203,7 +203,7 @@ class FederatedRegistry:
203
203
  # Already named by the source that raised it; re-wrapping would
204
204
  # bury the inner source's id behind this one's.
205
205
  raise
206
- except (httpx.HTTPError, OSError) as exc:
206
+ except (httpx2.HTTPError, OSError) as exc:
207
207
  raise RegistryUnavailable(getattr(source, "id", None), exc, tried=str(urn)) from exc
208
208
  # Applied here rather than forwarded: `_dispatch_kwargs` sends each
209
209
  # source only what it understands, and a local source takes neither
@@ -31,7 +31,7 @@ so, which cannot mislabel anything:
31
31
  class RegistryUnavailable(Exception): # noqa: N818 # name matches #46 vocabulary
32
32
  """A source could not be reached, so no read of it can be believed.
33
33
 
34
- Wraps the underlying httpx / connection error so callers catch one type
34
+ Wraps the underlying httpx2 / connection error so callers catch one type
35
35
  without depending on the HTTP layer. Carries the *source* and *what was
36
36
  tried*, because §5.8 asks the error to name both — a bare
37
37
  ``ConnectError: connection refused`` names neither, and in a federation
@@ -1264,7 +1264,7 @@ class FmrRegistry(RestRegistry):
1264
1264
  id: str | None = None,
1265
1265
  store: LocalRegistry | None = None,
1266
1266
  # Transport options only: this constructor owns `auth` (it also takes a
1267
- # BearerToken, which becomes a header rather than an httpx auth object),
1267
+ # BearerToken, which becomes a header rather than an httpx2 auth object),
1268
1268
  # so the forwarded shape must not carry one.
1269
1269
  **kwargs: Unpack[HttpxTransportOptions],
1270
1270
  ) -> None:
@@ -8,8 +8,9 @@ file, observation counts per binding, and the ``token``, the value a cache or
8
8
  an ETag keys on. ``LocalRegistry.bundle(publication)`` opens it read-only.
9
9
  `read_manifest` reads a manifest back, refusing a format it cannot read;
10
10
  `check_bundle` checks a publication against it and against itself;
11
- `copy_bundle` copies one elsewhere, manifest last; `verify_remote` checks the
12
- files a server reads from blob storage by size and Content-MD5; and `fetch_bundle` lands
11
+ `copy_bundle` copies one elsewhere, manifest last, and `bundle_files` lists
12
+ what such a copy needs for another tool; `verify_remote` checks the
13
+ files a server reads from object storage by size and a digest the store keeps; and `fetch_bundle` lands
13
14
  one dataflow from an SDMX REST source as a published bundle, its provenance
14
15
  recorded. `apply_overlays` changes display annotations without a rebuild,
15
16
  `effective_token` is what a cache keys on when it does, and `fold_overlays`
@@ -17,8 +18,8 @@ writes overlays into a new publication for good. `canonical_json` is the
17
18
  defined text of an artefact that a fingerprint hashes. The manifest's JSON Schema
18
19
  ships beside it, for producers outside Python: `manifest_schema`.
19
20
 
20
- From a shell, ``sdmxlib bundle check``, ``sdmxlib bundle copy`` and
21
- ``sdmxlib bundle fetch`` run these: they are the ``sdmxlib-cli`` package
21
+ From a shell, ``sdmxlib bundle check``, ``sdmxlib bundle copy``,
22
+ ``sdmxlib bundle files`` and ``sdmxlib bundle fetch`` run these: they are the ``sdmxlib-cli`` package
22
23
  (``uv tool install sdmxlib-cli``), released with this one, so the library
23
24
  itself never depends on typer.
24
25
 
@@ -39,8 +40,8 @@ from importlib import resources
39
40
  from sdmxlib.bundle._canonical import CANONICAL_FORM, canonical_json
40
41
  from sdmxlib.bundle._check import Check, Profile, Report, check_bundle, check_on_open
41
42
  from sdmxlib.bundle._finding import Finding
42
- from sdmxlib.bundle._copy import copy_bundle
43
- from sdmxlib.bundle._remote import RemoteFile, content_md5, verify_remote
43
+ from sdmxlib.bundle._copy import bundle_files, copy_bundle
44
+ from sdmxlib.bundle._remote import RemoteFile, content_crc32c, content_md5, verify_remote
44
45
  from sdmxlib.bundle._fetch import fetch_bundle
45
46
  from sdmxlib.bundle._overlay import (
46
47
  OVERLAY_FORMAT,
@@ -109,9 +110,11 @@ __all__ = [
109
110
  "Tier",
110
111
  "applied",
111
112
  "apply_overlays",
113
+ "bundle_files",
112
114
  "canonical_json",
113
115
  "check_bundle",
114
116
  "check_on_open",
117
+ "content_crc32c",
115
118
  "content_md5",
116
119
  "copy_bundle",
117
120
  "effective_token",
@@ -0,0 +1,116 @@
1
+ """What a binding's data holds, and the coded values it must not hold (GH-194).
2
+
3
+ One scan per component column at publish answers two questions:
4
+
5
+ - **Availability.** The values each dimension holds: the SDMX 3.1
6
+ `AvailabilityConstraint` for the unfiltered query, one cube region, which
7
+ `write_manifest` stores so a server answers ``/availability/<flow>/all/all``
8
+ without scanning the observations (2.6 s on the census bundle, 0.25 s read
9
+ back and serialised).
10
+ - **Conformance.** Every value in a column a codelist or value list enumerates
11
+ is one of its codes. A value that is not, such as an empty string standing
12
+ for "no value", is a `NonCode`: `write_manifest` refuses the publication
13
+ and `check_bundle` reports it.
14
+ """
15
+
16
+ from attrs import frozen
17
+
18
+ from sdmxlib.builders.contentconstraint import _distinct_values
19
+ from sdmxlib.local.registry import BundleRegistry
20
+ from sdmxlib.model.binding import DataflowBinding
21
+ from sdmxlib.model.constraint import AvailabilityConstraint, ConstraintAttachment, CubeRegion, KeyValue
22
+ from sdmxlib.model.dataflow import Dataflow
23
+ from sdmxlib.model.datastructure import Attribute, Dimension, Measure
24
+ from sdmxlib.model.ref import Ref
25
+ from sdmxlib.storage._columns import table_columns, value_counts
26
+
27
+
28
+ @frozen
29
+ class NonCode:
30
+ """A value a coded column holds that is not a code of its enumeration.
31
+
32
+ Attributes:
33
+ dataflow: The bound dataflow's URN.
34
+ component_id: The component the column holds.
35
+ value: The value, as text.
36
+ rows: How many rows hold it.
37
+ enumeration: The URN of the codelist or value list it is not in.
38
+ """
39
+
40
+ dataflow: str
41
+ component_id: str
42
+ value: str
43
+ rows: int
44
+ enumeration: str
45
+
46
+ def __str__(self) -> str:
47
+ """``<component> holds <value> in <n> rows, not a code of <enumeration>``."""
48
+ return f"{self.component_id} holds {self.value!r} in {self.rows:,} rows, not a code of {self.enumeration}"
49
+
50
+
51
+ def survey(
52
+ registry: BundleRegistry, binding: DataflowBinding, *, obs_count: int
53
+ ) -> tuple[AvailabilityConstraint, list[NonCode]]:
54
+ """`binding`'s availability, and every value its coded columns hold that is not a code.
55
+
56
+ Args:
57
+ registry: An open registry over the publication: the one being
58
+ published, or a published one being checked.
59
+ binding: The binding to scan.
60
+ obs_count: Its observation count, which the caller has counted.
61
+
62
+ Returns:
63
+ The availability for the unfiltered query, and the non-code values,
64
+ sorted by component and value.
65
+ """
66
+ located = registry.locate(binding)
67
+ conn = registry.connection
68
+ dataflow_urn = str(binding.dataflow.urn)
69
+ tables = _tables(located)
70
+ columns = {table: table_columns(conn, table) for table in tables}
71
+
72
+ def table_of(column: str) -> str | None:
73
+ return next((table for table in tables if column in columns[table]), None)
74
+
75
+ dsd = registry.dsd(binding.dataflow)
76
+ enumerated: dict[str, Dimension | Attribute | Measure] = {}
77
+ if dsd is not None:
78
+ for component in (*dsd.dimensions, *dsd.attributes, *dsd.measures):
79
+ if component.is_enumerated:
80
+ enumerated[component.id] = component
81
+
82
+ keys: list[KeyValue] = []
83
+ non_codes: list[NonCode] = []
84
+ mapped = {**located.dimension_column_map, **located.attribute_column_map, **located.measure_column_map}
85
+ for component_id, column in sorted(mapped.items()):
86
+ table = table_of(column)
87
+ if table is None:
88
+ continue
89
+ held = _distinct_values(conn, table, column)
90
+ if component_id in located.dimension_column_map:
91
+ keys.append(KeyValue(dimension_id=component_id, values=frozenset(held)))
92
+ component = enumerated.get(component_id)
93
+ codes = component.code_ids() if component is not None else None
94
+ if component is None or codes is None:
95
+ continue
96
+ outside = sorted(set(held) - set(codes))
97
+ if outside:
98
+ enumeration = str(component.representation.urn) if isinstance(component.representation, Ref) else ""
99
+ non_codes += [
100
+ NonCode(dataflow_urn, component_id, value, rows, enumeration)
101
+ for value, rows in value_counts(conn, table, column, outside)
102
+ ]
103
+ flow = Ref[Dataflow].unresolved(binding.dataflow.urn)
104
+ availability = AvailabilityConstraint(
105
+ attachment=ConstraintAttachment(dataflows=(flow,)),
106
+ region=CubeRegion(keys=tuple(keys)),
107
+ obs_count=obs_count,
108
+ )
109
+ return availability, non_codes
110
+
111
+
112
+ def _tables(binding: DataflowBinding) -> list[str]:
113
+ """The tables `binding` reads: its own, then its series-attribute sidecar."""
114
+ main = f"{binding.database_role}.{binding.table_location}"
115
+ sidecar = binding.series_attributes_location
116
+ return [main] if sidecar is None else [main, f"{binding.database_role}.{sidecar}"]