sdmxlib 0.87.0__tar.gz → 0.89.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 (223) hide show
  1. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/PKG-INFO +1 -1
  2. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/pyproject.toml +1 -1
  3. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/pyproject.toml.orig +1 -1
  4. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/__init__.py +4 -0
  5. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/builders/EGM.md +16 -8
  6. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/builders/contentconstraint.py +71 -6
  7. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/edition/EGM.md +21 -5
  8. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/edition/_check.py +89 -23
  9. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/edition/_copy.py +2 -1
  10. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/edition/_write.py +10 -9
  11. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/edition/manifest.schema.json +2 -2
  12. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_json/EGM.md +6 -4
  13. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_json/_data_common.py +5 -76
  14. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_json/_periods.py +17 -7
  15. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_json/writer.py +3 -2
  16. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_json_1_0/EGM.md +3 -2
  17. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/inventory/EGM.md +3 -1
  18. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/inventory/_format.py +9 -5
  19. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/inventory/conformance.py +10 -2
  20. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/inventory/schemas/leaf.schema.json +2 -2
  21. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/local/EGM.md +4 -0
  22. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/local/data_store.py +109 -11
  23. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/local/registry.py +17 -5
  24. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/EGM.md +6 -0
  25. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/__init__.py +3 -0
  26. sdmxlib-0.89.0/src/sdmxlib/model/period.py +139 -0
  27. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/storage/EGM.md +5 -1
  28. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/storage/_manifest.py +68 -7
  29. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/LICENSE +0 -0
  30. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/README.md +0 -0
  31. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/EGM.md +0 -0
  32. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/_duckdb.py +0 -0
  33. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/_facet_types.xsd +0 -0
  34. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/_facets.py +0 -0
  35. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/_read_errors.py +0 -0
  36. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/_singleflight.py +0 -0
  37. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/_time.py +0 -0
  38. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/api/EGM.md +0 -0
  39. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/api/__init__.py +0 -0
  40. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/api/_freshness.py +0 -0
  41. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/api/client.py +0 -0
  42. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/api/federated.py +0 -0
  43. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/api/policy.py +0 -0
  44. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/api/providers.py +0 -0
  45. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/api/registry.py +0 -0
  46. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/api/session.py +0 -0
  47. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/builders/__init__.py +0 -0
  48. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/builders/metadata_annotation.py +0 -0
  49. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/data_store.py +0 -0
  50. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/edition/__init__.py +0 -0
  51. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/edition/_availability.py +0 -0
  52. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/edition/_build.py +0 -0
  53. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/edition/_canonical.py +0 -0
  54. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/edition/_fetch.py +0 -0
  55. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/edition/_finding.py +0 -0
  56. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/edition/_fingerprint.py +0 -0
  57. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/edition/_overlay.py +0 -0
  58. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/edition/_remote.py +0 -0
  59. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/edition/overlay.schema.json +0 -0
  60. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/EGM.md +0 -0
  61. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/__init__.py +0 -0
  62. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/_arrow.py +0 -0
  63. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/_attachment.py +0 -0
  64. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/_coerce.py +0 -0
  65. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/_index.py +0 -0
  66. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/_positions.py +0 -0
  67. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/_refuse.py +0 -0
  68. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/_tags.py +0 -0
  69. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/data_format.py +0 -0
  70. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/gaps.py +0 -0
  71. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/render.py +0 -0
  72. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_csv/EGM.md +0 -0
  73. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_csv/__init__.py +0 -0
  74. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_csv/reader.py +0 -0
  75. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_csv/writer.py +0 -0
  76. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_json/__init__.py +0 -0
  77. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_json/_dto.py +0 -0
  78. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_json/_header.py +0 -0
  79. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_json/_losses.py +0 -0
  80. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_json/_resolve.py +0 -0
  81. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_json/_structure_dto.py +0 -0
  82. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_json/_structure_ingest.py +0 -0
  83. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_json/data.py +0 -0
  84. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_json/data_v1.py +0 -0
  85. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_json/data_v2.py +0 -0
  86. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_json/metadata.py +0 -0
  87. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_json/reader.py +0 -0
  88. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_json/structure_values.py +0 -0
  89. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_json_1_0/__init__.py +0 -0
  90. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_json_1_0/writer.py +0 -0
  91. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_ml/EGM.md +0 -0
  92. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_ml/__init__.py +0 -0
  93. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_ml/_allowed_children.py +0 -0
  94. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_ml/_closed_world.py +0 -0
  95. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_ml/_common.py +0 -0
  96. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_ml/_header.py +0 -0
  97. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_ml/_losses.py +0 -0
  98. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_ml/_v3_reader.py +0 -0
  99. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_ml/_v3_writer.py +0 -0
  100. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_ml21/EGM.md +0 -0
  101. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_ml21/__init__.py +0 -0
  102. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_ml21/_providers.py +0 -0
  103. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_ml21/_synthetic.py +0 -0
  104. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_ml21/namespaces.py +0 -0
  105. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_ml21/reader.py +0 -0
  106. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_ml21/writer.py +0 -0
  107. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_ml30/EGM.md +0 -0
  108. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_ml30/__init__.py +0 -0
  109. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_ml30/metadata.py +0 -0
  110. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_ml30/namespaces.py +0 -0
  111. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_ml30/reader.py +0 -0
  112. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_ml30/writer.py +0 -0
  113. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_ml31/EGM.md +0 -0
  114. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_ml31/__init__.py +0 -0
  115. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_ml31/namespaces.py +0 -0
  116. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_ml31/reader.py +0 -0
  117. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/formats/sdmx_ml31/writer.py +0 -0
  118. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/inventory/__init__.py +0 -0
  119. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/inventory/_reader.py +0 -0
  120. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/inventory/_routing.py +0 -0
  121. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/inventory/_rules.py +0 -0
  122. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/inventory/schemas/catalog-2.0.schema.json +0 -0
  123. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/inventory/schemas/catalog.schema.json +0 -0
  124. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/inventory/schemas/current.schema.json +0 -0
  125. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/inventory/schemas/history.schema.json +0 -0
  126. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/inventory/schemas/root-1.2.schema.json +0 -0
  127. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/inventory/schemas/root.schema.json +0 -0
  128. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/inventory/schemas/segment-header.schema.json +0 -0
  129. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/inventory/schemas/segment-line.schema.json +0 -0
  130. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/local/__init__.py +0 -0
  131. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/local/_scan.py +0 -0
  132. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/local/engine.py +0 -0
  133. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/local/object_store.py +0 -0
  134. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/local/sql.py +0 -0
  135. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/_binding.py +0 -0
  136. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/_container.py +0 -0
  137. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/_invariants.py +0 -0
  138. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/_items.py +0 -0
  139. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/_label_match.py +0 -0
  140. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/_rebind.py +0 -0
  141. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/_referenceable.py +0 -0
  142. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/_refshape.py +0 -0
  143. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/_resolvers.py +0 -0
  144. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/_rules.py +0 -0
  145. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/_tree.py +0 -0
  146. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/annotations.py +0 -0
  147. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/base.py +0 -0
  148. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/binding.py +0 -0
  149. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/category.py +0 -0
  150. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/codelist.py +0 -0
  151. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/collections.py +0 -0
  152. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/concept.py +0 -0
  153. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/constraint.py +0 -0
  154. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/convert.py +0 -0
  155. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/dataflow.py +0 -0
  156. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/datastructure.py +0 -0
  157. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/errors.py +0 -0
  158. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/expr.py +0 -0
  159. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/header.py +0 -0
  160. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/hierarchy.py +0 -0
  161. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/in_memory_registry.py +0 -0
  162. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/istring.py +0 -0
  163. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/link.py +0 -0
  164. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/mapping.py +0 -0
  165. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/message.py +0 -0
  166. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/metadata_provision.py +0 -0
  167. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/metadataflow.py +0 -0
  168. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/metadataset.py +0 -0
  169. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/metadatastructure.py +0 -0
  170. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/organisation.py +0 -0
  171. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/provision.py +0 -0
  172. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/ref.py +0 -0
  173. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/registry.py +0 -0
  174. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/representation.py +0 -0
  175. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/rest_api.py +0 -0
  176. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/rollup.py +0 -0
  177. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/urn.py +0 -0
  178. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/validation.py +0 -0
  179. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/valuelist.py +0 -0
  180. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/version.py +0 -0
  181. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/model/version_rewrite.py +0 -0
  182. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/polars.py +0 -0
  183. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/py.typed +0 -0
  184. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/query/EGM.md +0 -0
  185. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/query/__init__.py +0 -0
  186. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/query/_closure.py +0 -0
  187. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/query/_common.py +0 -0
  188. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/query/_compile.py +0 -0
  189. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/query/_edges.py +0 -0
  190. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/query/_execute.py +0 -0
  191. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/query/_expr.py +0 -0
  192. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/query/_joins.py +0 -0
  193. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/query/_plan.py +0 -0
  194. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/query/_pushdown.py +0 -0
  195. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/query/_rebase.py +0 -0
  196. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/query/_rest.py +0 -0
  197. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/query/accessors.py +0 -0
  198. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/query/observations.py +0 -0
  199. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/query/query.py +0 -0
  200. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/query/raw.py +0 -0
  201. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/query/schema.py +0 -0
  202. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/rest.py +0 -0
  203. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/session.py +0 -0
  204. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/sql.py +0 -0
  205. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/storage/__init__.py +0 -0
  206. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/storage/_checked.py +0 -0
  207. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/storage/_columns.py +0 -0
  208. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/storage/_files.py +0 -0
  209. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/storage/_kinds.py +0 -0
  210. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/storage/_layout.py +0 -0
  211. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/storage/_parsed.py +0 -0
  212. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/storage/_projections.py +0 -0
  213. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/storage/_references.py +0 -0
  214. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/storage/_synthetic.py +0 -0
  215. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/storage/_tags.py +0 -0
  216. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/storage/_trim.py +0 -0
  217. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/storage/lazy.py +0 -0
  218. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/storage/readers.py +0 -0
  219. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/storage/resolve.py +0 -0
  220. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/storage/schema.py +0 -0
  221. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/storage/writers.py +0 -0
  222. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/testing.py +0 -0
  223. {sdmxlib-0.87.0 → sdmxlib-0.89.0}/src/sdmxlib/versions.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sdmxlib
