taco-eo 0.6.2__tar.gz → 0.7.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. {taco_eo-0.6.2 → taco_eo-0.7.0}/.gitignore +9 -0
  2. {taco_eo-0.6.2 → taco_eo-0.7.0}/CHANGELOG.md +32 -0
  3. {taco_eo-0.6.2 → taco_eo-0.7.0}/PKG-INFO +33 -2
  4. {taco_eo-0.6.2 → taco_eo-0.7.0}/README.md +28 -0
  5. taco_eo-0.7.0/hatch_build.py +99 -0
  6. taco_eo-0.7.0/native/core/CMakeLists.txt +105 -0
  7. taco_eo-0.7.0/native/core/include/taco/taco.h +103 -0
  8. taco_eo-0.7.0/native/core/src/capi.cpp +195 -0
  9. taco_eo-0.7.0/native/core/src/cozip_index.cpp +228 -0
  10. taco_eo-0.7.0/native/core/src/cozip_index.hpp +40 -0
  11. taco_eo-0.7.0/native/core/src/dataset.cpp +502 -0
  12. taco_eo-0.7.0/native/core/src/dataset.hpp +55 -0
  13. taco_eo-0.7.0/native/core/src/error.hpp +28 -0
  14. taco_eo-0.7.0/native/core/src/json.cpp +342 -0
  15. taco_eo-0.7.0/native/core/src/json.hpp +45 -0
  16. taco_eo-0.7.0/native/core/src/manifest.cpp +186 -0
  17. taco_eo-0.7.0/native/core/src/manifest.hpp +22 -0
  18. taco_eo-0.7.0/native/core/src/paths.cpp +210 -0
  19. taco_eo-0.7.0/native/core/src/paths.hpp +52 -0
  20. taco_eo-0.7.0/native/core/src/sql.cpp +444 -0
  21. taco_eo-0.7.0/native/core/src/sql.hpp +31 -0
  22. taco_eo-0.7.0/native/core/src/transport.cpp +127 -0
  23. taco_eo-0.7.0/native/core/src/transport.hpp +32 -0
  24. taco_eo-0.7.0/native/extern/karu/CMakeLists.txt +147 -0
  25. taco_eo-0.7.0/native/extern/karu/LICENSE +21 -0
  26. taco_eo-0.7.0/native/extern/karu/VERSION +1 -0
  27. taco_eo-0.7.0/native/extern/karu/cmake/karuConfig.cmake.in +9 -0
  28. taco_eo-0.7.0/native/extern/karu/include/karu/karu.h +213 -0
  29. taco_eo-0.7.0/native/extern/karu/include/karu/karu.hpp +368 -0
  30. taco_eo-0.7.0/native/extern/karu/src/backends/aws_profile.cpp +153 -0
  31. taco_eo-0.7.0/native/extern/karu/src/backends/aws_profile.hpp +34 -0
  32. taco_eo-0.7.0/native/extern/karu/src/backends/azure.cpp +222 -0
  33. taco_eo-0.7.0/native/extern/karu/src/backends/azure_credentials.cpp +144 -0
  34. taco_eo-0.7.0/native/extern/karu/src/backends/azure_credentials.hpp +13 -0
  35. taco_eo-0.7.0/native/extern/karu/src/backends/contract.hpp +58 -0
  36. taco_eo-0.7.0/native/extern/karu/src/backends/credentials.cpp +453 -0
  37. taco_eo-0.7.0/native/extern/karu/src/backends/credentials.hpp +64 -0
  38. taco_eo-0.7.0/native/extern/karu/src/backends/crypto.cpp +44 -0
  39. taco_eo-0.7.0/native/extern/karu/src/backends/crypto.hpp +23 -0
  40. taco_eo-0.7.0/native/extern/karu/src/backends/gcs.cpp +112 -0
  41. taco_eo-0.7.0/native/extern/karu/src/backends/gcs_credentials.cpp +360 -0
  42. taco_eo-0.7.0/native/extern/karu/src/backends/gcs_credentials.hpp +13 -0
  43. taco_eo-0.7.0/native/extern/karu/src/backends/http.cpp +18 -0
  44. taco_eo-0.7.0/native/extern/karu/src/backends/hugging_face.cpp +61 -0
  45. taco_eo-0.7.0/native/extern/karu/src/backends/registry.cpp +20 -0
  46. taco_eo-0.7.0/native/extern/karu/src/backends/s3.cpp +102 -0
  47. taco_eo-0.7.0/native/extern/karu/src/backends/s3_credentials.cpp +227 -0
  48. taco_eo-0.7.0/native/extern/karu/src/backends/s3_credentials.hpp +13 -0
  49. taco_eo-0.7.0/native/extern/karu/src/backends/s3_signing.cpp +150 -0
  50. taco_eo-0.7.0/native/extern/karu/src/backends/s3_signing.hpp +34 -0
  51. taco_eo-0.7.0/native/extern/karu/src/backends/source.cpp +62 -0
  52. taco_eo-0.7.0/native/extern/karu/src/backends/source_credentials.cpp +45 -0
  53. taco_eo-0.7.0/native/extern/karu/src/backends/source_credentials.hpp +13 -0
  54. taco_eo-0.7.0/native/extern/karu/src/backends/url.cpp +106 -0
  55. taco_eo-0.7.0/native/extern/karu/src/backends/url.hpp +32 -0
  56. taco_eo-0.7.0/native/extern/karu/src/buffer.hpp +17 -0
  57. taco_eo-0.7.0/native/extern/karu/src/client.hpp +55 -0
  58. taco_eo-0.7.0/native/extern/karu/src/config.cpp +492 -0
  59. taco_eo-0.7.0/native/extern/karu/src/config.hpp +135 -0
  60. taco_eo-0.7.0/native/extern/karu/src/config_options.hpp +133 -0
  61. taco_eo-0.7.0/native/extern/karu/src/credential_cache.cpp +254 -0
  62. taco_eo-0.7.0/native/extern/karu/src/credential_cache.hpp +67 -0
  63. taco_eo-0.7.0/native/extern/karu/src/error.cpp +26 -0
  64. taco_eo-0.7.0/native/extern/karu/src/error.hpp +17 -0
  65. taco_eo-0.7.0/native/extern/karu/src/karu.cpp +536 -0
  66. taco_eo-0.7.0/native/extern/karu/src/locator.hpp +16 -0
  67. taco_eo-0.7.0/native/extern/karu/src/platform.cpp +96 -0
  68. taco_eo-0.7.0/native/extern/karu/src/platform.hpp +43 -0
  69. taco_eo-0.7.0/native/extern/karu/src/process.cpp +365 -0
  70. taco_eo-0.7.0/native/extern/karu/src/process.hpp +27 -0
  71. taco_eo-0.7.0/native/extern/karu/src/request.hpp +70 -0
  72. taco_eo-0.7.0/native/extern/karu/src/request_builder.cpp +123 -0
  73. taco_eo-0.7.0/native/extern/karu/src/request_builder.hpp +48 -0
  74. taco_eo-0.7.0/native/extern/karu/src/runtime/batch.cpp +57 -0
  75. taco_eo-0.7.0/native/extern/karu/src/runtime/batch.hpp +67 -0
  76. taco_eo-0.7.0/native/extern/karu/src/runtime/curl_types.hpp +32 -0
  77. taco_eo-0.7.0/native/extern/karu/src/runtime/deadline.hpp +51 -0
  78. taco_eo-0.7.0/native/extern/karu/src/runtime/engine.cpp +786 -0
  79. taco_eo-0.7.0/native/extern/karu/src/runtime/engine.hpp +92 -0
  80. taco_eo-0.7.0/native/extern/karu/src/runtime/http_response.cpp +194 -0
  81. taco_eo-0.7.0/native/extern/karu/src/runtime/http_response.hpp +27 -0
  82. taco_eo-0.7.0/native/extern/karu/src/runtime/planner.cpp +202 -0
  83. taco_eo-0.7.0/native/extern/karu/src/runtime/planner.hpp +25 -0
  84. taco_eo-0.7.0/native/extern/karu/src/runtime/transfer.hpp +104 -0
  85. taco_eo-0.7.0/native/extern/karu/src/runtime/transport.cpp +813 -0
  86. taco_eo-0.7.0/native/extern/karu/src/runtime/transport.hpp +43 -0
  87. taco_eo-0.7.0/native/extern/karu/src/text.hpp +50 -0
  88. taco_eo-0.7.0/native/extern/karu/src/uri.cpp +312 -0
  89. taco_eo-0.7.0/native/extern/karu/src/uri.hpp +46 -0
  90. {taco_eo-0.6.2 → taco_eo-0.7.0}/pyproject.toml +30 -7
  91. {taco_eo-0.6.2 → taco_eo-0.7.0}/taco/__init__.py +6 -5
  92. {taco_eo-0.6.2 → taco_eo-0.7.0}/taco/_repr.py +2 -2
  93. taco_eo-0.7.0/taco/container/__init__.py +5 -0
  94. taco_eo-0.6.2/taco/_view.py → taco_eo-0.7.0/taco/container/view.py +4 -4
  95. {taco_eo-0.6.2 → taco_eo-0.7.0}/taco/contract/collection.py +1 -1
  96. {taco_eo-0.6.2 → taco_eo-0.7.0}/taco/contract/contract.py +1 -1
  97. {taco_eo-0.6.2 → taco_eo-0.7.0}/taco/contract/sample.py +1 -1
  98. {taco_eo-0.6.2/taco → taco_eo-0.7.0/taco/contract}/schema.py +3 -3
  99. {taco_eo-0.6.2 → taco_eo-0.7.0}/taco/contract/structure.py +1 -1
  100. {taco_eo-0.6.2 → taco_eo-0.7.0}/taco/metadata/_base.py +1 -0
  101. {taco_eo-0.6.2 → taco_eo-0.7.0}/taco/metadata/derived.py +4 -2
  102. taco_eo-0.7.0/taco/reader/__init__.py +10 -0
  103. taco_eo-0.7.0/taco/reader/api.py +49 -0
  104. taco_eo-0.7.0/taco/reader/collection.py +47 -0
  105. taco_eo-0.7.0/taco/reader/dataset.py +40 -0
  106. taco_eo-0.7.0/taco/reader/engine.py +40 -0
  107. taco_eo-0.7.0/taco/reader/inspect.py +77 -0
  108. taco_eo-0.7.0/taco/reader/manifest.py +59 -0
  109. taco_eo-0.7.0/taco/reader/native.py +230 -0
  110. taco_eo-0.7.0/taco/reader/query.py +76 -0
  111. taco_eo-0.6.2/taco/_source.py → taco_eo-0.7.0/taco/reader/source.py +2 -16
  112. {taco_eo-0.6.2 → taco_eo-0.7.0}/taco/validate.py +4 -4
  113. taco_eo-0.7.0/taco/writer/__init__.py +6 -0
  114. taco_eo-0.6.2/taco/writer/__init__.py → taco_eo-0.7.0/taco/writer/api.py +1 -1
  115. taco_eo-0.7.0/taco/writer/archive.py +199 -0
  116. taco_eo-0.6.2/taco/writer/core.py → taco_eo-0.7.0/taco/writer/base.py +7 -4
  117. taco_eo-0.6.2/taco/tacocat.py → taco_eo-0.7.0/taco/writer/catalog.py +7 -7
  118. taco_eo-0.7.0/taco/writer/export.py +161 -0
  119. {taco_eo-0.6.2 → taco_eo-0.7.0}/taco/writer/folder.py +5 -5
  120. taco_eo-0.6.2/taco/writer/metadata_tables.py → taco_eo-0.7.0/taco/writer/metadata.py +43 -11
  121. taco_eo-0.7.0/taco/writer/partition.py +178 -0
  122. taco_eo-0.7.0/tests/test_core_reader.py +282 -0
  123. taco_eo-0.7.0/tests/test_export.py +138 -0
  124. {taco_eo-0.6.2 → taco_eo-0.7.0}/tests/test_extension_contract.py +38 -1
  125. {taco_eo-0.6.2 → taco_eo-0.7.0}/tests/test_extension_rumi.py +1 -1
  126. {taco_eo-0.6.2 → taco_eo-0.7.0}/tests/test_extension_spatiotemporal.py +1 -1
  127. {taco_eo-0.6.2 → taco_eo-0.7.0}/tests/test_metadata.py +29 -1
  128. {taco_eo-0.6.2 → taco_eo-0.7.0}/tests/test_parquet.py +1 -1
  129. {taco_eo-0.6.2 → taco_eo-0.7.0}/tests/test_publish.py +1 -1
  130. taco_eo-0.7.0/tests/test_reader.py +185 -0
  131. taco_eo-0.7.0/tests/test_reader_conformance.py +22 -0
  132. {taco_eo-0.6.2 → taco_eo-0.7.0}/tests/test_tacocat.py +1 -1
  133. taco_eo-0.7.0/tests/test_versioned.py +267 -0
  134. {taco_eo-0.6.2 → taco_eo-0.7.0}/tests/test_writer.py +1 -1
  135. {taco_eo-0.6.2 → taco_eo-0.7.0}/tests/test_writer_cases.py +7 -7
  136. taco_eo-0.6.2/taco/dataset.py +0 -88
  137. taco_eo-0.6.2/taco/reader/__init__.py +0 -247
  138. taco_eo-0.6.2/taco/reader/engine.py +0 -67
  139. taco_eo-0.6.2/taco/writer/archive.py +0 -372
  140. taco_eo-0.6.2/tests/test_reader.py +0 -313
  141. {taco_eo-0.6.2 → taco_eo-0.7.0}/LICENSE +0 -0
  142. {taco_eo-0.6.2 → taco_eo-0.7.0}/examples/change_detection.py +0 -0
  143. {taco_eo-0.6.2 → taco_eo-0.7.0}/examples/geospatial.py +0 -0
  144. {taco_eo-0.6.2 → taco_eo-0.7.0}/examples/minimal.py +0 -0
  145. {taco_eo-0.6.2 → taco_eo-0.7.0}/examples/numpy_minimal.py +0 -0
  146. {taco_eo-0.6.2 → taco_eo-0.7.0}/examples/oceantaco_istac.py +0 -0
  147. {taco_eo-0.6.2 → taco_eo-0.7.0}/examples/partitioned.py +0 -0
  148. {taco_eo-0.6.2 → taco_eo-0.7.0}/examples/sequence.py +0 -0
  149. {taco_eo-0.6.2 → taco_eo-0.7.0}/examples/stac_segmentation.py +0 -0
  150. {taco_eo-0.6.2 → taco_eo-0.7.0}/examples/time_series.py +0 -0
  151. {taco_eo-0.6.2 → taco_eo-0.7.0}/taco/_graph.py +0 -0
  152. {taco_eo-0.6.2/taco → taco_eo-0.7.0/taco/container}/cozip.py +0 -0
  153. /taco_eo-0.6.2/taco/_parquet.py → /taco_eo-0.7.0/taco/container/parquet.py +0 -0
  154. /taco_eo-0.6.2/taco/_publish.py → /taco_eo-0.7.0/taco/container/publish.py +0 -0
  155. {taco_eo-0.6.2 → taco_eo-0.7.0}/taco/contract/__init__.py +0 -0
  156. {taco_eo-0.6.2 → taco_eo-0.7.0}/taco/contract/naming.py +0 -0
  157. {taco_eo-0.6.2 → taco_eo-0.7.0}/taco/contract/types.py +0 -0
  158. {taco_eo-0.6.2 → taco_eo-0.7.0}/taco/errors.py +0 -0
  159. {taco_eo-0.6.2 → taco_eo-0.7.0}/taco/extensions/__init__.py +0 -0
  160. {taco_eo-0.6.2 → taco_eo-0.7.0}/taco/extensions/rumi.py +0 -0
  161. {taco_eo-0.6.2 → taco_eo-0.7.0}/taco/extensions/spatiotemporal.py +0 -0
  162. {taco_eo-0.6.2 → taco_eo-0.7.0}/taco/metadata/__init__.py +0 -0
  163. {taco_eo-0.6.2 → taco_eo-0.7.0}/taco/metadata/asset.py +0 -0
  164. {taco_eo-0.6.2 → taco_eo-0.7.0}/taco/metadata/collection.py +0 -0
  165. {taco_eo-0.6.2 → taco_eo-0.7.0}/taco/metadata/data/admin/admin0.parquet +0 -0
  166. {taco_eo-0.6.2 → taco_eo-0.7.0}/taco/metadata/data/admin/admin1.parquet +0 -0
  167. {taco_eo-0.6.2 → taco_eo-0.7.0}/taco/metadata/data/admin/admin2.parquet +0 -0
  168. {taco_eo-0.6.2 → taco_eo-0.7.0}/taco/metadata/folder.py +0 -0
  169. {taco_eo-0.6.2 → taco_eo-0.7.0}/taco/metadata/sample.py +0 -0
  170. {taco_eo-0.6.2 → taco_eo-0.7.0}/taco/metadata/spatiotemporal.py +0 -0
  171. {taco_eo-0.6.2 → taco_eo-0.7.0}/taco/metadata/split.py +0 -0
  172. {taco_eo-0.6.2 → taco_eo-0.7.0}/taco/py.typed +0 -0
  173. {taco_eo-0.6.2 → taco_eo-0.7.0}/taco/writer/progress.py +0 -0
  174. {taco_eo-0.6.2 → taco_eo-0.7.0}/taco/writer/staging.py +0 -0
  175. {taco_eo-0.6.2 → taco_eo-0.7.0}/tests/__init__.py +0 -0
  176. {taco_eo-0.6.2 → taco_eo-0.7.0}/tests/conftest.py +0 -0
  177. {taco_eo-0.6.2 → taco_eo-0.7.0}/tests/datasets.py +0 -0
  178. {taco_eo-0.6.2 → taco_eo-0.7.0}/tests/test_collection.py +0 -0
  179. {taco_eo-0.6.2 → taco_eo-0.7.0}/tests/test_contract.py +0 -0
  180. {taco_eo-0.6.2 → taco_eo-0.7.0}/tests/test_examples.py +0 -0
  181. {taco_eo-0.6.2 → taco_eo-0.7.0}/tests/test_progress.py +0 -0
  182. {taco_eo-0.6.2 → taco_eo-0.7.0}/tests/test_types.py +0 -0
  183. {taco_eo-0.6.2 → taco_eo-0.7.0}/tests/test_validate.py +0 -0
