sdmxlib 0.83.0__tar.gz → 0.85.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 (227) hide show
  1. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/PKG-INFO +1 -1
  2. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/pyproject.toml +1 -1
  3. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/pyproject.toml.orig +1 -1
  4. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/EGM.md +3 -1
  5. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/_duckdb.py +22 -0
  6. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/builders/contentconstraint.py +3 -2
  7. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/edition/EGM.md +8 -4
  8. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/edition/_availability.py +3 -2
  9. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/edition/_build.py +2 -1
  10. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/edition/_check.py +25 -16
  11. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/edition/_write.py +10 -9
  12. sdmxlib-0.85.0/src/sdmxlib/inventory/EGM.md +131 -0
  13. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/inventory/__init__.py +74 -2
  14. sdmxlib-0.85.0/src/sdmxlib/inventory/_format.py +1030 -0
  15. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/inventory/_reader.py +107 -25
  16. sdmxlib-0.85.0/src/sdmxlib/inventory/_routing.py +149 -0
  17. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/inventory/_rules.py +254 -11
  18. sdmxlib-0.85.0/src/sdmxlib/inventory/conformance.py +735 -0
  19. sdmxlib-0.85.0/src/sdmxlib/inventory/schemas/catalog-2.0.schema.json +47 -0
  20. sdmxlib-0.85.0/src/sdmxlib/inventory/schemas/catalog.schema.json +43 -0
  21. sdmxlib-0.85.0/src/sdmxlib/inventory/schemas/history.schema.json +94 -0
  22. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/inventory/schemas/leaf.schema.json +21 -2
  23. sdmxlib-0.85.0/src/sdmxlib/inventory/schemas/root-1.2.schema.json +378 -0
  24. sdmxlib-0.85.0/src/sdmxlib/inventory/schemas/root.schema.json +375 -0
  25. sdmxlib-0.85.0/src/sdmxlib/inventory/schemas/segment-header.schema.json +163 -0
  26. sdmxlib-0.85.0/src/sdmxlib/inventory/schemas/segment-line.schema.json +343 -0
  27. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/local/EGM.md +8 -0
  28. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/local/data_store.py +18 -13
  29. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/local/sql.py +25 -13
  30. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/query/observations.py +2 -1
  31. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/storage/_synthetic.py +2 -2
  32. sdmxlib-0.83.0/src/sdmxlib/inventory/EGM.md +0 -80
  33. sdmxlib-0.83.0/src/sdmxlib/inventory/_format.py +0 -411
  34. sdmxlib-0.83.0/src/sdmxlib/inventory/conformance.py +0 -341
  35. sdmxlib-0.83.0/src/sdmxlib/inventory/schemas/catalog.schema.json +0 -26
  36. sdmxlib-0.83.0/src/sdmxlib/inventory/schemas/root.schema.json +0 -164
  37. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/LICENSE +0 -0
  38. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/README.md +0 -0
  39. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/__init__.py +0 -0
  40. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/_facet_types.xsd +0 -0
  41. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/_facets.py +0 -0
  42. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/_read_errors.py +0 -0
  43. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/_singleflight.py +0 -0
  44. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/_time.py +0 -0
  45. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/api/EGM.md +0 -0
  46. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/api/__init__.py +0 -0
  47. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/api/_freshness.py +0 -0
  48. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/api/client.py +0 -0
  49. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/api/federated.py +0 -0
  50. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/api/policy.py +0 -0
  51. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/api/providers.py +0 -0
  52. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/api/registry.py +0 -0
  53. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/api/session.py +0 -0
  54. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/builders/EGM.md +0 -0
  55. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/builders/__init__.py +0 -0
  56. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/builders/metadata_annotation.py +0 -0
  57. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/data_store.py +0 -0
  58. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/edition/__init__.py +0 -0
  59. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/edition/_canonical.py +0 -0
  60. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/edition/_copy.py +0 -0
  61. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/edition/_fetch.py +0 -0
  62. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/edition/_finding.py +0 -0
  63. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/edition/_fingerprint.py +0 -0
  64. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/edition/_overlay.py +0 -0
  65. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/edition/_remote.py +0 -0
  66. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/edition/manifest.schema.json +0 -0
  67. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/edition/overlay.schema.json +0 -0
  68. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/EGM.md +0 -0
  69. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/__init__.py +0 -0
  70. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/_arrow.py +0 -0
  71. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/_attachment.py +0 -0
  72. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/_coerce.py +0 -0
  73. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/_index.py +0 -0
  74. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/_positions.py +0 -0
  75. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/_refuse.py +0 -0
  76. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/_tags.py +0 -0
  77. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/data_format.py +0 -0
  78. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/gaps.py +0 -0
  79. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/render.py +0 -0
  80. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_csv/EGM.md +0 -0
  81. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_csv/__init__.py +0 -0
  82. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_csv/reader.py +0 -0
  83. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_csv/writer.py +0 -0
  84. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_json/EGM.md +0 -0
  85. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_json/__init__.py +0 -0
  86. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_json/_data_common.py +0 -0
  87. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_json/_dto.py +0 -0
  88. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_json/_header.py +0 -0
  89. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_json/_losses.py +0 -0
  90. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_json/_periods.py +0 -0
  91. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_json/_resolve.py +0 -0
  92. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_json/_structure_dto.py +0 -0
  93. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_json/_structure_ingest.py +0 -0
  94. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_json/data.py +0 -0
  95. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_json/data_v1.py +0 -0
  96. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_json/data_v2.py +0 -0
  97. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_json/metadata.py +0 -0
  98. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_json/reader.py +0 -0
  99. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_json/structure_values.py +0 -0
  100. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_json/writer.py +0 -0
  101. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_json_1_0/EGM.md +0 -0
  102. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_json_1_0/__init__.py +0 -0
  103. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_json_1_0/writer.py +0 -0
  104. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_ml/EGM.md +0 -0
  105. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_ml/__init__.py +0 -0
  106. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_ml/_allowed_children.py +0 -0
  107. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_ml/_closed_world.py +0 -0
  108. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_ml/_common.py +0 -0
  109. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_ml/_header.py +0 -0
  110. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_ml/_losses.py +0 -0
  111. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_ml/_v3_reader.py +0 -0
  112. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_ml/_v3_writer.py +0 -0
  113. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_ml21/EGM.md +0 -0
  114. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_ml21/__init__.py +0 -0
  115. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_ml21/_providers.py +0 -0
  116. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_ml21/_synthetic.py +0 -0
  117. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_ml21/namespaces.py +0 -0
  118. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_ml21/reader.py +0 -0
  119. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_ml21/writer.py +0 -0
  120. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_ml30/EGM.md +0 -0
  121. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_ml30/__init__.py +0 -0
  122. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_ml30/metadata.py +0 -0
  123. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_ml30/namespaces.py +0 -0
  124. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_ml30/reader.py +0 -0
  125. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_ml30/writer.py +0 -0
  126. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_ml31/EGM.md +0 -0
  127. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_ml31/__init__.py +0 -0
  128. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_ml31/namespaces.py +0 -0
  129. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_ml31/reader.py +0 -0
  130. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/formats/sdmx_ml31/writer.py +0 -0
  131. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/inventory/schemas/current.schema.json +0 -0
  132. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/local/__init__.py +0 -0
  133. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/local/_scan.py +0 -0
  134. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/local/engine.py +0 -0
  135. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/local/object_store.py +0 -0
  136. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/local/registry.py +0 -0
  137. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/EGM.md +0 -0
  138. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/__init__.py +0 -0
  139. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/_binding.py +0 -0
  140. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/_container.py +0 -0
  141. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/_invariants.py +0 -0
  142. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/_items.py +0 -0
  143. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/_label_match.py +0 -0
  144. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/_rebind.py +0 -0
  145. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/_referenceable.py +0 -0
  146. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/_refshape.py +0 -0
  147. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/_resolvers.py +0 -0
  148. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/_rules.py +0 -0
  149. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/_tree.py +0 -0
  150. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/annotations.py +0 -0
  151. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/base.py +0 -0
  152. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/binding.py +0 -0
  153. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/category.py +0 -0
  154. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/codelist.py +0 -0
  155. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/collections.py +0 -0
  156. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/concept.py +0 -0
  157. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/constraint.py +0 -0
  158. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/convert.py +0 -0
  159. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/dataflow.py +0 -0
  160. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/datastructure.py +0 -0
  161. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/errors.py +0 -0
  162. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/expr.py +0 -0
  163. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/header.py +0 -0
  164. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/hierarchy.py +0 -0
  165. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/in_memory_registry.py +0 -0
  166. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/istring.py +0 -0
  167. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/link.py +0 -0
  168. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/mapping.py +0 -0
  169. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/message.py +0 -0
  170. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/metadata_provision.py +0 -0
  171. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/metadataflow.py +0 -0
  172. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/metadataset.py +0 -0
  173. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/metadatastructure.py +0 -0
  174. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/organisation.py +0 -0
  175. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/provision.py +0 -0
  176. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/ref.py +0 -0
  177. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/registry.py +0 -0
  178. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/representation.py +0 -0
  179. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/rest_api.py +0 -0
  180. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/rollup.py +0 -0
  181. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/urn.py +0 -0
  182. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/validation.py +0 -0
  183. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/valuelist.py +0 -0
  184. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/version.py +0 -0
  185. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/model/version_rewrite.py +0 -0
  186. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/polars.py +0 -0
  187. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/py.typed +0 -0
  188. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/query/EGM.md +0 -0
  189. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/query/__init__.py +0 -0
  190. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/query/_closure.py +0 -0
  191. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/query/_common.py +0 -0
  192. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/query/_compile.py +0 -0
  193. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/query/_edges.py +0 -0
  194. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/query/_execute.py +0 -0
  195. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/query/_expr.py +0 -0
  196. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/query/_joins.py +0 -0
  197. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/query/_plan.py +0 -0
  198. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/query/_pushdown.py +0 -0
  199. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/query/_rebase.py +0 -0
  200. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/query/_rest.py +0 -0
  201. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/query/accessors.py +0 -0
  202. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/query/query.py +0 -0
  203. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/query/raw.py +0 -0
  204. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/query/schema.py +0 -0
  205. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/rest.py +0 -0
  206. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/session.py +0 -0
  207. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/sql.py +0 -0
  208. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/storage/EGM.md +0 -0
  209. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/storage/__init__.py +0 -0
  210. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/storage/_checked.py +0 -0
  211. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/storage/_columns.py +0 -0
  212. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/storage/_files.py +0 -0
  213. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/storage/_kinds.py +0 -0
  214. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/storage/_layout.py +0 -0
  215. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/storage/_manifest.py +0 -0
  216. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/storage/_parsed.py +0 -0
  217. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/storage/_projections.py +0 -0
  218. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/storage/_references.py +0 -0
  219. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/storage/_tags.py +0 -0
  220. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/storage/_trim.py +0 -0
  221. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/storage/lazy.py +0 -0
  222. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/storage/readers.py +0 -0
  223. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/storage/resolve.py +0 -0
  224. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/storage/schema.py +0 -0
  225. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/storage/writers.py +0 -0
  226. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/testing.py +0 -0
  227. {sdmxlib-0.83.0 → sdmxlib-0.85.0}/src/sdmxlib/versions.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sdmxlib