3
- Version: 0.87.0
3
+ Version: 0.89.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.87.0"
3
+ version = "0.89.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.87.0"
3
+ version = "0.89.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"
@@ -176,6 +176,8 @@ from sdmxlib.model import (
176
176
  SourceValue,
177
177
  item,
178
178
  normalize_tag,
179
+ period_bounds,
180
+ period_range,
179
181
  tag_alias,
180
182
  Maintainable,
181
183
  MaintainableArtefact,
@@ -456,6 +458,8 @@ __all__ = [
456
458
  "normalize_tag",
457
459
  "parse",
458
460
  "parse_components",
461
+ "period_bounds",
462
+ "period_range",
459
463
  "q",
460
464
  "read",
461
465
  "schema",
@@ -11,15 +11,16 @@ output.
11
11
  ## Interface
12
12
 
13
13
  - `build_dataflow_constraint(registry, dataflow_urn, *, name, conn=None,
14
- constraint_id=None, version="1.0")` (`contentconstraint.py`): runs a
15
- `SELECT DISTINCT` for each bound dimension and returns one inclusive
16
- CubeRegion `DataConstraint` of type ACTUAL.
14
+ constraint_id=None, version="1.0", time_dimension="range" | "values")`
15
+ (`contentconstraint.py`): runs a `SELECT DISTINCT` for each bound dimension
16
+ and returns one inclusive CubeRegion `DataConstraint` of type ACTUAL.
17
17
  - `build_component_availability(registry, dataflow_urn, *, name, key,
18
- component_id, api, mode="exact" | "available", conn=None, ...)`
19
- (`contentconstraint.py`): the availability of one component for a key, in
20
- the given mode. `component_id="all"` covers every bound dimension. A
21
- dimension comes back as a `KeyValue` and an attribute as a
22
- `ComponentValueSet` in the one CubeRegion.
18
+ component_id, api, mode="exact" | "available", conn=None, ...,
19
+ time_dimension="range" | "values")` (`contentconstraint.py`): the
20
+ availability of one component for a key, in the given mode.
21
+ `component_id="all"` covers every bound dimension. A dimension comes back
22
+ as a `KeyValue` and an attribute as a `ComponentValueSet` in the one
23
+ CubeRegion.
23
24
  - `build_dsd_metadata_map(registry, *, conn=None)` (`metadata_annotation.py`):
24
25
  maps each DSD URN to a list of `DsdMetadataLink`. The links combine the
25
26
  targets of populated MetadataSets with those declared by Metadataflows and
@@ -36,6 +37,13 @@ output.
36
37
 
37
38
  ## Invariants
38
39
 
40
+ - With `time_dimension="range"`, the default, both builders give the DSD's
41
+ time dimension as a `KeyValue` whose `TimeRange` runs from the earliest
42
+ period's start to the latest period's end, both inclusive and zoneless
43
+ (`sdmxlib.model.period.period_range`). The time dimension keeps its values
44
+ when `"values"` is asked for, when a period does not parse, when it holds
45
+ no periods, and when the registry holds no DSD for the dataflow.
46
+
39
47
  - `annotate_structure_message` is idempotent and leaves its input unchanged.
40
48
  It builds new DSDs with `attrs.evolve`, keeps existing annotations in order,
41
49
  and returns the input message as is when the map is empty or no DSD gains
@@ -3,7 +3,8 @@
3
3
  `build_dataflow_constraint` scans the observation table bound to a
4
4
  dataflow and emits a `DataConstraint` (the SDMX-3 spelling of the 2.1
5
5
  ContentConstraint) whose single inclusive `CubeRegion` lists each
6
- dimension's distinct lake values. This is the framework-free core of the
6
+ dimension's distinct lake values, and gives the time dimension as the
7
+ `TimeRange` those values cover. This is the framework-free core of the
7
8
  SDMX REST ``/availability`` response for ``context=dataflow``,
8
9
  ``componentID=all`` — no HTTP layer, no async.
9
10
 
@@ -45,6 +46,7 @@ from sdmxlib.model.constraint import (
45
46
  from sdmxlib.model.dataflow import Dataflow
46
47
  from sdmxlib.model.datastructure import DataStructure
47
48
  from sdmxlib.model.istring import InternationalString
49
+ from sdmxlib.model.period import period_range
48
50
  from sdmxlib.model.ref import Ref
49
51
  from sdmxlib.model.rest_api import ApiVersion
50
52
  from sdmxlib.model.urn import SdmxUrn
@@ -59,6 +61,7 @@ def build_dataflow_constraint(
59
61
  conn: duckdb.DuckDBPyConnection | None = None,
60
62
  constraint_id: str | None = None,
61
63
  version: str = "1.0",
64
+ time_dimension: Literal["range", "values"] = "range",
62
65
  ) -> DataConstraint:
63
66
  """Synthesise the dataflow's availability ContentConstraint from the lake.
64
67
 
@@ -68,6 +71,15 @@ def build_dataflow_constraint(
68
71
  `CubeRegion` describing what is *actually* present
69
72
  (`ConstraintType.ACTUAL`).
70
73
 
74
+ The DSD's time dimension is given as a `TimeRange` by default, from the
75
+ earliest period's start to the latest period's end, both inclusive
76
+ (`period_range`): the .Stat Suite Data Explorer reads a time
77
+ dimension's availability only from a range. Gaps between periods are
78
+ not recorded. The time dimension keeps its list of periods when
79
+ ``time_dimension="values"``, when any period is one `period_bounds`
80
+ cannot read (a date-time, a ``<start>/<duration>`` interval), when it
81
+ holds no periods, and when the registry holds no DSD for the dataflow.
82
+
71
83
  The dimension set and physical column names come from the binding's
72
84
  ``dimension_column_map`` — the binding is the authoritative record of
73
85
  what columns the materialised table actually has, which is exactly the
@@ -86,17 +98,21 @@ def build_dataflow_constraint(
86
98
  dataflow id. Override for byte-compatibility with an existing
87
99
  consumer's naming scheme.
88
100
  version: Version for the emitted constraint. Defaults to ``"1.0"``.
101
+ time_dimension: ``"range"`` gives the time dimension as a
102
+ `TimeRange`; ``"values"`` gives its distinct periods.
89
103
 
90
104
  Returns:
91
105
  A `DataConstraint` of type ``ACTUAL`` attached to the dataflow,
92
106
  carrying one inclusive `CubeRegion` of per-dimension distinct
93
- values.
107
+ values, with the time dimension's as a range.
94
108
 
95
109
  Raises:
96
110
  KeyError: If no `DataflowBinding` exists for ``dataflow_urn``.
111
+ ValueError: If ``time_dimension`` is neither ``"range"`` nor ``"values"``.
97
112
  TypeError: If ``conn`` is omitted and the registry cannot
98
113
  not expose a DuckDB ``connection``.
99
114
  """
115
+ _check_time_dimension(time_dimension)
100
116
  binding = registry.binding_for(dataflow_urn)
101
117
  if binding is None:
102
118
  err = (
@@ -115,12 +131,13 @@ def build_dataflow_constraint(
115
131
  )
116
132
  raise TypeError(err)
117
133
 
134
+ time_id = _time_dimension_id(registry, dataflow_urn) if time_dimension == "range" else None
118
135
  table = located(binding.database_role, binding.table_location)
119
136
  key_values: list[KeyValue] = []
120
137
  for dim_id in sorted(binding.dimension_column_map):
121
138
  column = binding.dimension_column_map[dim_id]
122
139
  values = _distinct_values(conn, table, column)
123
- key_values.append(KeyValue(dimension_id=dim_id, values=frozenset(values)))
140
+ key_values.append(_key_value(dim_id, frozenset(values), time_id))
124
141
 
125
142
  region = CubeRegion(include=True, keys=tuple(key_values))
126
143
  attachment = ConstraintAttachment(dataflows=(Ref[Dataflow].unresolved(dataflow_urn),))
@@ -147,6 +164,7 @@ def build_component_availability(
147
164
  conn: duckdb.DuckDBPyConnection | None = None,
148
165
  constraint_id: str | None = None,
149
166
  version: str = "1.0",
167
+ time_dimension: Literal["range", "values"] = "range",
150
168
  ) -> DataConstraint:
151
169
  """Synthesise the per-component availability slice for ``(key, component_id, mode)``.
152
170
 
@@ -188,6 +206,12 @@ def build_component_availability(
188
206
  ``C``'s own constraint **dropped**, i.e. the values that would still
189
207
  leave the cube non-empty if added to the key.
190
208
 
209
+ The DSD's time dimension is given as a `TimeRange` by default, as in
210
+ `build_dataflow_constraint`, and under the same rules: it keeps its list
211
+ of periods when ``time_dimension="values"``, when any period is one
212
+ `period_bounds` cannot read, when it holds no periods, and when the
213
+ registry holds no DSD for the dataflow.
214
+
191
215
  Args:
192
216
  registry: An open registry: a published `EditionRegistry` or a `LocalRegistry`.
193
217
  dataflow_urn: URN of the dataflow to describe.
@@ -211,6 +235,8 @@ def build_component_availability(
211
235
  constraint_id: Id for the emitted constraint. Defaults to the
212
236
  dataflow id.
213
237
  version: Version for the emitted constraint. Defaults to ``"1.0"``.
238
+ time_dimension: ``"range"`` gives the time dimension as a
239
+ `TimeRange`; ``"values"`` gives its distinct periods.
214
240
 
215
241
  Returns:
216
242
  A `DataConstraint` of type ``ACTUAL`` attached to the dataflow,
@@ -221,14 +247,16 @@ def build_component_availability(
221
247
  Raises:
222
248
  KeyError: If no `DataflowBinding` exists, or ``component_id`` (when
223
249
  not ``"all"``) is not a column on the bound table.
224
- ValueError: If ``mode`` is unrecognised, or the dotted ``key`` has a
225
- segment count that does not match the DSD's key dimensions.
250
+ ValueError: If ``mode`` or ``time_dimension`` is unrecognised, or the
251
+ dotted ``key`` has a segment count that does not match the DSD's
252
+ key dimensions.
226
253
  TypeError: If ``conn`` is omitted and the registry cannot
227
254
  not expose a DuckDB ``connection``.
228
255
  """
229
256
  if mode not in ("exact", "available"):
230
257
  err = f"Unrecognised mode {mode!r}; expected 'exact' or 'available'."
231
258
  raise ValueError(err)
259
+ _check_time_dimension(time_dimension)
232
260
 
233
261
  binding = registry.binding_for(dataflow_urn)
234
262
  if binding is None:
@@ -261,6 +289,7 @@ def build_component_availability(
261
289
  held = _held_values(registry, dataflow_urn)
262
290
  component_filter = _drop_covering(component_filter, held)
263
291
 
292
+ time_id = _time_dimension_id(registry, dataflow_urn) if time_dimension == "range" else None
264
293
  table = located(binding.database_role, binding.table_location)
265
294
  key_values: list[KeyValue] = []
266
295
  components: list[ComponentValueSet] = []
@@ -279,7 +308,7 @@ def build_component_availability(
279
308
  # value sets (2.1 `Attribute`, 3.x `Component`). Both were keys until
280
309
  # #433 gave components a field, so an attribute read as a dimension.
281
310
  if target in binding.dimension_column_map:
282
- key_values.append(KeyValue(dimension_id=target, values=values))
311
+ key_values.append(_key_value(target, values, time_id))
283
312
  else:
284
313
  components.append(ComponentValueSet(component_id=target, values=values))
285
314
 
@@ -316,6 +345,42 @@ def _resolve_key_slot_ids(registry: EditionRegistry, dataflow_urn: SdmxUrn[Dataf
316
345
  return dsd.key_slot_ids(api)
317
346
 
318
347
 
348
+ def _check_time_dimension(time_dimension: str) -> None:
349
+ """Refuse a ``time_dimension`` other than ``"range"`` or ``"values"``.
350
+
351
+ Raises:
352
+ ValueError: If ``time_dimension`` is unrecognised.
353
+ """
354
+ if time_dimension not in ("range", "values"):
355
+ err = f"Unrecognised time_dimension {time_dimension!r}; expected 'range' or 'values'."
356
+ raise ValueError(err)
357
+
358
+
359
+ def _time_dimension_id(registry: EditionRegistry, dataflow_urn: SdmxUrn[Dataflow]) -> str | None:
360
+ """The id of the dataflow's DSD's time dimension; None without a DSD in the registry or a time dimension in it."""
361
+ flow = registry.get(dataflow_urn)
362
+ structure = flow.structure if isinstance(flow, Dataflow) else None
363
+ if not isinstance(structure, Ref):
364
+ return None
365
+ dsd = registry.get(structure.urn)
366
+ if not isinstance(dsd, DataStructure) or dsd.time_dimension is None:
367
+ return None
368
+ return dsd.time_dimension.id
369
+
370
+
371
+ def _key_value(dimension_id: str, values: frozenset[str], time_id: str | None) -> KeyValue:
372
+ """One dimension's `KeyValue`: the `TimeRange` its periods cover for the time dimension, else its values.
373
+
374
+ The time dimension keeps its values when `period_range` gives no range:
375
+ it holds no periods, or a period whose bounds cannot be read.
376
+ """
377
+ if dimension_id == time_id:
378
+ time_range = period_range(values)
379
+ if time_range is not None:
380
+ return KeyValue(dimension_id=dimension_id, time_range=time_range)
381
+ return KeyValue(dimension_id=dimension_id, values=values)
382
+
383
+
319
384
  def _component_column(binding: DataflowBinding, component_id: str) -> str:
320
385
  """Physical column for ``component_id`` — dimension first, then attribute."""
321
386
  column = binding.dimension_column_map.get(component_id) or binding.attribute_column_map.get(component_id)
@@ -26,15 +26,19 @@ seals through `seal(extensions=...)`.
26
26
  inventory, the data files DuckLake references, and each file's placement
27
27
  tier (by longest prefix match).
28
28
  - `settle_lake` (`_write.py`): flushes inlined data and rewrites delete files.
29
- For a final edition it also merges adjacent files, and on request it
30
- expires snapshots.
29
+ For a final edition it also merges adjacent files smaller than the lake's
30
+ `target_file_size`, and on request it expires snapshots.
31
31
  - `check_edition` (`_check.py`): checks an edition against its manifest under the
32
32
  profile `at="publish"`, `"receive"` or `"open"` and returns a `Report`.
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
36
  `open`, `remote=` at `publish`, `lookup=` outside `receive`,
37
- `fingerprints=True` at `open`) raises `ValueError`. `fingerprints=None`
37
+ `fingerprints=True` at `open`) raises `ValueError`. `tiers=` names the
38
+ placement tiers held on local disk, at every profile: the `files` check
39
+ reports a missing file only when its tier is in `tiers`, and checks a
40
+ present file whatever its tier (GH-384). The `remote`, `lake` and
41
+ `bindings` checks ignore `tiers`, and an extension check is not told it. `fingerprints=None`
38
42
  (the default) recomputes the fingerprints at `publish` only;
39
43
  `fingerprints=True` adds them at `receive`, and `fingerprints=False` skips
40
44
  them at `publish`, for the process that sealed the edition, right after
@@ -53,7 +57,8 @@ seals through `seal(extensions=...)`.
53
57
  for this `(product_id, edition id, manifest sha256)` it runs `receive` and writes
54
58
  the stamp when the report is clean; with one it runs `open`. An unreadable
55
59
  manifest, or a `product_id` that cannot name a stamp path, gets a `receive`
56
- check and no stamp. `references=False` goes to its `receive` calls only.
60
+ check and no stamp. `references=False` goes to its `receive` calls only,
61
+ and `tiers=` to both profiles.
57
62
  - `copy_edition` and `edition_files` (`_copy.py`): copy the files of the chosen
58
63
  tiers and verify each one, and list the paths such a copy needs.
59
64
  - `verify_remote`, `RemoteFile`, `content_md5` and `content_crc32c`
@@ -93,7 +98,8 @@ seals through `seal(extensions=...)`.
93
98
  its availability and for coded-column values outside their enumeration.
94
99
  `seal` and `check_edition(at="publish")` both call it.
95
100
  - Manifest types, re-exported from `storage._manifest`: `read_manifest`,
96
- `decode_manifest` (the same read from bytes, naming `source` in its errors),
101
+ `decode_manifest` (the same read from bytes, naming `source` in its errors;
102
+ both refuse a path that could name a file outside the product, GH-380),
97
103
  `Manifest`, `Producer`, `Provenance`, `EditionFile`, `ArtefactEntry`,
98
104
  `BindingCount`, `Tier`, `ManifestError`, `StoreFormatError`, and the
99
105
  constants `DATA_PATH`, `MANIFEST_NAME`, `SIGNATURE_NAME`, `FORMAT_VERSION`
@@ -128,6 +134,9 @@ seals through `seal(extensions=...)`.
128
134
  names: the manifest, its signature, and a staged manifest a crash left.
129
135
  - Data files are always tier 3. `metadata.duckdb` and `tables.ducklake` default to
130
136
  tier 1, and other files to tier 2.
137
+ - `copy_edition` and `check_edition` read and write no listed file for a
138
+ manifest `decode_manifest` refuses: an unsafe `files` path or a
139
+ `data_path` outside the product raises `ManifestError` first.
131
140
  - `copy_edition` skips a `data/` file already present with the same size and
132
141
  digest, raises when a copied file does not match, and refuses a destination
133
142
  that is already sealed. Every file it copied is fsynced before the manifest
@@ -138,6 +147,13 @@ seals through `seal(extensions=...)`.
138
147
  `references`. A `references=False` call accepts either stamp. A full call
139
148
  that meets a deferred stamp runs `receive`, and replaces the stamp when that
140
149
  finds nothing.
150
+ - A stamp records the tiers its check covered, as `tiers`, and satisfies a
151
+ call only when it records every tier in the call's `tiers` (GH-384). A
152
+ stamp without `tiers`, as releases through 0.88 wrote, records every tier. A
153
+ clean `receive` writes the call's tiers and the tiers of the same-manifest
154
+ stamp it replaces; its `checked` is the new report's alone, so a
155
+ `references=False` call that needs more tiers than a full stamp records
156
+ leaves a deferred stamp.
141
157
  - `settle_lake` never deletes files from `data/`.
142
158
  - `check_edition`'s `tags` check, at `publish` and `receive`, reports every
143
159
  stored language tag `normalize_tag` would change or refuse: a store built
@@ -9,11 +9,15 @@ read them where the registry does (GH-180). ``open`` runs each time a server ope
9
9
  only. `check_on_open` runs ``receive`` once per edition id and manifest, records
10
10
  a stamp, and runs ``open`` after that. Each check names what it found rather
11
11
  than stopping at the first, so one run lists everything wrong.
12
+
13
+ A server that holds part of an edition names the placement tiers it holds in
14
+ ``tiers=``, and the ``files`` check then accepts the absence of a file of any
15
+ other tier (GH-384). A stamp records the tiers its ``receive`` check covered.
12
16
  """
13
17
 
14
18
  import hashlib
15
19
  import json
16
- from collections.abc import Callable, Iterable, Mapping, Sequence
20
+ from collections.abc import Callable, Collection, Iterable, Mapping, Sequence
17
21
  from contextlib import ExitStack
18
22
  from datetime import UTC, datetime
19
23
  from functools import partial
@@ -42,6 +46,7 @@ from sdmxlib.storage._manifest import (
42
46
  Manifest,
43
47
  ManifestError,
44
48
  StoreFormatError,
49
+ Tier,
45
50
  read_manifest,
46
51
  unlisted,
47
52
  )
@@ -60,6 +65,9 @@ type Check = Callable[[Path, Manifest, EditionRegistry, Profile], Iterable[Findi
60
65
  #: A blob store's report of one file, as `verify_remote` takes it.
61
66
  type Lookup = Callable[[EditionFile], RemoteFile | None]
62
67
 
68
+ #: Every placement tier, in the order a stamp lists them.
69
+ _TIERS: tuple[Tier, ...] = ("required", "lazy", "remote")
70
+
63
71
 
64
72
  @frozen
65
73
  class Report:
@@ -95,6 +103,7 @@ def check_edition(
95
103
  expect: Manifest | str | Path | None = None,
96
104
  structures: str | Path | Sequence[str | Path] | None = None,
97
105
  references: bool = True,
106
+ tiers: Collection[Tier] = ("required", "lazy", "remote"),
98
107
  extensions: Mapping[str, Check] | None = None,
99
108
  ) -> Report:
100
109
  """Check a sealed edition against its manifest and against itself, as profile `at` asks.
@@ -124,6 +133,18 @@ def check_edition(
124
133
  through `engine`, and without a `lookup` the ``remote`` check sizes each
125
134
  listed one there.
126
135
 
136
+ `tiers` names the placement tiers the caller holds on local disk, as
137
+ `copy_edition` and `edition_files` take it. The ``files`` check reports a
138
+ missing file only when its tier is in `tiers`. A file that is present is
139
+ checked as the profile asks whatever its tier, and an unlisted file is
140
+ reported as before. `tiers` and `remote` are independent. `remote` and
141
+ `lookup` say where the data files are read and checked, and with either
142
+ the ``files`` check skips ``data/`` whatever `tiers` holds. The
143
+ ``remote``, ``lake`` and ``bindings`` checks cover every data file
144
+ whatever `tiers` holds, since they read the data where the registry reads
145
+ it. A server that pulled the required tier and reads its data from object
146
+ storage passes ``remote=`` and ``tiers=("required",)``.
147
+
127
148
  A manifest that cannot be read, or a store on another schema version or in
128
149
  a DuckDB or DuckLake format this engine cannot read, ends the run there:
129
150
  nothing after it can be checked against either.
@@ -179,8 +200,13 @@ def check_edition(
179
200
  them. `structures` then still runs the ``partials`` check. An
180
201
  edition with bindings is allowed, and its references go unchecked
181
202
  too.
203
+ tiers: The placement tiers held on local disk. A manifest entry of
204
+ another tier is not reported when its file is missing. The
205
+ default holds every tier, so every missing file is a finding.
182
206
  extensions: More checks, by name, for parts of the edition other
183
- packages own (statcatlib's search index, say).
207
+ packages own (statcatlib's search index, say). An extension
208
+ check is not told `tiers`: pass an extension that reads the files
209
+ of a tier only in a call whose `tiers` holds that tier.
184
210
 
185
211
  Returns:
186
212
  What was checked and what was found.
@@ -200,7 +226,7 @@ def check_edition(
200
226
  manifest = read_manifest(root)
201
227
  except ManifestError as exc:
202
228
  return Report(root, at, tuple(checked), (Finding("manifest", MANIFEST_NAME, str(exc)),))
203
- findings = list(_files(root, manifest, at, remote=lookup is not None or remote is not None))
229
+ findings = list(_files(root, manifest, at, remote=lookup is not None or remote is not None, tiers=tiers))
204
230
  checked.append("files")
205
231
  if expect is not None:
206
232
  try:
@@ -329,6 +355,7 @@ def check_on_open(
329
355
  engine: EditionEngine | None = None,
330
356
  lookup: Lookup | None = None,
331
357
  references: bool = True,
358
+ tiers: Collection[Tier] = ("required", "lazy", "remote"),
332
359
  extensions: Mapping[str, Check] | None = None,
333
360
  ) -> Report:
334
361
  """Check an edition as a server opens it: ``receive`` once per edition id and manifest, ``open`` after.
@@ -345,6 +372,21 @@ def check_on_open(
345
372
  replaces the stamp when that finds nothing. A stamp that a deferring call
346
373
  wrote stays in place when that ``receive`` finds something.
347
374
 
375
+ A stamp also records the tiers its check covered, and satisfies a call
376
+ only when it records every tier in the call's `tiers`. A server pulls the
377
+ required tier, calls with ``tiers=("required",)`` and reports ready. Once
378
+ it has pulled the lazy tier it calls with ``tiers=("required", "lazy")``:
379
+ the stamp records the required tier alone, so ``receive`` runs again and
380
+ hashes the files pulled since. A clean ``receive`` writes a stamp
381
+ recording the call's tiers and the tiers of the stamp it replaces, when
382
+ that stamp is for the same manifest. A ``receive`` check hashes every
383
+ listed edition file that is present, so the earlier tiers stay verified,
384
+ and the ``open`` profile reports a file that has gone missing since. A
385
+ stamp without recorded tiers, as releases through 0.88 wrote, records every
386
+ tier. Those releases ignore the recorded tiers, so they read a stamp for
387
+ the required tier as a stamp for the whole edition: clear the stamps
388
+ directory when moving a server back to one.
389
+
348
390
  Args:
349
391
  path: The edition directory.
350
392
  stamps: The directory holding the stamps, outside every edition: local
@@ -354,6 +396,7 @@ def check_on_open(
354
396
  lookup: As `check_edition`'s, for the receive check.
355
397
  references: As `check_edition`'s, for the receive check. The ``open``
356
398
  profile never runs that check.
399
+ tiers: As `check_edition`'s, for either profile.
357
400
  extensions: As `check_edition`'s, for either profile.
358
401
 
359
402
  Returns:
@@ -368,6 +411,7 @@ def check_on_open(
368
411
  engine=engine,
369
412
  lookup=lookup,
370
413
  references=references,
414
+ tiers=tiers,
371
415
  extensions=extensions,
372
416
  )
373
417
  try:
@@ -380,11 +424,13 @@ def check_on_open(
380
424
  report = receive()
381
425
  detail = f"product_id {manifest.product_id!r} cannot name a stamp directory, so the check is not stamped"
382
426
  return attrs.evolve(report, findings=(*report.findings, Finding("manifest", MANIFEST_NAME, detail)))
383
- if _stamped(stamp, digest, references=references):
384
- return check_edition(root, at="open", remote=remote, engine=engine, extensions=extensions)
427
+ recorded = _recorded(stamp, digest)
428
+ held = _stamped_tiers(recorded)
429
+ if recorded is not None and held.issuperset(tiers) and (not references or _lists_references(recorded)):
430
+ return check_edition(root, at="open", remote=remote, engine=engine, tiers=tiers, extensions=extensions)
385
431
  report = receive()
386
432
  if report.ok:
387
- _write_stamp(stamp, digest, report)
433
+ _write_stamp(stamp, digest, report, held.union(tiers))
388
434
  return report
389
435
 
390
436
 
@@ -397,35 +443,49 @@ def _names_a_file_under(stamp: Path, stamps: Path) -> bool:
397
443
  return len(parts) == 2 and all(part not in {".", ".."} for part in parts)
398
444
 
399
445
 
400
- def _stamped(stamp: Path, digest: str, *, references: bool) -> bool:
401
- """Whether `stamp` records a clean receive check of the manifest with sha256 `digest`.
402
-
403
- When `references` is true, the recorded check must also list ``references``.
404
- """
446
+ def _recorded(stamp: Path, digest: str) -> dict[str, object] | None:
447
+ """The record `stamp` holds, when it is of a clean receive check of the manifest with sha256 `digest`."""
405
448
  try:
406
449
  recorded = json.loads(stamp.read_text())
407
450
  except OSError, ValueError:
408
- return False
451
+ return None
409
452
  if not isinstance(recorded, dict) or recorded.get("manifest_sha256") != digest:
410
- return False
411
- if not references:
412
- return True
453
+ return None
454
+ return {str(key): value for key, value in recorded.items()}
455
+
456
+
457
+ def _lists_references(recorded: Mapping[str, object]) -> bool:
458
+ """Whether the stamp's recorded checks list ``references``."""
413
459
  checked = recorded.get("checked")
414
460
  return isinstance(checked, list) and "references" in checked
415
461
 
416
462
 
417
- def _write_stamp(stamp: Path, digest: str, report: Report) -> None:
418
- """Record `report` under `stamp`, whole or not at all, replacing any stamp there."""
463
+ def _stamped_tiers(recorded: Mapping[str, object] | None) -> frozenset[str]:
464
+ """The tiers a stamp's check covered: every tier for a stamp that records none, as releases through 0.88 wrote."""
465
+ if recorded is None:
466
+ return frozenset()
467
+ if "tiers" not in recorded:
468
+ return frozenset(_TIERS)
469
+ tiers = recorded["tiers"]
470
+ if not isinstance(tiers, list):
471
+ return frozenset()
472
+ return frozenset(tier for tier in tiers if isinstance(tier, str))
473
+
474
+
475
+ def _write_stamp(stamp: Path, digest: str, report: Report, tiers: Collection[str]) -> None:
476
+ """Record `report` and the `tiers` it covers under `stamp`, whole or not at all, replacing any stamp there."""
419
477
  record = {
420
478
  "manifest_sha256": digest,
421
479
  "at": report.at,
422
480
  "checked": list(report.checked),
481
+ "tiers": [tier for tier in _TIERS if tier in tiers],
423
482
  "verified_at": datetime.now(UTC).isoformat(),
424
483
  }
425
484
  replace_durably(stamp, json.dumps(record, indent=2).encode())
426
485
 
427
486
 
428
- def _files(root: Path, manifest: Manifest, at: Profile, *, remote: bool) -> Iterable[Finding]:
487
+ def _files(root: Path, manifest: Manifest, at: Profile, *, remote: bool, tiers: Collection[Tier]) -> Iterable[Finding]:
488
+ """What the ``files`` check finds; a missing file is reported only when its tier is in `tiers`."""
429
489
  on_disk = {
430
490
  p.relative_to(root).as_posix(): p
431
491
  for p in sorted(root.rglob("*"))
@@ -443,12 +503,10 @@ def _files(root: Path, manifest: Manifest, at: Profile, *, remote: bool) -> Iter
443
503
  subject = entry.path
444
504
  found = on_disk.pop(entry.path, None)
445
505
  hashed = at != "open"
446
- if found is None:
506
+ if found is not None:
507
+ yield from _listed_file(entry, subject, found, hashed=hashed)
508
+ elif entry.tier in tiers:
447
509
  yield Finding("files", subject, "listed in the manifest but missing")
448
- elif (size := found.stat().st_size) != entry.size:
449
- yield Finding("files", subject, f"{size} bytes, the manifest says {entry.size}")
450
- elif hashed and (differs := differing(entry, digests_of(found))):
451
- yield Finding("files", subject, f"contents differ from the manifest's {', '.join(differs)}")
452
510
  if at == "open":
453
511
  return
454
512
  for extra in on_disk:
@@ -460,6 +518,14 @@ def _files(root: Path, manifest: Manifest, at: Profile, *, remote: bool) -> Iter
460
518
  yield Finding("files", extra, "in the edition but not in the manifest")
461
519
 
462
520
 
521
+ def _listed_file(entry: EditionFile, subject: str, found: Path, *, hashed: bool) -> Iterable[Finding]:
522
+ """How the file `found` differs from its manifest `entry`: by size, or when `hashed`, by digest."""
523
+ if (size := found.stat().st_size) != entry.size:
524
+ yield Finding("files", subject, f"{size} bytes, the manifest says {entry.size}")
525
+ elif hashed and (differs := differing(entry, digests_of(found))):
526
+ yield Finding("files", subject, f"contents differ from the manifest's {', '.join(differs)}")
527
+
528
+
463
529
  def _fingerprints(root: Path, manifest: Manifest, opened: EditionRegistry) -> list[Finding]:
464
530
  """The fingerprints recomputed, against the manifest's.
465
531
 
@@ -50,7 +50,8 @@ def copy_edition(
50
50
  `tiers` limits the copy to the files of those placement tiers: a server
51
51
  pulls tiers 1 and 2 and reads tier 3 remotely, so ``tiers=("required", "lazy")`` is what
52
52
  it holds. A copy without every tier is incomplete by intent, and
53
- `check_edition` reports the files it left out.
53
+ `check_edition` reports the files it left out unless it is given the same
54
+ `tiers`.
54
55
 
55
56
  Args:
56
57
  source: A sealed edition directory.
@@ -309,10 +309,6 @@ def artefact_entries(
309
309
  return tuple(entries)
310
310
 
311
311
 
312
- #: Larger than any data file, so a merge leaves one file per table.
313
- _ONE_FILE = 1 << 62
314
-
315
-
316
312
  def settle_lake(
317
313
  conn: duckdb.DuckDBPyConnection,
318
314
  *,
@@ -326,10 +322,15 @@ def settle_lake(
326
322
  (``delete_threshold => 0``: DuckLake's default skips a table whose
327
323
  deleted rows are few, which is exactly a daily delta), so no delete file
328
324
  ships and every edition reads its rows from data files alone.
329
- - A ``final`` edition's tables have their files merged: nothing will
330
- be appended. DuckLake sorts what it merges by a table's ``SORTED BY``,
331
- which the producer sets (`write_observations`' ``sorted_by``); this sets
332
- no sort of its own.
325
+ - A ``final`` edition's tables have their adjacent small files merged:
326
+ nothing will be appended. The lake's ``target_file_size`` (DuckLake's
327
+ default is 512 MB) decides which files merge: adjacent files smaller
328
+ than it are merged together, and a file DuckLake wrote at that size
329
+ stays as written. A table under the target size ends in one file, or one per
330
+ partition; a larger table keeps about one file per target size (design
331
+ §4.5 says why). DuckLake sorts what it merges by a table's
332
+ ``SORTED BY``, which the producer sets (`write_observations`'
333
+ ``sorted_by``); this sets no sort of its own.
333
334
  - With `expire_snapshots`, every snapshot but the current one is expired,
334
335
  so the catalog and the manifest hold only current files.
335
336
 
@@ -345,7 +346,7 @@ def settle_lake(
345
346
  conn.execute("CALL ducklake_flush_inlined_data('lake')")
346
347
  conn.execute("CALL ducklake_rewrite_data_files('lake', delete_threshold => 0)")
347
348
  if lifecycle == "final":
348
- conn.execute("CALL ducklake_merge_adjacent_files('lake', max_file_size => ?)", [_ONE_FILE])
349
+ conn.execute("CALL ducklake_merge_adjacent_files('lake')")
349
350
  if expire_snapshots:
350
351
  conn.execute("CALL ducklake_expire_snapshots('lake', older_than => now())")
351
352