@@ -26,8 +26,17 @@ python/uv.lock
26
26
  /julia/Manifest.toml
27
27
 
28
28
  *.dylib
29
+ *.so
30
+ *.dll
31
+ python/taco/_lib/
29
32
 
30
33
  *.o
34
+ *~
35
+ autom4te.cache/
36
+ /r/config.log
37
+ /r/config.status
38
+ /r/src/Makevars
39
+ /r/src/Makevars.win
31
40
 
32
41
  create-julia-skeleton.sh
33
42
  _site/
@@ -5,6 +5,38 @@ All notable changes to `taco` are documented here. The format follows
5
5
 
6
6
  ## Unreleased
7
7
 
8
+ ### Added
9
+
10
+ - `open_dataset()` and `read()` resolve versioned dataset roots through one
11
+ `taco.json` read, select the declared default, and use the embedded collection
12
+ without fetching a second collection document. Immutable versions remain
13
+ directly addressable through their own URLs.
14
+ - `export()` writes the samples selected with `where` or `idx` from a local ZIP,
15
+ FOLDER, or TACOCAT as a new dataset. The subset keeps the contract, needs its
16
+ own id and description, and recomputes its extent. Without a selection it
17
+ converts a FOLDER to ZIP or merges a TACOCAT into one dataset.
18
+
19
+ ### Changed
20
+
21
+ - Reading no longer loads the `cozip` DuckDB extension. A C++ core shared with
22
+ the R and Julia packages reads `COLLECTION.json` and the metadata Parquet
23
+ through Karu, caches them once per dataset version in the user cache
24
+ directory (`TACO_CACHE_DIR` overrides it), and generates the SQL that the
25
+ package's own DuckDB runs. Local paths, HTTP, S3, GCS, Azure, Hugging Face,
26
+ and Source Cooperative share the same API.
27
+ - `read(layout="long", files=...)` keeps only the selected files.
28
+
29
+ ### Removed
30
+
31
+ - The `COZIP_EXTENSION` environment variable.
32
+
33
+ ## 0.6.3 - 2026-09-13
34
+
35
+ ### Fixed
36
+
37
+ - `GeoEnrich` now receives the complete metadata level before applying the
38
+ same globally sorted, concurrent Earth Engine batching used by Taco v2.
39
+
8
40
  ## 0.6.2 - 2026-09-13