3
- Version: 0.83.0
3
+ Version: 0.85.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
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "sdmxlib"
3
- version = "0.83.0"
3
+ version = "0.85.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"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "sdmxlib"
3
- version = "0.83.0"
3
+ version = "0.85.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"
@@ -61,7 +61,9 @@ the subpackages share.
61
61
  REST ingest); `csv_errors` and `converting` convert at a query terminal and
62
62
  in a drained stream, and only errors DuckDB's CSV reader raised.
63
63
  - `first` and `count` (`_duckdb.py`): a cursor's first row with its result
64
- finished, and the row count from a cursor.
64
+ finished, and the row count from a cursor. `quote_identifier` and `located`
65
+ (`_duckdb.py`): a DuckDB quoted identifier, and a binding's relation
66
+ ``"<database_role>".<table_location>`` with its catalog quoted.
65
67
  - `synthetic_edition`, `profile_edition`, `Shape`, `Dim` and `HierarchyShape`
66
68
  (`testing.py`): build a seeded synthetic edition that passes `check_edition`,
67
69
  or take a `Shape` from an existing edition.
@@ -40,3 +40,25 @@ def count(cursor: duckdb.DuckDBPyConnection) -> int:
40
40
  """
41
41
  row = first(cursor)
42
42
  return int(row[0]) if row is not None else 0
43
+
44
+
45
+ def quote_identifier(name: str) -> str:
46
+ """`name` as a DuckDB quoted identifier: in double quotes, each inner double quote doubled.
47
+
48
+ A catalog alias carries the product id (`EditionEngine.attach`), and a
49
+ product named after a StatCan table id, ``14100287``, starts with a digit,
50
+ which an unquoted identifier cannot. DuckDB resolves a quoted identifier
51
+ without regard to case, as it does an unquoted one.
52
+ """
53
+ return '"' + name.replace('"', '""') + '"'
54
+
55
+
56
+ def located(catalog: str, location: str) -> str:
57
+ """The relation ``<catalog>.<location>``, with `catalog` quoted.
58
+
59
+ A binding names its table by its catalog (``database_role``) and its
60
+ ``schema.table`` inside it (``table_location``). The catalog is an ATTACH
61
+ alias the registry chose, quoted here; the location is the producer's and
62
+ written as it stands.
63
+ """
64
+ return f"{quote_identifier(catalog)}.{location}"
@@ -31,6 +31,7 @@ from typing import Literal
31
31
 
32
32
  import duckdb
33
33
 
34
+ from sdmxlib._duckdb import located
34
35
  from sdmxlib.local.registry import EditionRegistry, LocalRegistry
35
36
  from sdmxlib.model.binding import DataflowBinding
36
37
  from sdmxlib.model.constraint import (
@@ -114,7 +115,7 @@ def build_dataflow_constraint(
114
115
  )
115
116
  raise TypeError(err)
116
117
 
117
- table = f"{binding.database_role}.{binding.table_location}"
118
+ table = located(binding.database_role, binding.table_location)
118
119
  key_values: list[KeyValue] = []
119
120
  for dim_id in sorted(binding.dimension_column_map):
120
121
  column = binding.dimension_column_map[dim_id]
@@ -260,7 +261,7 @@ def build_component_availability(
260
261
  held = _held_values(registry, dataflow_urn)
261
262
  component_filter = _drop_covering(component_filter, held)
262
263
 
263
- table = f"{binding.database_role}.{binding.table_location}"
264
+ table = located(binding.database_role, binding.table_location)
264
265
  key_values: list[KeyValue] = []
265
266
  components: list[ComponentValueSet] = []
266
267
  for target in targets:
@@ -33,8 +33,12 @@ seals through `seal(extensions=...)`.
33
33
  `Report.ok` says whether it passed. `Check` is the type an extension check
34
34
  implements, and `Profile` is the profile literal. Findings are `Finding`s
35
35
  (`_finding.py`). An argument the profile does not use (`structures=` at
36
- `open`, `remote=` at `publish`, `lookup=` or `fingerprints=` outside
37
- `receive`) raises `ValueError`. `structures=` takes one edition or a
36
+ `open`, `remote=` at `publish`, `lookup=` outside `receive`,
37
+ `fingerprints=True` at `open`) raises `ValueError`. `fingerprints=None`
38
+ (the default) recomputes the fingerprints at `publish` only;
39
+ `fingerprints=True` adds them at `receive`, and `fingerprints=False` skips
40
+ them at `publish`, for the process that sealed the edition, right after
41
+ `seal` (GH-357). `structures=` takes one edition or a
38
42
  sequence of them, and a partial is checked against the one holding its
39
43
  full artefact with its `partial_of` fingerprint; an empty sequence raises
40
44
  `ValueError`. For an edition with no bindings (a structure product), the
@@ -134,8 +138,8 @@ seals through `seal(extensions=...)`.
134
138
  manifest only when the table's uuid, current data file ids and current
135
139
  columns in this edition's lake catalog equal those in the previous
136
140
  edition's catalog, and neither has a delete file. Every other table is
137
- fingerprinted by reading its rows. `check_edition(at="publish")` always
138
- reads every row.
141
+ fingerprinted by reading its rows. `check_edition(at="publish")` reads
142
+ every row unless given `fingerprints=False`.
139
143
  - An edition with a lake is refused when a coded column holds a value
140
144
  outside its codelist. The survey scans every binding before refusing, and
141
145
  stores availability only when nothing is refused.
@@ -15,6 +15,7 @@ One scan per component column at publish answers two questions:
15
15
 
16
16
  from attrs import frozen
17
17
 
18
+ from sdmxlib._duckdb import located
18
19
  from sdmxlib.builders.contentconstraint import _distinct_values
19
20
  from sdmxlib.local.registry import EditionRegistry
20
21
  from sdmxlib.model.binding import DataflowBinding
@@ -111,6 +112,6 @@ def survey(
111
112
 
112
113
  def _tables(binding: DataflowBinding) -> list[str]:
113
114
  """The tables `binding` reads: its own, then its series-attribute sidecar."""
114
- main = f"{binding.database_role}.{binding.table_location}"
115
+ main = located(binding.database_role, binding.table_location)
115
116
  sidecar = binding.series_attributes_location
116
- return [main] if sidecar is None else [main, f"{binding.database_role}.{sidecar}"]
117
+ return [main] if sidecar is None else [main, located(binding.database_role, sidecar)]
@@ -30,6 +30,7 @@ from pathlib import Path
30
30
 
31
31
  import msgspec
32
32
 
33
+ from sdmxlib._duckdb import located
33
34
  from sdmxlib.api.registry import RestRegistry
34
35
  from sdmxlib.builders.contentconstraint import _distinct_values
35
36
  from sdmxlib.data_store import WriteSource
@@ -410,7 +411,7 @@ def _observed_codes(
410
411
  Raises:
411
412
  ValueError: If a column holds a value that is not a code of its codelist.
412
413
  """
