fsspec-data 0.10.0__tar.gz → 0.11.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.
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/.gitignore +1 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/Cargo.lock +58 -2
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/Cargo.toml +4 -2
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/PKG-INFO +15 -3
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/README.md +14 -2
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/fsspec_data/__init__.py +28 -1
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/fsspec_data/describe.py +24 -6
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/fsspec_data/interchange.py +119 -25
- fsspec_data-0.11.0/fsspec_data/registration.py +265 -0
- fsspec_data-0.11.0/fsspec_data/tests/integration/test_kafka_view_writes.py +87 -0
- fsspec_data-0.11.0/fsspec_data/tests/test_avro_container.py +39 -0
- fsspec_data-0.11.0/fsspec_data/tests/test_codec_registry.py +203 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/fsspec_data/tests/test_describe.py +1 -1
- fsspec_data-0.11.0/fsspec_data/tests/test_registration.py +211 -0
- fsspec_data-0.11.0/fsspec_data/tests/test_view_write.py +498 -0
- fsspec_data-0.11.0/fsspec_data/tests/test_writable_sources.py +197 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/fsspec_data/view.py +68 -8
- fsspec_data-0.11.0/fsspec_data/view_write.py +255 -0
- fsspec_data-0.11.0/fsspec_data/writable.py +142 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/pyproject.toml +6 -2
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/Cargo.lock +57 -1
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/Cargo.toml +8 -2
- fsspec_data-0.11.0/rust/include/fsspec_data.h +105 -0
- fsspec_data-0.11.0/rust/python/codecs.rs +348 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/python/lib.rs +46 -38
- fsspec_data-0.11.0/rust/python/registration.rs +755 -0
- fsspec_data-0.11.0/rust/python/view_write.rs +112 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/src/avro.rs +7 -10
- fsspec_data-0.11.0/rust/src/avro_container.rs +297 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/src/codec.rs +74 -49
- fsspec_data-0.11.0/rust/src/codec_registry.rs +226 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/src/describe.rs +26 -15
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/src/lib.rs +27 -2
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/src/plan.rs +43 -32
- fsspec_data-0.11.0/rust/src/registry_abi/adapters.rs +322 -0
- fsspec_data-0.11.0/rust/src/registry_abi/codecs.rs +280 -0
- fsspec_data-0.11.0/rust/src/registry_abi/dispatch.rs +370 -0
- fsspec_data-0.11.0/rust/src/registry_abi/mod.rs +407 -0
- fsspec_data-0.11.0/rust/src/registry_abi/tests.rs +235 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/src/sink.rs +11 -3
- fsspec_data-0.11.0/rust/src/sink_registry.rs +327 -0
- fsspec_data-0.11.0/rust/src/source_registry.rs +268 -0
- fsspec_data-0.11.0/rust/src/view.rs +709 -0
- fsspec_data-0.11.0/rust/src/view_tests.rs +452 -0
- fsspec_data-0.11.0/rust/src/view_write.rs +349 -0
- fsspec_data-0.11.0/rust/src/writable.rs +329 -0
- fsspec_data-0.11.0/rust/tests/codec_registry.rs +195 -0
- fsspec_data-0.11.0/rust/tests/on_demand_sinks.rs +107 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/LICENSE +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/fsspec_data/_version.py +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/fsspec_data/async_scan.py +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/fsspec_data/backends/__init__.py +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/fsspec_data/backends/base.py +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/fsspec_data/backends/http.py +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/fsspec_data/backends/sqlalchemy.py +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/fsspec_data/confluent.py +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/fsspec_data/converters.py +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/fsspec_data/json_schema.py +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/fsspec_data/s3.py +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/fsspec_data/scan_identity.py +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/fsspec_data/schema.py +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/fsspec_data/sink.py +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/fsspec_data/tables.py +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/fsspec_data/tests/__init__.py +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/fsspec_data/tests/conftest.py +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/fsspec_data/tests/test_all.py +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/fsspec_data/tests/test_async_scan.py +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/fsspec_data/tests/test_async_sources.py +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/fsspec_data/tests/test_async_tables.py +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/fsspec_data/tests/test_cleanup.py +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/fsspec_data/tests/test_converters.py +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/fsspec_data/tests/test_scan_identity.py +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/fsspec_data/tests/test_schema.py +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/fsspec_data/tests/test_sink_contract.py +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/fsspec_data/tests/test_tables.py +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/fsspec_data/tests/test_view.py +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/fsspec_data/tests/test_view_conversion.py +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/fsspec_data/tests/test_watch.py +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/fsspec_data/xarray_zarr.py +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/.config/nextest.toml +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/python/async_file.rs +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/python/async_parquet.rs +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/python/async_tables.rs +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/python/scan_identity.rs +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/python/shared_reads.rs +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/python/tables.rs +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/src/async_parquet.rs +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/src/async_parquet_tests.rs +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/src/async_tables.rs +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/src/cleanup.rs +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/src/confluent.rs +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/src/converter.rs +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/src/error.rs +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/src/fingerprint.rs +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/src/json_schema.rs +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/src/manifest.rs +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/src/parquet_range_tests.rs +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/src/parquet_ranges.rs +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/src/parts.rs +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/src/scan_identity.rs +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/src/schema.rs +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/src/stream.rs +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/src/table_scan.rs +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/src/watch.rs +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/tests/async_tables.rs +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/tests/file_sink.rs +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/tests/fixtures/batch_fingerprints.json +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/tests/fixtures/check_fingerprints.py +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/tests/manifest_reader.rs +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/tests/part_writer.rs +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/tests/publication_model.rs +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/tests/shared_reads.rs +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/tests/sink_contract.rs +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/tests/support/publication.rs +0 -0
- {fsspec_data-0.10.0 → fsspec_data-0.11.0}/rust/tests/watch.rs +0 -0
|
@@ -692,6 +692,22 @@ version = "1.0.3"
|
|
|
692
692
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
693
693
|
checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826"
|
|
694
694
|
|
|
695
|
+
[[package]]
|
|
696
|
+
name = "errno"
|
|
697
|
+
version = "0.3.15"
|
|
698
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
699
|
+
checksum = "e35d6e78f4cebb90e51d543db8fe41528851d6deeef6ef21ebd4bfdc1e784776"
|
|
700
|
+
dependencies = [
|
|
701
|
+
"libc",
|
|
702
|
+
"windows-sys 0.61.2",
|
|
703
|
+
]
|
|
704
|
+
|
|
705
|
+
[[package]]
|
|
706
|
+
name = "fastrand"
|
|
707
|
+
version = "2.5.0"
|
|
708
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
709
|
+
checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223"
|
|
710
|
+
|
|
695
711
|
[[package]]
|
|
696
712
|
name = "find-msvc-tools"
|
|
697
713
|
version = "0.1.15"
|
|
@@ -742,12 +758,15 @@ checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c"
|
|
|
742
758
|
|
|
743
759
|
[[package]]
|
|
744
760
|
name = "fsspec_data"
|
|
745
|
-
version = "0.
|
|
761
|
+
version = "0.11.0"
|
|
746
762
|
dependencies = [
|
|
747
763
|
"arrow",
|
|
748
764
|
"arrow-avro",
|
|
749
765
|
"arrow-schema",
|
|
750
766
|
"bytes",
|
|
767
|
+
"crc32fast",
|
|
768
|
+
"csv",
|
|
769
|
+
"flate2",
|
|
751
770
|
"fsspec_rs",
|
|
752
771
|
"futures",
|
|
753
772
|
"futures-timer",
|
|
@@ -755,16 +774,20 @@ dependencies = [
|
|
|
755
774
|
"serde",
|
|
756
775
|
"serde_json",
|
|
757
776
|
"sha2",
|
|
777
|
+
"snap",
|
|
778
|
+
"tempfile",
|
|
758
779
|
"thiserror",
|
|
759
780
|
"tokio-util",
|
|
760
781
|
"uuid",
|
|
782
|
+
"zstd",
|
|
761
783
|
]
|
|
762
784
|
|
|
763
785
|
[[package]]
|
|
764
786
|
name = "fsspec_data_py"
|
|
765
|
-
version = "0.
|
|
787
|
+
version = "0.11.0"
|
|
766
788
|
dependencies = [
|
|
767
789
|
"arrow",
|
|
790
|
+
"arrow-avro",
|
|
768
791
|
"bytes",
|
|
769
792
|
"fsspec_data",
|
|
770
793
|
"fsspec_rs",
|
|
@@ -773,6 +796,7 @@ dependencies = [
|
|
|
773
796
|
"pyo3",
|
|
774
797
|
"pyo3-async-runtimes",
|
|
775
798
|
"serde_json",
|
|
799
|
+
"tempfile",
|
|
776
800
|
"tokio",
|
|
777
801
|
]
|
|
778
802
|
|
|
@@ -1390,6 +1414,12 @@ version = "0.2.16"
|
|
|
1390
1414
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1391
1415
|
checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981"
|
|
1392
1416
|
|
|
1417
|
+
[[package]]
|
|
1418
|
+
name = "linux-raw-sys"
|
|
1419
|
+
version = "0.12.1"
|
|
1420
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1421
|
+
checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"
|
|
1422
|
+
|
|
1393
1423
|
[[package]]
|
|
1394
1424
|
name = "litemap"
|
|
1395
1425
|
version = "0.8.3"
|
|
@@ -1956,6 +1986,19 @@ dependencies = [
|
|
|
1956
1986
|
"semver",
|
|
1957
1987
|
]
|
|
1958
1988
|
|
|
1989
|
+
[[package]]
|
|
1990
|
+
name = "rustix"
|
|
1991
|
+
version = "1.1.6"
|
|
1992
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1993
|
+
checksum = "e5e76742e5294153d4dde1207dbec5bdd81eef6fabdc0d2118babadabfd858aa"
|
|
1994
|
+
dependencies = [
|
|
1995
|
+
"bitflags",
|
|
1996
|
+
"errno",
|
|
1997
|
+
"libc",
|
|
1998
|
+
"linux-raw-sys",
|
|
1999
|
+
"windows-sys 0.61.2",
|
|
2000
|
+
]
|
|
2001
|
+
|
|
1959
2002
|
[[package]]
|
|
1960
2003
|
name = "rustls"
|
|
1961
2004
|
version = "0.23.46"
|
|
@@ -2302,6 +2345,19 @@ version = "0.13.6"
|
|
|
2302
2345
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2303
2346
|
checksum = "8c447be3a2abfa84b2d91680c56600bd6b2873866de27b36ec911be705e291da"
|
|
2304
2347
|
|
|
2348
|
+
[[package]]
|
|
2349
|
+
name = "tempfile"
|
|
2350
|
+
version = "3.27.0"
|
|
2351
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2352
|
+
checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"
|
|
2353
|
+
dependencies = [
|
|
2354
|
+
"fastrand",
|
|
2355
|
+
"getrandom 0.4.3",
|
|
2356
|
+
"once_cell",
|
|
2357
|
+
"rustix",
|
|
2358
|
+
"windows-sys 0.61.2",
|
|
2359
|
+
]
|
|
2360
|
+
|
|
2305
2361
|
[[package]]
|
|
2306
2362
|
name = "thiserror"
|
|
2307
2363
|
version = "2.0.21"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "fsspec_data_py"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.11.0"
|
|
4
4
|
edition = "2021"
|
|
5
5
|
publish = false
|
|
6
6
|
|
|
@@ -11,15 +11,17 @@ crate-type = ["cdylib"]
|
|
|
11
11
|
|
|
12
12
|
[dependencies]
|
|
13
13
|
bytes = "1"
|
|
14
|
+
tempfile = "3"
|
|
14
15
|
parquet = { version = "60.1.0", features = ["arrow"] }
|
|
15
16
|
fsspec_data = { path = "./rust", version = "*" }
|
|
16
17
|
arrow = { version = "60.1.0", features = ["pyarrow"] }
|
|
18
|
+
arrow-avro = { version = "60.1.0", default-features = false }
|
|
17
19
|
fsspec_rs = "0.4.0"
|
|
18
20
|
futures = { version = "0.3", default-features = false, features = ["std"] }
|
|
19
21
|
serde_json = { version = "1", features = ["float_roundtrip"] }
|
|
20
22
|
tokio = { version = "1", features = ["sync", "rt", "time"] }
|
|
21
23
|
pyo3-async-runtimes = { version = "0.29", features = ["tokio-runtime"] }
|
|
22
|
-
pyo3 = { version = "0.29", features = ["abi3"
|
|
24
|
+
pyo3 = { version = "0.29", features = ["abi3"] }
|
|
23
25
|
|
|
24
26
|
[profile.release]
|
|
25
27
|
panic = "abort"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: fsspec-data
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.11.0
|
|
4
4
|
Summary: Arrow interchange planning for the fsspec data ecosystem
|
|
5
5
|
Project-URL: Repository, https://github.com/1kbgz/fsspec-data
|
|
6
6
|
Project-URL: Homepage, https://github.com/1kbgz/fsspec-data
|
|
@@ -57,8 +57,8 @@ Convert tabular formats and reconcile Arrow schemas over fsspec.
|
|
|
57
57
|
`fsspec-data` plans schema mappings and executes them over Arrow record batches.
|
|
58
58
|
Codecs handle Arrow IPC, Parquet, CSV, and JSONL. The `dataview` filesystem
|
|
59
59
|
exposes converted files, schemas, and metadata of any source and passes writes to raw files
|
|
60
|
-
through to it
|
|
61
|
-
Xarray datasets and Zarr stores.
|
|
60
|
+
through to it. Bound table sinks accept Arrow IPC, Parquet, CSV, JSONL, and Avro file writes. A separate converter
|
|
61
|
+
registry handles resources such as Xarray datasets and Zarr stores.
|
|
62
62
|
|
|
63
63
|
## Start here
|
|
64
64
|
|
|
@@ -72,12 +72,24 @@ For application work, [connect a batch producer or consumer](docs/how-to-integra
|
|
|
72
72
|
[resolve schemas from files and registries](docs/how-to-resolve-schemas.md).
|
|
73
73
|
[Write and read saved table versions](docs/how-to-write-tables.md) covers manifest-published
|
|
74
74
|
Parquet tables, positioned writes, and recovery.
|
|
75
|
+
[Use a sink through a data view](docs/how-to-bind-sinks.md) connects configured table writers
|
|
76
|
+
to logical source paths while preserving their backend options and receipts.
|
|
77
|
+
[Use data views from Rust](docs/how-to-use-native-views.md) covers native rendering, registration, and sink writes.
|
|
78
|
+
[Write table files through a data view](docs/how-to-write-view-files.md) covers file handles,
|
|
79
|
+
append retries, and publication recovery.
|
|
75
80
|
[Convert Xarray and Zarr resources](docs/how-to-convert-resources.md) covers native
|
|
76
81
|
resource routes and converter registration.
|
|
77
82
|
|
|
83
|
+
[Register data backends](docs/how-to-register-data-backends.md) covers URL factories,
|
|
84
|
+
package entry points, and registrations shared with Rust extensions.
|
|
85
|
+
|
|
78
86
|
## Reference and explanation
|
|
79
87
|
|
|
80
88
|
The [interchange API reference](docs/api.md) covers codecs, policies, limits, and
|
|
81
89
|
planning. [Schema and converter reference](docs/resources.md) describes resolution
|
|
82
90
|
and resource routes. Read [Interchange design](docs/explanation.md) for the
|
|
83
91
|
boundaries between schemas, data, and consumers.
|
|
92
|
+
[Data registry C ABI](docs/data-registry-c-abi.md) specifies handle ownership and Arrow interchange.
|
|
93
|
+
|
|
94
|
+
- [How to register a codec](docs/how-to-register-codecs.md)
|
|
95
|
+
- [Codec registry reference](docs/codec-registry.md)
|
|
@@ -10,8 +10,8 @@ Convert tabular formats and reconcile Arrow schemas over fsspec.
|
|
|
10
10
|
`fsspec-data` plans schema mappings and executes them over Arrow record batches.
|
|
11
11
|
Codecs handle Arrow IPC, Parquet, CSV, and JSONL. The `dataview` filesystem
|
|
12
12
|
exposes converted files, schemas, and metadata of any source and passes writes to raw files
|
|
13
|
-
through to it
|
|
14
|
-
Xarray datasets and Zarr stores.
|
|
13
|
+
through to it. Bound table sinks accept Arrow IPC, Parquet, CSV, JSONL, and Avro file writes. A separate converter
|
|
14
|
+
registry handles resources such as Xarray datasets and Zarr stores.
|
|
15
15
|
|
|
16
16
|
## Start here
|
|
17
17
|
|
|
@@ -25,12 +25,24 @@ For application work, [connect a batch producer or consumer](docs/how-to-integra
|
|
|
25
25
|
[resolve schemas from files and registries](docs/how-to-resolve-schemas.md).
|
|
26
26
|
[Write and read saved table versions](docs/how-to-write-tables.md) covers manifest-published
|
|
27
27
|
Parquet tables, positioned writes, and recovery.
|
|
28
|
+
[Use a sink through a data view](docs/how-to-bind-sinks.md) connects configured table writers
|
|
29
|
+
to logical source paths while preserving their backend options and receipts.
|
|
30
|
+
[Use data views from Rust](docs/how-to-use-native-views.md) covers native rendering, registration, and sink writes.
|
|
31
|
+
[Write table files through a data view](docs/how-to-write-view-files.md) covers file handles,
|
|
32
|
+
append retries, and publication recovery.
|
|
28
33
|
[Convert Xarray and Zarr resources](docs/how-to-convert-resources.md) covers native
|
|
29
34
|
resource routes and converter registration.
|
|
30
35
|
|
|
36
|
+
[Register data backends](docs/how-to-register-data-backends.md) covers URL factories,
|
|
37
|
+
package entry points, and registrations shared with Rust extensions.
|
|
38
|
+
|
|
31
39
|
## Reference and explanation
|
|
32
40
|
|
|
33
41
|
The [interchange API reference](docs/api.md) covers codecs, policies, limits, and
|
|
34
42
|
planning. [Schema and converter reference](docs/resources.md) describes resolution
|
|
35
43
|
and resource routes. Read [Interchange design](docs/explanation.md) for the
|
|
36
44
|
boundaries between schemas, data, and consumers.
|
|
45
|
+
[Data registry C ABI](docs/data-registry-c-abi.md) specifies handle ownership and Arrow interchange.
|
|
46
|
+
|
|
47
|
+
- [How to register a codec](docs/how-to-register-codecs.md)
|
|
48
|
+
- [Codec registry reference](docs/codec-registry.md)
|
|
@@ -21,8 +21,21 @@ from .interchange import (
|
|
|
21
21
|
PlannedBatchStream,
|
|
22
22
|
SchemaPolicy,
|
|
23
23
|
plan_schema,
|
|
24
|
+
register_codec,
|
|
24
25
|
)
|
|
25
26
|
from .json_schema import json_schema_to_arrow
|
|
27
|
+
from .registration import (
|
|
28
|
+
DEFAULT_SINKS,
|
|
29
|
+
DEFAULT_SOURCES,
|
|
30
|
+
SINK_ENTRY_POINT_GROUP,
|
|
31
|
+
SOURCE_ENTRY_POINT_GROUP,
|
|
32
|
+
DataSinkRegistry,
|
|
33
|
+
DataSourceRegistry,
|
|
34
|
+
open_sink,
|
|
35
|
+
open_source,
|
|
36
|
+
register_sink,
|
|
37
|
+
register_source,
|
|
38
|
+
)
|
|
26
39
|
from .s3 import S3ParquetSource
|
|
27
40
|
from .scan_identity import ScanIdentity, SourceIdentity
|
|
28
41
|
from .schema import (
|
|
@@ -53,8 +66,9 @@ from .tables import (
|
|
|
53
66
|
WatchPosition,
|
|
54
67
|
)
|
|
55
68
|
from .view import DEFAULT_MAPPING, DataViewFileSystem, ViewEntry
|
|
69
|
+
from .writable import SinkBinding, SinkDataSource
|
|
56
70
|
|
|
57
|
-
__version__ = "0.
|
|
71
|
+
__version__ = "0.11.0"
|
|
58
72
|
|
|
59
73
|
__all__ = [
|
|
60
74
|
"CONVERTER_ENTRY_POINT_GROUP",
|
|
@@ -62,6 +76,10 @@ __all__ = [
|
|
|
62
76
|
"DEFAULT_MAPPING",
|
|
63
77
|
"DEFAULT_REGISTRY",
|
|
64
78
|
"DEFAULT_SCHEMA_RESOLVERS",
|
|
79
|
+
"DEFAULT_SINKS",
|
|
80
|
+
"DEFAULT_SOURCES",
|
|
81
|
+
"SINK_ENTRY_POINT_GROUP",
|
|
82
|
+
"SOURCE_ENTRY_POINT_GROUP",
|
|
65
83
|
"AsyncDecodedBatchStream",
|
|
66
84
|
"AsyncTableWatcher",
|
|
67
85
|
"BatchReceipt",
|
|
@@ -73,7 +91,9 @@ __all__ = [
|
|
|
73
91
|
"ConverterRegistry",
|
|
74
92
|
"DataFormat",
|
|
75
93
|
"DataSink",
|
|
94
|
+
"DataSinkRegistry",
|
|
76
95
|
"DataSource",
|
|
96
|
+
"DataSourceRegistry",
|
|
77
97
|
"DataViewFileSystem",
|
|
78
98
|
"DataWriter",
|
|
79
99
|
"DecodedBatchStream",
|
|
@@ -100,6 +120,8 @@ __all__ = [
|
|
|
100
120
|
"SchemaProvenance",
|
|
101
121
|
"SchemaRef",
|
|
102
122
|
"SchemaResolverRegistry",
|
|
123
|
+
"SinkBinding",
|
|
124
|
+
"SinkDataSource",
|
|
103
125
|
"SinkOptions",
|
|
104
126
|
"SourceIdentity",
|
|
105
127
|
"TableSnapshot",
|
|
@@ -111,7 +133,12 @@ __all__ = [
|
|
|
111
133
|
"WatchPosition",
|
|
112
134
|
"__version__",
|
|
113
135
|
"json_schema_to_arrow",
|
|
136
|
+
"open_sink",
|
|
137
|
+
"open_source",
|
|
114
138
|
"plan_schema",
|
|
139
|
+
"register_codec",
|
|
140
|
+
"register_sink",
|
|
141
|
+
"register_source",
|
|
115
142
|
"resolve_schema",
|
|
116
143
|
"scan_parquet_async",
|
|
117
144
|
]
|
|
@@ -17,6 +17,7 @@ from fsspec import AbstractFileSystem
|
|
|
17
17
|
|
|
18
18
|
from .async_scan import AsyncDecodedBatchStream, scan_parquet_async
|
|
19
19
|
from .interchange import DEFAULT_REGISTRY, DataFormat, DecodedBatchStream, _rust
|
|
20
|
+
from .sink import DataSink, DataWriter
|
|
20
21
|
|
|
21
22
|
|
|
22
23
|
class Facet(str, Enum):
|
|
@@ -43,11 +44,17 @@ class Node:
|
|
|
43
44
|
path: str
|
|
44
45
|
facets: frozenset[Facet]
|
|
45
46
|
native_format: DataFormat | None = None
|
|
47
|
+
writable: frozenset[Facet] = frozenset()
|
|
46
48
|
|
|
47
|
-
def __init__(
|
|
49
|
+
def __init__(
|
|
50
|
+
self, path: str, facets: Iterable[Facet | str], native_format: DataFormat | str | None = None, *, writable: Iterable[Facet | str] = ()
|
|
51
|
+
) -> None:
|
|
48
52
|
object.__setattr__(self, "path", path)
|
|
49
53
|
object.__setattr__(self, "facets", frozenset(Facet(facet) for facet in facets))
|
|
50
54
|
object.__setattr__(self, "native_format", DataFormat(native_format) if native_format is not None else None)
|
|
55
|
+
object.__setattr__(self, "writable", frozenset(Facet(facet) for facet in writable))
|
|
56
|
+
if not self.writable <= self.facets:
|
|
57
|
+
raise ValueError("writable facets must also be offered by the node")
|
|
51
58
|
|
|
52
59
|
def has(self, facet: Facet | str) -> bool:
|
|
53
60
|
return Facet(facet) in self.facets
|
|
@@ -140,6 +147,13 @@ class DataSource:
|
|
|
140
147
|
"""Scan asynchronously with selection and limits; requires backend support."""
|
|
141
148
|
raise NotImplementedError("this data source does not support asynchronous scans")
|
|
142
149
|
|
|
150
|
+
def invalidate_cache(self, path: str | None = None) -> None:
|
|
151
|
+
"""Refresh cached descriptions or reads after publication, if this source caches."""
|
|
152
|
+
|
|
153
|
+
def sink(self, path: str) -> DataSink[Any, DataWriter[Any, Any, Any]]:
|
|
154
|
+
"""Return an explicitly configured table sink; sources are read-only by default."""
|
|
155
|
+
raise NotImplementedError(f"{path}: this source has no table sink")
|
|
156
|
+
|
|
143
157
|
def open_raw(self, path: str) -> BinaryIO:
|
|
144
158
|
raise FacetNotSupportedError(path, Facet.RAW)
|
|
145
159
|
|
|
@@ -157,12 +171,15 @@ class FileDataSource(DataSource):
|
|
|
157
171
|
self.fs = fs
|
|
158
172
|
self.sample_size = sample_size
|
|
159
173
|
|
|
174
|
+
def invalidate_cache(self, path: str | None = None) -> None:
|
|
175
|
+
self.fs.invalidate_cache(path)
|
|
176
|
+
|
|
160
177
|
def _node(self, info: dict[str, Any]) -> Node:
|
|
161
178
|
path = self.fs._strip_protocol(info["name"])
|
|
162
179
|
if info["type"] == "directory":
|
|
163
180
|
return Node(path, [Facet.CHILDREN, Facet.METADATA])
|
|
164
181
|
format = DataFormat.from_path(path)
|
|
165
|
-
if format is None:
|
|
182
|
+
if format is None or not DEFAULT_REGISTRY.get(format).capabilities.decode:
|
|
166
183
|
return Node(path, [Facet.RAW, Facet.METADATA])
|
|
167
184
|
return Node(path, [Facet.TABLE, Facet.RAW, Facet.METADATA], format)
|
|
168
185
|
|
|
@@ -173,7 +190,7 @@ class FileDataSource(DataSource):
|
|
|
173
190
|
return format
|
|
174
191
|
|
|
175
192
|
def _decode_schema(self, path: str, format: DataFormat) -> pa.Schema | None:
|
|
176
|
-
if
|
|
193
|
+
if not DEFAULT_REGISTRY.get(format).capabilities.needs_schema:
|
|
177
194
|
return None
|
|
178
195
|
with self.fs.open(path, "rb") as file:
|
|
179
196
|
sample = file.read(self.sample_size + 1)
|
|
@@ -223,14 +240,15 @@ class FileDataSource(DataSource):
|
|
|
223
240
|
byte_limit: int | None = None,
|
|
224
241
|
) -> DecodedBatchStream:
|
|
225
242
|
format = self._table_format(path)
|
|
226
|
-
if format == DataFormat.PARQUET:
|
|
243
|
+
if format == DataFormat.PARQUET and DEFAULT_REGISTRY.get(format).builtin:
|
|
227
244
|
condition = None
|
|
228
245
|
first_read = True
|
|
229
246
|
|
|
230
247
|
def fetch(ranges):
|
|
231
248
|
nonlocal condition, first_read
|
|
232
|
-
|
|
233
|
-
|
|
249
|
+
read_ranges = getattr(self.fs, "read_ranges", None)
|
|
250
|
+
if callable(read_ranges):
|
|
251
|
+
result = read_ranges(path, ranges, condition=condition)
|
|
234
252
|
if first_read:
|
|
235
253
|
if result.validator is not None:
|
|
236
254
|
from fsspec_rs import Match
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
import importlib.metadata
|
|
4
|
+
import json
|
|
5
|
+
import re
|
|
6
|
+
import threading
|
|
3
7
|
from collections.abc import Callable, Iterable, Mapping, Sequence
|
|
4
|
-
from dataclasses import dataclass, replace
|
|
8
|
+
from dataclasses import asdict, dataclass, field, replace
|
|
5
9
|
from enum import Enum
|
|
6
10
|
from importlib import import_module
|
|
7
11
|
from itertools import chain
|
|
@@ -23,24 +27,23 @@ class DataFormat(str, Enum):
|
|
|
23
27
|
AVRO = "avro"
|
|
24
28
|
|
|
25
29
|
@classmethod
|
|
26
|
-
def
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
def _missing_(cls, value):
|
|
31
|
+
if not isinstance(value, str):
|
|
32
|
+
raise TypeError("format must be a name")
|
|
33
|
+
value = value.strip().lower()
|
|
34
|
+
if not re.fullmatch(r"[a-z][a-z0-9+.-]*", value):
|
|
35
|
+
raise ValueError("invalid format name")
|
|
36
|
+
if value in cls._value2member_map_:
|
|
37
|
+
return cls._value2member_map_[value]
|
|
38
|
+
member = str.__new__(cls, value)
|
|
39
|
+
member._name_ = value
|
|
40
|
+
member._value_ = value
|
|
41
|
+
return member
|
|
33
42
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"pq": DataFormat.PARQUET,
|
|
39
|
-
"csv": DataFormat.CSV,
|
|
40
|
-
"jsonl": DataFormat.JSONL,
|
|
41
|
-
"ndjson": DataFormat.JSONL,
|
|
42
|
-
"avro": DataFormat.AVRO,
|
|
43
|
-
}
|
|
43
|
+
@classmethod
|
|
44
|
+
def from_path(cls, path: str) -> DataFormat | None:
|
|
45
|
+
"""Resolve registered suffixes, loading codec entry points when necessary."""
|
|
46
|
+
return DEFAULT_REGISTRY.from_path(path)
|
|
44
47
|
|
|
45
48
|
|
|
46
49
|
class SchemaPolicy(str, Enum):
|
|
@@ -55,6 +58,10 @@ class CodecCapabilities:
|
|
|
55
58
|
encode: bool
|
|
56
59
|
decode: bool
|
|
57
60
|
streaming: bool
|
|
61
|
+
needs_schema: bool = False
|
|
62
|
+
infers_schema: bool = False
|
|
63
|
+
column_selection: bool = False
|
|
64
|
+
row_selection: bool = False
|
|
58
65
|
|
|
59
66
|
|
|
60
67
|
@dataclass(frozen=True)
|
|
@@ -104,6 +111,10 @@ class PlannedBatchStream:
|
|
|
104
111
|
class Codec:
|
|
105
112
|
format: DataFormat
|
|
106
113
|
capabilities: CodecCapabilities
|
|
114
|
+
suffixes: tuple[str, ...] = ()
|
|
115
|
+
media_type: str = "application/octet-stream"
|
|
116
|
+
builtin: bool = False
|
|
117
|
+
_codec: Any = field(default=None, repr=False, compare=False)
|
|
107
118
|
|
|
108
119
|
def encode_batches(
|
|
109
120
|
self,
|
|
@@ -120,7 +131,7 @@ class Codec:
|
|
|
120
131
|
for batch in batches:
|
|
121
132
|
if not isinstance(batch, pa.RecordBatch):
|
|
122
133
|
raise TypeError("batches must contain pyarrow.RecordBatch objects")
|
|
123
|
-
return _rust.encode_batches(self.format.value, schema, batches)
|
|
134
|
+
return _rust.encode_batches(self.format.value, schema, batches, self._codec)
|
|
124
135
|
|
|
125
136
|
def encode_batches_to(
|
|
126
137
|
self,
|
|
@@ -140,7 +151,7 @@ class Codec:
|
|
|
140
151
|
schema = first.schema
|
|
141
152
|
batches = chain((first,), batches)
|
|
142
153
|
schema = _ensure_pyarrow(schema)
|
|
143
|
-
writer = _rust.start_codec_writer(self.format.value, schema, output)
|
|
154
|
+
writer = _rust.start_codec_writer(self.format.value, schema, output, self._codec)
|
|
144
155
|
for batch in batches:
|
|
145
156
|
if not isinstance(batch, pa.RecordBatch):
|
|
146
157
|
raise TypeError("batches must contain pyarrow.RecordBatch objects")
|
|
@@ -157,7 +168,7 @@ class Codec:
|
|
|
157
168
|
"""Infer a schema from the start of an encoded source. CSV and JSONL support
|
|
158
169
|
inference. A ``truncated`` sample, such as the first bytes of a larger file, may end
|
|
159
170
|
inside a record, which is ignored."""
|
|
160
|
-
return _rust.infer_schema(self.format.value, bytes(sample), max_records, truncated)
|
|
171
|
+
return _rust.infer_schema(self.format.value, bytes(sample), max_records, truncated, self._codec)
|
|
161
172
|
|
|
162
173
|
def decode_batches(
|
|
163
174
|
self,
|
|
@@ -203,6 +214,7 @@ class Codec:
|
|
|
203
214
|
byte_limit,
|
|
204
215
|
columns,
|
|
205
216
|
row_offset,
|
|
217
|
+
self._codec,
|
|
206
218
|
)
|
|
207
219
|
elif hasattr(data, "read"):
|
|
208
220
|
decoded_schema, native = _rust.decode_reader(
|
|
@@ -214,6 +226,7 @@ class Codec:
|
|
|
214
226
|
byte_limit,
|
|
215
227
|
columns,
|
|
216
228
|
row_offset,
|
|
229
|
+
self._codec,
|
|
217
230
|
)
|
|
218
231
|
else:
|
|
219
232
|
raise TypeError("data must be bytes-like or a binary file-like object")
|
|
@@ -221,13 +234,94 @@ class Codec:
|
|
|
221
234
|
|
|
222
235
|
|
|
223
236
|
class CodecRegistry:
|
|
237
|
+
"""Independent codec registrations; the default registry is shared with Rust."""
|
|
238
|
+
|
|
239
|
+
def __init__(self, *, discover_entry_points: bool = True, _shared: bool = False):
|
|
240
|
+
self._native = None if _shared else _rust.NativeCodecRegistry()
|
|
241
|
+
self._discover_entry_points = discover_entry_points
|
|
242
|
+
self._entries = None
|
|
243
|
+
self._loaded = set()
|
|
244
|
+
self._loading = threading.local()
|
|
245
|
+
self._lock = threading.RLock()
|
|
246
|
+
|
|
247
|
+
def register(
|
|
248
|
+
self,
|
|
249
|
+
name: str,
|
|
250
|
+
implementation,
|
|
251
|
+
*,
|
|
252
|
+
suffixes: Sequence[str],
|
|
253
|
+
capabilities: CodecCapabilities,
|
|
254
|
+
media_type: str = "application/octet-stream",
|
|
255
|
+
replace: bool = False,
|
|
256
|
+
) -> None:
|
|
257
|
+
name = DataFormat(name).value
|
|
258
|
+
if capabilities.decode and not callable(getattr(implementation, "iter_batches", None)):
|
|
259
|
+
raise TypeError("decoding codecs require iter_batches")
|
|
260
|
+
if capabilities.encode and not callable(getattr(implementation, "encode_batches_to", None)):
|
|
261
|
+
raise TypeError("encoding codecs require encode_batches_to")
|
|
262
|
+
if capabilities.infers_schema and not callable(getattr(implementation, "infer_schema", None)):
|
|
263
|
+
raise TypeError("schema inference requires infer_schema")
|
|
264
|
+
descriptor = {"name": name, "suffixes": list(suffixes), "media_type": media_type, "capabilities": asdict(capabilities)}
|
|
265
|
+
_rust.register_codec(self._native, json.dumps(descriptor), implementation, replace)
|
|
266
|
+
|
|
267
|
+
def _discover(self, name: str) -> None:
|
|
268
|
+
if not self._discover_entry_points:
|
|
269
|
+
return
|
|
270
|
+
with self._lock:
|
|
271
|
+
if self._entries is None:
|
|
272
|
+
entries = {}
|
|
273
|
+
for entry in importlib.metadata.entry_points(group="fsspec_data.codecs"):
|
|
274
|
+
entries.setdefault(DataFormat(entry.name).value, []).append(entry)
|
|
275
|
+
self._entries = entries
|
|
276
|
+
names = list(self._entries) if name == "*" else [name]
|
|
277
|
+
for candidate in names:
|
|
278
|
+
with self._lock:
|
|
279
|
+
if candidate in self._loaded or _rust.codec_registered(self._native, candidate):
|
|
280
|
+
continue
|
|
281
|
+
entries = self._entries.get(candidate, [])
|
|
282
|
+
if len(entries) > 1:
|
|
283
|
+
raise ValueError(f"duplicate fsspec_data.codecs entry points for {candidate!r}")
|
|
284
|
+
if not entries:
|
|
285
|
+
continue
|
|
286
|
+
entry = entries[0]
|
|
287
|
+
# The entry point exports a codec object with registration metadata.
|
|
288
|
+
loading = getattr(self._loading, "names", set())
|
|
289
|
+
if candidate in loading:
|
|
290
|
+
raise RuntimeError(f"recursive codec entry point lookup for {candidate!r}")
|
|
291
|
+
self._loading.names = loading | {candidate}
|
|
292
|
+
try:
|
|
293
|
+
codec = entry.load()
|
|
294
|
+
finally:
|
|
295
|
+
self._loading.names = loading
|
|
296
|
+
with self._lock:
|
|
297
|
+
if _rust.codec_registered(self._native, candidate):
|
|
298
|
+
continue
|
|
299
|
+
try:
|
|
300
|
+
self.register(candidate, codec, suffixes=codec.suffixes, capabilities=codec.capabilities, media_type=codec.media_type)
|
|
301
|
+
except ValueError:
|
|
302
|
+
if not _rust.codec_registered(self._native, candidate):
|
|
303
|
+
raise
|
|
304
|
+
self._loaded.add(candidate)
|
|
305
|
+
|
|
224
306
|
def get(self, format: DataFormat | str) -> Codec:
|
|
225
307
|
format = DataFormat(format)
|
|
226
|
-
|
|
227
|
-
|
|
308
|
+
self._discover(format.value)
|
|
309
|
+
codec, descriptor, builtin = _rust.select_codec(self._native, format.value)
|
|
310
|
+
descriptor = json.loads(descriptor)
|
|
311
|
+
return Codec(format, CodecCapabilities(**descriptor["capabilities"]), tuple(descriptor["suffixes"]), descriptor["media_type"], builtin, codec)
|
|
312
|
+
|
|
313
|
+
def descriptors(self) -> list[dict[str, Any]]:
|
|
314
|
+
"""List installed codecs without importing entry points."""
|
|
315
|
+
return json.loads(_rust.codec_descriptors(self._native))
|
|
316
|
+
|
|
317
|
+
def from_path(self, path: str) -> DataFormat | None:
|
|
318
|
+
self._discover("*")
|
|
319
|
+
name = _rust.codec_from_path(self._native, path)
|
|
320
|
+
return DataFormat(name) if name is not None else None
|
|
228
321
|
|
|
229
322
|
|
|
230
|
-
DEFAULT_REGISTRY = CodecRegistry()
|
|
323
|
+
DEFAULT_REGISTRY = CodecRegistry(_shared=True)
|
|
324
|
+
register_codec = DEFAULT_REGISTRY.register
|
|
231
325
|
|
|
232
326
|
|
|
233
327
|
@dataclass(frozen=True)
|
|
@@ -333,7 +427,7 @@ class InterchangePlan:
|
|
|
333
427
|
row_limit: int | None = None,
|
|
334
428
|
byte_limit: int | None = None,
|
|
335
429
|
) -> PlannedBatchStream:
|
|
336
|
-
decode_schema = self.provided_schema if self.provided_format
|
|
430
|
+
decode_schema = self.provided_schema if DEFAULT_REGISTRY.get(self.provided_format).capabilities.needs_schema else None
|
|
337
431
|
source = DEFAULT_REGISTRY.get(self.provided_format).iter_batches(
|
|
338
432
|
data,
|
|
339
433
|
schema=decode_schema,
|