9
41
 
10
42
  ### Removed
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: taco-eo
3
- Version: 0.6.2
3
+ Version: 0.7.0
4
4
  Summary: Read and write TACO datasets in Python.
5
5
  Project-URL: Homepage, https://asterisk.coop/taco
6
6
  Project-URL: Specification, https://asterisk.coop/taco/spec
@@ -12,7 +12,9 @@ License-File: LICENSE
12
12
  Keywords: cloud-optimized,cozip,earth-observation,geospatial,machine-learning,parquet,taco
13
13
  Classifier: Development Status :: 3 - Alpha
14
14
  Classifier: Intended Audience :: Science/Research
15
- Classifier: Operating System :: OS Independent
15
+ Classifier: Operating System :: MacOS
16
+ Classifier: Operating System :: Microsoft :: Windows
17
+ Classifier: Operating System :: POSIX :: Linux
16
18
  Classifier: Programming Language :: Python :: 3
17
19
  Classifier: Programming Language :: Python :: 3.10
18
20
  Classifier: Programming Language :: Python :: 3.11
@@ -22,6 +24,7 @@ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
22
24
  Classifier: Topic :: Scientific/Engineering :: GIS
23
25
  Classifier: Typing :: Typed
24
26
  Requires-Python: >=3.10
27
+ Requires-Dist: cffi>=1.17
25
28
  Requires-Dist: cozip>=2026.9.4