413
- table = f"{binding.database_role}.{binding.table_location}"
414
+ table = located(binding.database_role, binding.table_location)
414
415
  columns = table_columns(edition.connection, table)
415
416
  mapped = {**binding.dimension_column_map, **binding.attribute_column_map, **binding.measure_column_map}
416
417
  for component_id, urn in _components(dsd).items():
@@ -91,7 +91,7 @@ def check_edition(
91
91
  remote: str | None = None,
92
92
  engine: EditionEngine | None = None,
93
93
  lookup: Lookup | None = None,
94
- fingerprints: bool = False,
94
+ fingerprints: bool | None = None,
95
95
  expect: Manifest | str | Path | None = None,
96
96
  structures: str | Path | Sequence[str | Path] | None = None,
97
97
  extensions: Mapping[str, Check] | None = None,
@@ -109,7 +109,7 @@ def check_edition(
109
109
  | bindings: the manifest's, each with the count it gives | yes | yes | no |
110
110
  | references: every stored reference names something in the store (see `structures`) | yes | yes | no |
111
111
  | tags: every stored language tag is in the form `normalize_tag` gives | yes | yes | no |
112
- | fingerprints: recomputed, equal to the manifest's | yes | with `fingerprints` | no |
112
+ | fingerprints: recomputed, equal to the manifest's | unless `fingerprints` is False | if it is True | no |
113
113
  | availability: coded columns hold codes; stored availability is the data's | yes | no | no |
114
114
  | expect: fingerprints equal to an earlier manifest's | with `expect` | with `expect` | with `expect` |
115
115
  | partials: `partial_of` and the items match the full artefact | with `structures` | with `structures` | no |
@@ -137,15 +137,26 @@ def check_edition(
137
137
  credentials; one of its own when None.
138
138
  lookup: At ``receive``, what the blob store reports for a ``data/``
139
139
  entry, or None for a file it does not hold (see `verify_remote`).
140
- fingerprints: At ``receive``, also recompute the fingerprints, which
141
- ``publish`` always does.
140
+ fingerprints: Whether to recompute every artefact, binding and
141
+ content fingerprint from the store and compare it with the
142
+ manifest's. None takes the profile's default: ``publish``
143
+ recomputes them, ``receive`` and ``open`` do not. True opts a
144
+ ``receive`` check in. False skips them at ``publish``, for the
145
+ process that sealed the edition, right after `seal`: `seal`
146
+ computed the manifest's fingerprints from this store, and the
147
+ ``files`` check, which still hashes every file, shows the files
148
+ are the ones sealed. On the 2021 Census Profile edition, 2.0 GB
149
+ of data files, the check took 774 s with the recomputation and
150
+ 46 s without it. Check an edition received from elsewhere, or
151
+ one sealed by another process, with the default.
142
152
  expect: An earlier edition's manifest, or its directory, whose
143
153
  content this one must have: a republish that is to change no
144
154
  content, such as every edition rebuilt at a new store schema. Each
145
155
  artefact, binding and the edition fingerprint that differs is a
146
156
  finding under ``expect``. Read from the manifests alone, so at
147
- ``publish``, where the fingerprints are also recomputed, a clean
148
- run says the store's content is the earlier one's.
157
+ ``publish``, where the fingerprints are also recomputed unless
158
+ ``fingerprints=False``, a clean run says the store's content is
159
+ the earlier one's.
149
160
  structures: The editions holding the full artefacts this edition's
150
161
  partials were cut from, structure products say: one edition or a
151
162
  sequence of them. Each partial whose manifest entry records
@@ -167,9 +178,9 @@ def check_edition(
167
178
  What was checked and what was found.
168
179
 
169
180
  Raises:
170
- ValueError: If `lookup`, `fingerprints`, `remote` or `structures` is
171
- given at a profile that does not use it, or `structures` is an
172
- empty sequence.
181
+ ValueError: If `lookup`, `remote` or `structures` is given at a
182
+ profile that does not use it, `fingerprints` is True at ``open``,
183
+ or `structures` is an empty sequence.
173
184
  """
174
185
  _refuse_unused(at, lookup=lookup, fingerprints=fingerprints, remote=remote, structures=structures)
175
186
  root = Path(path)
@@ -237,7 +248,7 @@ def _refuse_unused(
237
248
  at: Profile,
238
249
  *,
239
250
  lookup: Lookup | None,
240
- fingerprints: bool,
251
+ fingerprints: bool | None,
241
252
  remote: str | None,
242
253
  structures: str | Path | Sequence[str | Path] | None,
243
254
  ) -> None:
@@ -254,10 +265,8 @@ def _refuse_unused(
254
265
  if lookup is not None and at != "receive":
255
266
  msg = f"lookup= verifies data files at receive; at={at!r} does not use it"
256
267
  raise ValueError(msg)
257
- if fingerprints and at != "receive":
258
- msg = f"fingerprints= opts a receive check into recomputing them; at={at!r} " + (
259
- "always recomputes them" if at == "publish" else "never does"
260
- )
268
+ if fingerprints and at == "open":
269
+ msg = "fingerprints=True recomputes them from the store; at='open' reads no store"
261
270
  raise ValueError(msg)
262
271
 
263
272
 
@@ -268,7 +277,7 @@ def _steps(
268
277
  at: Profile,
269
278
  *,
270
279
  sized_remotely: bool,
271
- fingerprints: bool,
280
+ fingerprints: bool | None,
272
281
  structures: tuple[Path, ...] | None,
273
282
  extensions: Mapping[str, Check],
274
283
  ) -> list[tuple[str, Callable[[], Iterable[Finding]]]]:
@@ -284,7 +293,7 @@ def _steps(
284
293
  ("references", partial(_references, reg, None if manifest.bindings else structures)),
285
294
  ("tags", partial(_tags, reg)),
286
295
  ]
287
- if at == "publish" or fingerprints:
296
+ if fingerprints or (fingerprints is None and at == "publish"):
288
297
  steps.append(("fingerprints", partial(_fingerprints, root, manifest, reg)))
289
298
  if at == "publish":
290
299
  steps.append(("availability", partial(_availability, manifest, reg)))
@@ -12,7 +12,7 @@ from typing import Literal
12
12
  import duckdb
13
13
  import google_crc32c
14
14
 
15
- from sdmxlib._duckdb import first
15
+ from sdmxlib._duckdb import first, quote_identifier
16
16
  from sdmxlib.edition._availability import survey
17
17
  from sdmxlib.edition._canonical import CANONICAL_FORM
18
18
  from sdmxlib.edition._fingerprint import (
@@ -54,20 +54,21 @@ from sdmxlib.storage.writers import clear_availability, put_availability
54
54
  #: Every data file and delete file the lake catalog references from any snapshot
55
55
  #: it keeps, with the schema and table paths each one's path is relative to.
56
56
  #: The table and schema rows are the ones live when the file was written.
57
- #: ``__ducklake_metadata_{lake}`` is the database DuckLake attaches behind the
58
- #: catalog's alias: ``lake`` in a builder, ``<prefix>__tables`` in a `EditionEngine`.
57
+ #: ``{metadata}`` is the database DuckLake attaches behind the catalog's alias,
58
+ #: ``__ducklake_metadata_<alias>``, quoted. The alias is ``lake`` in a builder and
59
+ #: ``<prefix>__tables`` in an `EditionEngine`.
59
60
  _LAKE_FILES = """
60
61
  SELECT s.path, s.path_is_relative, t.path, t.path_is_relative, f.path, f.path_is_relative
61
62
  FROM (
62
- SELECT table_id, begin_snapshot, path, path_is_relative FROM __ducklake_metadata_{lake}.ducklake_data_file
63
+ SELECT table_id, begin_snapshot, path, path_is_relative FROM {metadata}.ducklake_data_file
63
64
  UNION ALL
64
- SELECT table_id, begin_snapshot, path, path_is_relative FROM __ducklake_metadata_{lake}.ducklake_delete_file
65
+ SELECT table_id, begin_snapshot, path, path_is_relative FROM {metadata}.ducklake_delete_file
65
66
  ) AS f
66
- JOIN __ducklake_metadata_{lake}.ducklake_table AS t
67
+ JOIN {metadata}.ducklake_table AS t
67
68
  ON t.table_id = f.table_id
68
69
  AND t.begin_snapshot <= f.begin_snapshot
69
70
  AND (t.end_snapshot IS NULL OR f.begin_snapshot < t.end_snapshot)
70
- JOIN __ducklake_metadata_{lake}.ducklake_schema AS s
71
+ JOIN {metadata}.ducklake_schema AS s
71
72
  ON s.schema_id = t.schema_id
72
73
  AND s.begin_snapshot <= f.begin_snapshot
73
74
  AND (s.end_snapshot IS NULL OR f.begin_snapshot < s.end_snapshot)
@@ -200,7 +201,7 @@ def lake_files(conn: duckdb.DuckDBPyConnection, data: Path | str, *, lake: str =
200
201
  ManifestError: If the catalog references a file outside `data`.
201
202
  """
202
203
  found: set[str] = set()
203
- for row in conn.execute(_LAKE_FILES.format(lake=lake)).fetchall():
204
+ for row in conn.execute(_LAKE_FILES.format(metadata=quote_identifier(f"__ducklake_metadata_{lake}"))).fetchall():
204
205
  path = ""
205
206
  anchored = False
206
207
  for part, relative in zip(row[::2], row[1::2], strict=True):
@@ -359,7 +360,7 @@ type _TableState = tuple[object, ...]
359
360
  def _table_state(conn: duckdb.DuckDBPyConnection, db: str, table_location: str) -> _TableState | None:
360
361
  """The state of the table at ``schema.table`` `table_location` in catalog database `db`; None with a delete file."""
361
362
  schema, _, table = table_location.partition(".")
362
- row = first(conn.execute(_TABLE_STATE.format(db=db), {"schema": schema, "table": table}))
363
+ row = first(conn.execute(_TABLE_STATE.format(db=quote_identifier(db)), {"schema": schema, "table": table}))
363
364
  return None if row is None else tuple(row)
364
365
 
365
366
 
@@ -0,0 +1,131 @@
1
+ # sdmxlib.inventory
2
+
3
+ ## Overview
4
+
5
+ `sdmxlib.inventory` holds a catalog's Inventory: which edition of each
6
+ product is live (sharded catalog spec §6; GH-251). sdmxlib owns the
7
+ documents, their validation, the state-transition rules and a reader;
8
+ statcatlib owns the writer. sdmxlib holds no blob client: the reader takes a
9
+ `fetch(path) -> bytes | None` callable.
10
+
11
+ ## Interface
12
+
13
+ - Documents (`_format.py`): `CatalogDocument` (`catalog.json`), `Current`
14
+ (`CURRENT`), `Root` (`inventory/<seq>.json`), `Leaf` and `LeafEntry`
15
+ (`inventory/leaves/<sha256>.json`), with `Event`, `LeafRef`, `Tombstone`,
16
+ `StructureSource` and `PartialRecord`. `encode` writes one; `decode_catalog`,
17
+ `decode_current`, `decode_root` and `decode_leaf` read one, refusing
18
+ another major format with `InventoryError`; `validate_root` and
19
+ `validate_leaf` check the format's own rules. `decode_root` checks every
20
+ rule `validate_root` does except the event kind. `EventKind` is the set a
21
+ writer records (`EVENT_KINDS`, `check_event_kind`); `Event.kind` is a
22
+ `str`. `root_path(seq)`,
23
+ `leaf_path(sha256)` and `sha256_hex` name and address them.
24
+ `INVENTORY_FORMAT` is `"1.2"`, `CATALOG_FORMAT` `"1.0"`.
25
+ - History documents (`_format.py`, Inventory 1.2, spec §6.1-§6.3, §6.9;
26
+ GH-361): a root's history fields `previous_root_sha256` and `changes`
27
+ (`ChangeItem`, `LeafHashes`, `EntryItem` with its `Marker`, `EntryRecord`),
28
+ unset when absent, tested by `Root.has_history`; `CatalogDocument.history`
29
+ (`CatalogHistory`), set exactly in `catalog.json` 2.x; `History`
30
+ (`inventory/HISTORY`); `SegmentHeader` and `SegmentLine`. `decode_catalog`
31
+ takes `decoder=`: a reader and a stage-2 writer read majors 1 and 2, a
32
+ `stage-1-writer` refuses 2.x. `decode_history`, `decode_segment`,
33
+ `encode_segment`, `segment_line` and `segment_path` read and write them.
34
+ - Routing fields (`_format.py`, `_routing.py`, spec §6.3, §7.3, §10.3;
35
+ GH-348): `LeafEntry.dataflows` and `pull_bytes`, unset when absent, tested
36
+ by `LeafEntry.has_routing`; `LeafEntry.full_artefacts`, the records without
37
+ `partial_of`. `routing_fields(manifest)` computes `RoutingFields`
38
+ (`dataflows`, `pull_bytes`, `artefacts`, the last by `manifest_records`)
39
+ for a writer. `route(edition, manifest)` gives a `LiveEdition`'s `Route`
40
+ (`dataflows`, `pull_bytes`, `homes`), calling `manifest()` only for a field
41
+ the entry lacks and refusing bytes that do not hash to `manifest_sha256`.
42
+ `verify_entry(entry, manifest)` lists each filled field that differs from
43
+ the manifest, for statcatlib's `verify-catalog`. `ShardRouter` is
44
+ statcat-serve's.
45
+ - `schema(document)` (`__init__.py`): the shipped JSON Schema of `catalog`,
46
+ `current`, `root`, `leaf`, `catalog-2.0`, `root-1.2` (history fields
47
+ required), `history`, `segment-header` or `segment-line`. `generate_schemas`
48
+ builds all nine from the models, merging in the conditional rules msgspec
49
+ cannot state from a type (`_DEFINITION_RULES`, `_SCHEMAS`).
50
+ - Rules (`_rules.py`): `head`, `record`, `release`, `due`, `release_due`,
51
+ `cancel`, `supersede_pending`, `rollback`, `retire`, `reinstate`,
52
+ `leaf_ref` and `next_root`. Each takes a product's current leaf and
53
+ returns the next, or raises `TransitionError` with its `rule`, a `Rule`
54
+ (exported, GH-339). `record` and `reinstate` take `artefacts`,
55
+ `dataflows` and `pull_bytes`; every other rule copies them.
56
+ - History rules (`_rules.py`, spec §6.6): `change_list` diffs the base
57
+ version, root `seq - 1`, and its leaves against the new version;
58
+ `next_created_at` keeps `created_at` at least `CREATED_AT_STEP` past the
59
+ base's and refuses a base more than `MAX_BASE_AHEAD` ahead; `next_root`
60
+ takes `previous_bytes` and `changes` together and writes both history
61
+ fields; `entry_record` is a change item's copy of a `LeafEntry`.
62
+ - Reading (`_reader.py`): `LiveInventory(fetch, schema_version=...)` and
63
+ `FullInventory(fetch)`, each with `refresh()`, `seq`, `restore_epoch` and
64
+ `skipped`; `LiveInventory.editions()`, `products()` and `head(product)`
65
+ return `LiveEdition`s, which carry the entry's `dataflows`, `pull_bytes`
66
+ and `artefacts` (None when absent); `FullInventory.root`, `embargo`,
67
+ `retired`, `products()`, `leaf()`, `leaves()` and `entries()`. `local_fetch(dir)`
68
+ is a `Fetch` over a directory.
69
+ - `repairable(journal, leaves, retired)` (`_rules.py`): the seal-journal
70
+ entries the narrow repair (spec §6.7) may record: those the newest version
71
+ neither names nor tombstones.
72
+ - Conformance (`conformance.py`, GH-252): a `Backend` protocol (`head`,
73
+ `commit` raising `ConflictError` on a stale base, `commit_interrupted`,
74
+ `reader`, `hint_behind`, `restore_to`, `restore_with_new_epoch`), the
75
+ `Snapshot` it returns, the checks in `CHECKS`, and `run(new)`, which runs
76
+ every check against fresh backends. An implementation of the protocol
77
+ (statcatlib's writer) runs it as a test. A writer of the history fields
78
+ also provides a `HistoryBackend` (`stage_2`, `fetch`, `put`, `commit_at`)
79
+ and runs `run_history`, the stage-1 checks in `HISTORY_CHECKS`. The §6.9
80
+ cases for the lock, opt-in, expiry, restores and `verify-catalog` wait for
81
+ stage 2.
82
+
83
+ ## Invariants
84
+
85
+ - A leaf lists its editions sorted by id, at most one `live` per
86
+ `schema_version`, and a `release_at` only on an `embargoed` entry.
87
+ - An edition becomes `live` only when built on the live edition at its
88
+ schema, or, with none there, on nothing or on a live edition at another
89
+ schema (fast-forward). A rollback names the live edition it expects. A
90
+ tombstoned edition is recorded again only by `reinstate`. Every
91
+ transition time is time-zone aware.
92
+ - A reader never accepts a lower `seq` than one it holds unless
93
+ `restore_epoch` changed; it verifies the root `CURRENT` names, probes
94
+ `seq + 1` onward without listing, and skips an invalid root into
95
+ `skipped`. A leaf must hash to its name.
96
+ - With `CURRENT` present and verifying, a reader fetches only `CURRENT` and
97
+ roots. Otherwise it reads `catalog.json` and, on 2.x, `inventory/HISTORY`;
98
+ takes the epoch from `HISTORY` (2.x) or `catalog.json` (1.x); bounds its
99
+ walk back and starts its probe at max(held `seq` in that epoch,
100
+ `expired_through`); drops a held root at or below `expired_through`; and
101
+ fails closed with no root above the bound and none held, or on 2.x
102
+ without `HISTORY` (spec §6.6).
103
+ - A leaf entry carries both routing fields or neither; `dataflows` is sorted
104
+ without duplicates and `pull_bytes` is at least 0. No rule tests
105
+ `format_version` for them, so an entry without them decodes and routes
106
+ from its manifest.
107
+ - A root carries both history fields or neither; `previous_root_sha256` is
108
+ None exactly at version 1; changes are sorted by product, entry items by
109
+ edition, and an entry item carries `entry` exactly when `to` is a state.
110
+ - A reader accepts any `event.kind` within format 1.x; `next_root` and
111
+ `validate_root` refuse a kind outside `EventKind`, and the shipped root
112
+ schema keeps that enum (GH-338).
113
+ - `LiveInventory` holds only `live` entries at its schema version and
114
+ exposes no leaf, so a public reader has nothing embargoed to filter.
115
+
116
+ ## Side Effects
117
+
118
+ - None: the rules are pure, the readers read only through `fetch`, caching
119
+ leaves by hash, and `route` reads only through the `manifest` callable it
120
+ is given.
121
+
122
+ ## Verification
123
+
124
+ - `uv run pytest -m unit tests/unit/test_inventory.py tests/unit/test_inventory_history.py tests/unit/test_inventory_reader_fallback.py tests/unit/test_inventory_history_schemas.py tests/unit/test_inventory_conformance.py tests/unit/test_inventory_routing.py`.
125
+ The conformance suite runs against two backends in
126
+ `tests/support/inventory_backends.py`: the file protocol, written by the
127
+ reference writer in `tests/support/inventory.py` (it writes the history
128
+ fields and refuses `catalog.json` 2.x), and a prototype over a
129
+ Delta table (delta-rs, a dev dependency), which proves the spec's escape
130
+ route. A Delta reader lists its log, so `hint_behind` has nothing to do
131
+ there. Sabotaged backends show each check, and each history check, can fail.
@@ -13,6 +13,9 @@ validation, the state-transition rules and a reader; statcatlib writes it.
13
13
  `next_root`):
14
14
  pure functions over a product's leaf that return the next one or raise
15
15
  `TransitionError`, naming the `Rule`.
16
+ - **Routing** (`routing_fields`, `route`, `verify_entry`): a leaf entry's
17
+ routing fields computed from its manifest for a writer, read back for a
18
+ router with the manifest as fallback, and checked by ``verify-catalog``.
16
19
  - **Reading** (`LiveInventory`, `FullInventory`): the read protocol over a
17
20
  ``fetch(path) -> bytes | None`` callable, since sdmxlib holds no blob
18
21
  client. `LiveInventory` holds only live entries; `FullInventory` every
@@ -26,41 +29,67 @@ from sdmxlib.inventory._format import (
26
29
  CATALOG_FORMAT,
27
30
  CATALOG_NAME,
28
31
  CURRENT_NAME,
32
+ HISTORY_DIR,
33
+ HISTORY_FORMAT,
34
+ HISTORY_NAME,
29
35
  INVENTORY_FORMAT,
36
+ OPTED_IN_CATALOG_FORMAT,
37
+ CatalogDecoder,
30
38
  CatalogDocument,
39
+ CatalogHistory,
40
+ ChangeItem,
31
41
  Current,
42
+ EntryItem,
43
+ EntryRecord,
32
44
  Event,
33
45
  EventKind,
46
+ History,
34
47
  InventoryError,
35
48
  Kind,
36
49
  Leaf,
37
50
  LeafEntry,
51
+ LeafHashes,
38
52
  LeafRef,
39
53
  Lifecycle,
54
+ Marker,
40
55
  PartialRecord,
41
56
  Root,
57
+ SegmentHeader,
58
+ SegmentKind,
59
+ SegmentLine,
42
60
  State,
43
61
  StructureSource,
44
62
  Tombstone,
45
63
  decode_catalog,
46
64
  decode_current,
65
+ decode_history,
47
66
  decode_leaf,
48
67
  decode_root,
68
+ decode_segment,
49
69
  encode,
70
+ encode_segment,
50
71
  leaf_path,
51
72
  root_path,
73
+ segment_line,
74
+ segment_path,
52
75
  sha256_hex,
53
76
  validate_leaf,
54
77
  validate_root,
55
78
  )
56
79
  from sdmxlib.inventory._reader import Fetch, FullInventory, LiveEdition, LiveInventory, local_fetch
80
+ from sdmxlib.inventory._routing import Route, RoutingFields, manifest_records, route, routing_fields, verify_entry
57
81
  from sdmxlib.inventory._rules import (
82
+ CREATED_AT_STEP,
83
+ MAX_BASE_AHEAD,
58
84
  Rule,
59
85
  TransitionError,
60
86
  cancel,
87
+ change_list,
61
88
  due,
89
+ entry_record,
62
90
  head,
63
91
  leaf_ref,
92
+ next_created_at,
64
93
  next_root,
65
94
  record,
66
95
  reinstate,
@@ -75,40 +104,66 @@ from sdmxlib.inventory._rules import (
75
104
  __all__ = [
76
105
  "CATALOG_FORMAT",
77
106
  "CATALOG_NAME",
107
+ "CREATED_AT_STEP",
78
108
  "CURRENT_NAME",
109
+ "HISTORY_DIR",
110
+ "HISTORY_FORMAT",
111
+ "HISTORY_NAME",
79
112
  "INVENTORY_FORMAT",
113
+ "MAX_BASE_AHEAD",
114
+ "OPTED_IN_CATALOG_FORMAT",
115
+ "CatalogDecoder",
80
116
  "CatalogDocument",
117
+ "CatalogHistory",
118
+ "ChangeItem",
81
119
  "Current",
120
+ "EntryItem",
121
+ "EntryRecord",
82
122
  "Event",
83
123
  "EventKind",
84
124
  "Fetch",
85
125
  "FullInventory",
126
+ "History",
86
127
  "InventoryError",
87
128
  "Kind",
88
129
  "Leaf",
89
130
  "LeafEntry",
131
+ "LeafHashes",
90
132
  "LeafRef",
91
133
  "Lifecycle",
92
134
  "LiveEdition",
93
135
  "LiveInventory",
136
+ "Marker",
94
137
  "PartialRecord",
95
138
  "Root",
139
+ "Route",
140
+ "RoutingFields",
96
141
  "Rule",
142
+ "SegmentHeader",
143
+ "SegmentKind",
144
+ "SegmentLine",
97
145
  "State",
98
146
  "StructureSource",
99
147
  "Tombstone",
100
148
  "TransitionError",
101
149
  "cancel",
150
+ "change_list",
102
151
  "decode_catalog",
103
152
  "decode_current",
153
+ "decode_history",
104
154
  "decode_leaf",
105
155
  "decode_root",
156
+ "decode_segment",
106
157
  "due",
107
158
  "encode",
159
+ "encode_segment",
160
+ "entry_record",
108
161
  "head",
109
162
  "leaf_path",
110
163
  "leaf_ref",
111
164
  "local_fetch",
165
+ "manifest_records",
166
+ "next_created_at",
112
167
  "next_root",
113
168
  "record",
114
169
  "reinstate",
@@ -118,14 +173,31 @@ __all__ = [
118
173
  "retire",
119
174
  "rollback",
120
175
  "root_path",
176
+ "route",
177
+ "routing_fields",
121
178
  "schema",
179
+ "segment_line",
180
+ "segment_path",
122
181
  "sha256_hex",
123
182
  "supersede_pending",
124
183
  "validate_leaf",
125
184
  "validate_root",
185
+ "verify_entry",
126
186
  ]
127
187
 
128
188
 
129
- def schema(document: Literal["catalog", "current", "root", "leaf"]) -> bytes:
130
- """The shipped JSON Schema for one Inventory document (``schemas/<document>.schema.json``)."""
189
+ def schema(
190
+ document: Literal[
191
+ "catalog", "current", "root", "leaf", "catalog-2.0", "root-1.2", "history", "segment-header", "segment-line"
192
+ ],
193
+ ) -> bytes:
194
+ """The shipped JSON Schema for one Inventory document (``schemas/<document>.schema.json``).
195
+
196
+ Each is generated from its model, with the conditional rules msgspec
197
+ cannot state from a type merged in. ``catalog`` and ``root`` describe
198
+ every document of their major; ``catalog-2.0`` is an opted-in
199
+ ``catalog.json``, and ``root-1.2`` a root with the history fields
200
+ required. ``history`` is ``inventory/HISTORY``, and ``segment-header``
201
+ and ``segment-line`` a history segment's lines (spec §6.1-§6.3, §6.9).
202
+ """
131
203
  return resources.files(__package__).joinpath("schemas", f"{document}.schema.json").read_bytes()