26
29
  Requires-Dist: duckdb>=1.5.5
27
30
  Requires-Dist: numpy>=1.24
@@ -61,6 +64,10 @@ pip install taco-eo
61
64
  python examples/minimal.py
62
65
  ```
63
66
 
67
+ Published wheels include the native TACO reader. Building from the source
68
+ distribution requires a C++23 compiler, CMake, Ninja, pkg-config, libcurl
69
+ 7.83 or newer, and OpenSSL 3 or newer.
70
+
64
71
  ```python
65
72
  import taco
66
73
 
@@ -68,6 +75,30 @@ samples = taco.read("dataset.zip")
68
75
  parts = taco.read(["part-0.zip", "part-1.zip"])
69
76
  ```
70
77
 
78
+ Versioned dataset roots select their declared default release without listing
79
+ remote storage. Use a release URL to open an immutable version directly.
80
+
81
+ ```python
82
+ dataset = taco.open_dataset("https://data.source.coop/major-tom/core-dem/")
83
+ print(dataset.version)
84
+ print(dataset.versions)
85
+
86
+ previous = taco.open_dataset("https://data.source.coop/major-tom/core-dem/1.0.0/")
87
+ ```
88
+
89
+ `export()` writes a smaller dataset with the same contract. `where` filters the
90
+ rows returned by `read()`, and the subset needs its own id and description.
91
+
92
+ ```python
93
+ taco.export(
94
+ "dataset.zip",
95
+ "test.zip",
96
+ where="\"ml:split\" = 'test'",
97
+ id="dataset-test",
98
+ description="Test split of the dataset",
99
+ )
100
+ ```
101
+
71
102
  ## Examples
72
103
 
73
104
  Every example is self-contained, uses synthetic data, and writes its output in
@@ -7,6 +7,10 @@ pip install taco-eo
7
7
  python examples/minimal.py
8
8
  ```
9
9
 
10
+ Published wheels include the native TACO reader. Building from the source
11
+ distribution requires a C++23 compiler, CMake, Ninja, pkg-config, libcurl
12
+ 7.83 or newer, and OpenSSL 3 or newer.
13
+
10
14
  ```python
11
15
  import taco
12
16
 
@@ -14,6 +18,30 @@ samples = taco.read("dataset.zip")
14
18
  parts = taco.read(["part-0.zip", "part-1.zip"])
15
19
  ```
16
20
 
21
+ Versioned dataset roots select their declared default release without listing
22
+ remote storage. Use a release URL to open an immutable version directly.
23
+
24
+ ```python
25
+ dataset = taco.open_dataset("https://data.source.coop/major-tom/core-dem/")
26
+ print(dataset.version)
27
+ print(dataset.versions)
28
+
29
+ previous = taco.open_dataset("https://data.source.coop/major-tom/core-dem/1.0.0/")
30
+ ```
31
+
32
+ `export()` writes a smaller dataset with the same contract. `where` filters the
33
+ rows returned by `read()`, and the subset needs its own id and description.
34
+
35
+ ```python
36
+ taco.export(
37
+ "dataset.zip",
38
+ "test.zip",
39
+ where="\"ml:split\" = 'test'",
40
+ id="dataset-test",
41
+ description="Test split of the dataset",
42
+ )
43
+ ```
44
+
17
45
  ## Examples
18
46
 
19
47
  Every example is self-contained, uses synthetic data, and writes its output in
@@ -0,0 +1,99 @@
1
+ import os
2
+ import platform
3
+ import shutil
4
+ import subprocess
5
+ import sys
6
+ import tempfile
7
+ from pathlib import Path
8
+ from typing import Any
9
+
10
+ from hatchling.builders.hooks.plugin.interface import BuildHookInterface
11
+ from packaging.tags import sys_tags
12
+
13
+
14
+ class CustomBuildHook(BuildHookInterface):
15
+ def initialize(self, version: str, build_data: dict[str, Any]) -> None:
16
+ if self.target_name != "wheel":
17
+ return
18
+
19
+ root = Path(self.root)
20
+ library = root / "taco" / "_lib" / _library_name()
21
+ if not library.is_file():
22
+ _compile_native(_native_source(root), library)
23
+
24
+ # CFFI loads the library dynamically, so the wheel is independent of
25
+ # CPython's ABI while remaining specific to its OS and architecture.
26
+ build_data["pure_python"] = False
27
+ build_data["tag"] = f"py3-none-{_platform_tag()}"
28
+
29
+
30
+ def _library_name() -> str:
31
+ if sys.platform == "darwin":
32
+ return "libtaco.dylib"
33
+ if sys.platform == "win32":
34
+ return "taco.dll"
35
+ return "libtaco.so"
36
+
37
+
38
+ def _platform_tag() -> str:
39
+ if sys.platform == "darwin":
40
+ machine = platform.machine().lower()
41
+ if machine == "aarch64":
42
+ machine = "arm64"
43
+ return f"macosx_11_0_{machine}"
44
+ return next(
45
+ tag.platform for tag in sys_tags() if "manylinux" not in tag.platform and "musllinux" not in tag.platform
46
+ )
47
+
48
+
49
+ def _native_source(root: Path) -> Path:
50
+ checkout = root.parent / "core"
51
+ if (checkout / "CMakeLists.txt").is_file():
52
+ return checkout
53
+
54
+ sdist = root / "native" / "core"
55
+ if (sdist / "CMakeLists.txt").is_file():
56
+ return sdist
57
+
58
+ raise RuntimeError("TACO native sources are missing from the source tree")
59
+
60
+
61
+ def _compile_native(source: Path, destination: Path) -> None:
62
+ cmake = shutil.which("cmake")
63
+ ninja = shutil.which("ninja")
64
+ if not cmake or not ninja:
65
+ raise RuntimeError("building taco-eo from source requires CMake and Ninja")
66
+
67
+ with tempfile.TemporaryDirectory(prefix="taco-native-") as temporary:
68
+ build = Path(temporary)
69
+ environment = os.environ.copy()
70
+ configure = [
71
+ cmake,
72
+ "-S",
73
+ str(source),
74
+ "-B",
75
+ str(build),
76
+ "-G",
77
+ "Ninja",
78
+ "-DCMAKE_BUILD_TYPE=Release",
79
+ "-DTACO_BUILD_TESTS=OFF",
80
+ ]
81
+ if sys.platform == "darwin":
82
+ deployment_target = environment.setdefault("MACOSX_DEPLOYMENT_TARGET", "11.0")
83
+ configure.append(f"-DCMAKE_OSX_DEPLOYMENT_TARGET={deployment_target}")
84
+ subprocess.run(
85
+ configure,
86
+ check=True,
87
+ env=environment,
88
+ )
89
+ subprocess.run(
90
+ [cmake, "--build", str(build), "--target", "taco", "--config", "Release"],
91
+ check=True,
92
+ env=environment,
93
+ )
94
+
95
+ candidates = list(build.rglob(_library_name()))
96
+ if len(candidates) != 1:
97
+ raise RuntimeError(f"native build did not produce exactly one {_library_name()}")
98
+ destination.parent.mkdir(parents=True, exist_ok=True)
99
+ shutil.copy2(candidates[0], destination)
@@ -0,0 +1,105 @@
1
+ cmake_minimum_required(VERSION 3.21)
2
+ cmake_policy(SET CMP0091 NEW)
3
+
4
+ file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/include/taco/taco.h"
5
+ TACO_API_VERSION_LINE REGEX "^#define TACO_API_VERSION [0-9]+$")
6
+ if(NOT TACO_API_VERSION_LINE)
7
+ message(FATAL_ERROR "taco.h has no numeric TACO_API_VERSION")
8
+ endif()
9
+
10
+ project(taco
11
+ VERSION 0.7.0
12
+ DESCRIPTION "Native TACO reader shared by the Python, R and Julia packages"
13
+ LANGUAGES CXX C
14
+ )
15
+
16
+ # The release DLL and its vcpkg dependencies must use the same dynamic CRT.
17
+ set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
18
+
19
+ option(TACO_BUILD_TESTS "Build the core tests" OFF)
20
+ option(TACO_WERROR "Treat warnings in the core as errors" OFF)
21
+ set(TACO_KARU_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../extern/karu"
22
+ CACHE PATH "Path to the karu submodule source")
23
+
24
+ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
25
+ set(CMAKE_BUILD_TYPE Release CACHE STRING "" FORCE)
26
+ endif()
27
+
28
+ set(CMAKE_CXX_STANDARD 23)
29
+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
30
+ set(CMAKE_CXX_EXTENSIONS OFF)
31
+ set(CMAKE_C_STANDARD 11)
32
+ set(CMAKE_C_STANDARD_REQUIRED ON)
33
+ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
34
+ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
35
+
36
+ # Only TACO_API symbols leave the library. karu stays private to it.
37
+ set(CMAKE_CXX_VISIBILITY_PRESET hidden)
38
+ set(CMAKE_C_VISIBILITY_PRESET hidden)
39
+ set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)
40
+
41
+ set(KARU_BUILD_TESTS OFF CACHE BOOL "" FORCE)
42
+ set(KARU_WERROR ${TACO_WERROR} CACHE BOOL "" FORCE)
43
+ add_subdirectory(${TACO_KARU_DIR} ${CMAKE_CURRENT_BINARY_DIR}/karu EXCLUDE_FROM_ALL)
44
+
45
+ set(TACO_SOURCES
46
+ src/capi.cpp
47
+ src/cozip_index.cpp
48
+ src/dataset.cpp
49
+ src/json.cpp
50
+ src/manifest.cpp
51
+ src/paths.cpp
52
+ src/sql.cpp
53
+ src/transport.cpp
54
+ )
55
+
56
+ add_library(taco_objects OBJECT ${TACO_SOURCES})
57
+ target_include_directories(taco_objects
58
+ PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include
59
+ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
60
+ )
61
+ target_link_libraries(taco_objects PUBLIC karu::internal)
62
+ target_compile_definitions(taco_objects PRIVATE
63
+ TACO_BUILD
64
+ TACO_VERSION_STRING="${PROJECT_VERSION}"
65
+ )
66
+ target_compile_options(taco_objects PRIVATE
67
+ $<$<CXX_COMPILER_ID:GNU,Clang,AppleClang>:-Wall;-Wextra;-Wpedantic>
68
+ $<$<CXX_COMPILER_ID:MSVC>:/W4;/permissive-;/utf-8>
69
+ )
70
+ if(TACO_WERROR)
71
+ target_compile_options(taco_objects PRIVATE
72
+ $<$<CXX_COMPILER_ID:GNU,Clang,AppleClang>:-Werror>
73
+ $<$<CXX_COMPILER_ID:MSVC>:/WX>
74
+ )
75
+ endif()
76
+
77
+ add_library(taco SHARED $<TARGET_OBJECTS:taco_objects>)
78
+ target_link_libraries(taco PRIVATE karu::internal)
79
+ target_include_directories(taco PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
80
+
81
+ include(GNUInstallDirs)
82
+ install(TARGETS taco
83
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
84
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
85
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
86
+ )
87
+ install(FILES include/taco/taco.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/taco)
88
+
89
+ if(TACO_BUILD_TESTS)
90
+ enable_testing()
91
+ # R and Julia bind the C header, so it must compile as C11 too.
92
+ add_library(taco_c_header_check OBJECT tests/test_c_header.c)
93
+ target_include_directories(taco_c_header_check PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
94
+ target_compile_options(taco_c_header_check PRIVATE
95
+ $<$<C_COMPILER_ID:GNU,Clang,AppleClang>:-Wall;-Wextra;-Wpedantic>)
96
+
97
+ add_executable(taco_tests tests/test_core.cpp)
98
+ add_dependencies(taco_tests taco_c_header_check)
99
+ target_link_libraries(taco_tests PRIVATE taco_objects)
100
+ target_include_directories(taco_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
101
+ target_compile_definitions(taco_tests PRIVATE
102
+ TACO_TEST_DATA="${CMAKE_CURRENT_SOURCE_DIR}/tests/data"
103
+ TACO_TEST_CONFORMANCE="${CMAKE_CURRENT_SOURCE_DIR}/../r/inst/conformance/reader-resolution.json")
104
+ add_test(NAME core COMMAND taco_tests)
105
+ endif()
@@ -0,0 +1,103 @@
1
+ // C API for reading TACO datasets.
2
+ //
3
+ // The core resolves ZIP, FOLDER and TACOCAT containers, local or remote,
4
+ // copies their metadata into a cache and writes the SQL that DuckDB runs to
5
+ // read them. Python, R and Julia bind this header.
6
+ #ifndef TACO_H
7
+ #define TACO_H
8
+
9
+ #include <stddef.h>
10
+
11
+ #if defined(_WIN32)
12
+ # if defined(TACO_BUILD)
13
+ # define TACO_API __declspec(dllexport)
14
+ # else
15
+ # define TACO_API __declspec(dllimport)
16
+ # endif
17
+ #else
18
+ # define TACO_API __attribute__((visibility("default")))
19
+ #endif
20
+
21
+ #ifdef __cplusplus
22
+ extern "C" {
23
+ #endif
24
+
25
+ #define TACO_API_VERSION 1
26
+
27
+ typedef enum {
28
+ TACO_OK = 0,
29
+ TACO_ERR_INVALID = 1,
30
+ TACO_ERR_IO = 2,
31
+ TACO_ERR_NOT_FOUND = 3,
32
+ TACO_ERR_INTERNAL = 99
33
+ } taco_status;
34
+
35
+ TACO_API int taco_api_version(void);
36
+ TACO_API const char* taco_version_string(void);
37
+
38
+ // Error text of the latest failed call on this thread.
39
+ TACO_API const char* taco_last_error(void);
40
+
41
+ // Releases a string returned through a char** parameter.
42
+ TACO_API void taco_free(char* text);
43
+
44
+ // Releases transport resources cached by this thread. Call this before
45
+ // unloading the shared library. It is safe to call more than once.
46
+ TACO_API void taco_shutdown(void);
47
+
48
+ typedef struct taco_dataset taco_dataset;
49
+
50
+ // Opens a dataset. Remote metadata, and the metadata inside any ZIP, is
51
+ // copied into cache_dir, or into the default cache when it is NULL.
52
+ TACO_API taco_status taco_open(const char* source, const char* cache_dir, taco_dataset** out);
53
+ TACO_API void taco_close(taco_dataset* dataset);
54
+
55
+ // Views owned by the dataset. They stay valid until taco_close.
56
+ TACO_API const char* taco_dataset_source(const taco_dataset* dataset);
57
+ TACO_API const char* taco_dataset_container(const taco_dataset* dataset);
58
+ TACO_API const char* taco_dataset_collection(const taco_dataset* dataset);
59
+ TACO_API size_t taco_dataset_level_count(const taco_dataset* dataset);
60
+ TACO_API const char* taco_dataset_level(const taco_dataset* dataset, size_t index);
61
+ TACO_API size_t taco_dataset_structure_count(const taco_dataset* dataset);
62
+ TACO_API const char* taco_dataset_structure(const taco_dataset* dataset, size_t index);
63
+ // Serialized taco:derived object, or NULL when the collection has none.
64
+ TACO_API const char* taco_dataset_derived(const taco_dataset* dataset);
65
+
66
+ typedef struct {
67
+ // NULL for every sample, "5" for one, "[0, 100]" for a half-open range.
68
+ const char* idx;
69
+ // NULL for the joined view, otherwise one contract level read raw.
70
+ const char* level;
71
+ // Nonzero for one row per sample, zero for one row per file.
72
+ int pivoted;
73
+ // Structure leaves to read, or NULL for every leaf.
74
+ const char* const* files;
75
+ size_t file_count;
76
+ // Nonzero to calculate file locations.
77
+ int location;
78
+ } taco_read_options;
79
+
80
+ // The query that reads one dataset, or the union of compatible partitions.
81
+ TACO_API taco_status taco_sql(const taco_dataset* const* datasets, size_t count,
82
+ const taco_read_options* options, char** out_sql);
83
+
84
+ // Profile of a CoZIP archive: "none", "flat", "taco" or "unknown:<n>".
85
+ TACO_API taco_status taco_profile(const char* source, char** out_name);
86
+
87
+ // Where a versioned manifest would be, or NULL when the source is a dataset.
88
+ TACO_API taco_status taco_manifest_candidate(const char* source, char** out_candidate);
89
+
90
+ // A version href resolved against the manifest that lists it.
91
+ TACO_API taco_status taco_join_manifest_href(const char* candidate, const char* href,
92
+ char** out_source);
93
+
94
+ // Resolves a versioned root to its default version. The JSON object has
95
+ // "source", "collection", "version", "versions" and "manifest"; the last
96
+ // four are null or empty when the source is not versioned.
97
+ TACO_API taco_status taco_resolve(const char* source, char** out_json);
98
+
99
+ #ifdef __cplusplus
100
+ } // extern "C"
101
+ #endif
102
+
103
+ #endif // TACO_H
@@ -0,0 +1,195 @@
1
+ #include <taco/taco.h>
2
+
3
+ #include "cozip_index.hpp"
4
+ #include "dataset.hpp"
5
+ #include "error.hpp"
6
+ #include "manifest.hpp"
7
+ #include "sql.hpp"
8
+ #include "transport.hpp"
9
+
10
+ #include <cstdlib>
11
+ #include <cstring>
12
+ #include <memory>
13
+ #include <new>
14
+ #include <string>
15
+ #include <vector>
16
+
17
+ struct taco_dataset {
18
+ taco::Dataset value;
19
+ };
20
+
21
+ namespace {
22
+
23
+ thread_local std::string last_error;
24
+
25
+ char* copy_string(const std::string& text) {
26
+ auto* out = static_cast<char*>(std::malloc(text.size() + 1));
27
+ if (!out)
28
+ throw std::bad_alloc();
29
+ std::memcpy(out, text.c_str(), text.size() + 1);
30
+ return out;
31
+ }
32
+
33
+ // Every exported call reports failures through its status and last_error.
34
+ template <typename Body>
35
+ taco_status guard(Body&& body) noexcept {
36
+ try {
37
+ body();
38
+ return TACO_OK;
39
+ } catch (const taco::Error& error) {
40
+ last_error = error.what();
41
+ return error.status();
42
+ } catch (const std::bad_alloc&) {
43
+ last_error = "out of memory";
44
+ return TACO_ERR_INTERNAL;
45
+ } catch (const std::exception& error) {
46
+ last_error = error.what();
47
+ return TACO_ERR_INTERNAL;
48
+ }
49
+ }
50
+
51
+ void require(bool condition, const char* message) {
52
+ if (!condition)
53
+ taco::fail(message);
54
+ }
55
+
56
+ const char* item(const std::vector<std::string>& values, size_t index) {
57
+ return index < values.size() ? values[index].c_str() : nullptr;
58
+ }
59
+
60
+ } // namespace
61
+
62
+ int taco_api_version(void) {
63
+ return TACO_API_VERSION;
64
+ }
65
+
66
+ const char* taco_version_string(void) {
67
+ return TACO_VERSION_STRING;
68
+ }
69
+
70
+ const char* taco_last_error(void) {
71
+ return last_error.c_str();
72
+ }
73
+
74
+ void taco_free(char* text) {
75
+ std::free(text);
76
+ }
77
+
78
+ void taco_shutdown(void) {
79
+ taco::shutdown_transport();
80
+ }
81
+
82
+ taco_status taco_open(const char* source, const char* cache_dir, taco_dataset** out) {
83
+ if (out)
84
+ *out = nullptr;
85
+ return guard([&] {
86
+ require(source && out, "taco_open: source and out must not be NULL");
87
+ auto dataset = std::make_unique<taco_dataset>();
88
+ dataset->value = taco::open_dataset(source, cache_dir ? cache_dir : "");
89
+ *out = dataset.release();
90
+ });
91
+ }
92
+
93
+ void taco_close(taco_dataset* dataset) {
94
+ delete dataset;
95
+ }
96
+
97
+ const char* taco_dataset_source(const taco_dataset* dataset) {
98
+ return dataset ? dataset->value.source.c_str() : nullptr;
99
+ }
100
+
101
+ const char* taco_dataset_container(const taco_dataset* dataset) {
102
+ return dataset ? taco::container_name(dataset->value.container) : nullptr;
103
+ }
104
+
105
+ const char* taco_dataset_collection(const taco_dataset* dataset) {
106
+ return dataset ? dataset->value.collection.c_str() : nullptr;
107
+ }
108
+
109
+ size_t taco_dataset_level_count(const taco_dataset* dataset) {
110
+ return dataset ? dataset->value.level_names.size() : 0;
111
+ }
112
+
113
+ const char* taco_dataset_level(const taco_dataset* dataset, size_t index) {
114
+ return dataset ? item(dataset->value.level_names, index) : nullptr;
115
+ }
116
+
117
+ size_t taco_dataset_structure_count(const taco_dataset* dataset) {
118
+ return dataset ? dataset->value.contract.structure.size() : 0;
119
+ }
120
+
121
+ const char* taco_dataset_structure(const taco_dataset* dataset, size_t index) {
122
+ return dataset ? item(dataset->value.contract.structure, index) : nullptr;
123
+ }
124
+
125
+ const char* taco_dataset_derived(const taco_dataset* dataset) {
126
+ return dataset && dataset->value.contract.has_derived ? dataset->value.contract.derived.c_str() : nullptr;
127
+ }
128
+
129
+ taco_status taco_sql(const taco_dataset* const* datasets, size_t count, const taco_read_options* options,
130
+ char** out_sql) {
131
+ if (out_sql)
132
+ *out_sql = nullptr;
133
+ return guard([&] {
134
+ require(datasets && count > 0 && options && out_sql,
135
+ "taco_sql: datasets, options and out_sql must not be NULL");
136
+ taco::ReadOptions read;
137
+ if (options->idx)
138
+ read.idx = options->idx;
139
+ if (options->level)
140
+ read.level = options->level;
141
+ read.pivot = options->pivoted != 0;
142
+ read.location = options->location != 0;
143
+ if (options->files) {
144
+ read.has_files = true;
145
+ for (size_t i = 0; i < options->file_count; ++i) {
146
+ require(options->files[i] != nullptr, "taco_sql: files must not contain NULL");
147
+ read.files.emplace_back(options->files[i]);
148
+ }
149
+ }
150
+ std::vector<const taco::Dataset*> selected;
151
+ for (size_t i = 0; i < count; ++i) {
152
+ require(datasets[i] != nullptr, "taco_sql: datasets must not contain NULL");
153
+ selected.push_back(&datasets[i]->value);
154
+ }
155
+ *out_sql = copy_string(taco::build_union_sql(selected, read));
156
+ });
157
+ }
158
+
159
+ taco_status taco_profile(const char* source, char** out_name) {
160
+ if (out_name)
161
+ *out_name = nullptr;
162
+ return guard([&] {
163
+ require(source && out_name, "taco_profile: source and out_name must not be NULL");
164
+ *out_name = copy_string(taco::profile_name(taco::read_cozip_profile(source)));
165
+ });
166
+ }
167
+
168
+ taco_status taco_manifest_candidate(const char* source, char** out_candidate) {
169
+ if (out_candidate)
170
+ *out_candidate = nullptr;
171
+ return guard([&] {
172
+ require(source && out_candidate, "taco_manifest_candidate: source and out_candidate must not be NULL");
173
+ if (const auto candidate = taco::manifest_candidate(source))
174
+ *out_candidate = copy_string(*candidate);
175
+ });
176
+ }
177
+
178
+ taco_status taco_join_manifest_href(const char* candidate, const char* href, char** out_source) {
179
+ if (out_source)
180
+ *out_source = nullptr;
181
+ return guard([&] {
182
+ require(candidate && href && out_source,
183
+ "taco_join_manifest_href: candidate, href and out_source must not be NULL");
184
+ *out_source = copy_string(taco::join_manifest_href(candidate, href));
185
+ });
186
+ }
187
+
188
+ taco_status taco_resolve(const char* source, char** out_json) {
189
+ if (out_json)
190
+ *out_json = nullptr;
191
+ return guard([&] {
192
+ require(source && out_json, "taco_resolve: source and out_json must not be NULL");
193
+ *out_json = copy_string(taco::resolve_dataset(source));
194
+ });
195
+ }