You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+2-3
Original file line number
Diff line number
Diff line change
@@ -22,11 +22,10 @@ The simplest, highest-throughput [^1] Python interface to [S3][s3], [GCS][gcs],
22
22
-**Streaming uploads** from files or async or sync iterators.
23
23
-**Streaming list**, with no need to paginate.
24
24
- Automatic [**multipart uploads**](https://docs.aws.amazon.com/AmazonS3/latest/userguide/mpuoverview.html) for large file objects.
25
+
- File-like object API and [fsspec](https://github.com/fsspec/filesystem_spec) integration.
26
+
- Easy to install with **no required Python dependencies**.
25
27
- Support for **conditional put** ("put if not exists"), as well as custom tags and attributes.
26
28
- Optionally return list results in [Apache Arrow](https://arrow.apache.org/) format, which is faster and more memory-efficient than materializing Python `dict`s.
27
-
- File-like object API and [fsspec](https://github.com/fsspec/filesystem_spec) integration.
28
-
- Easy to install with no required Python dependencies.
29
-
- The [underlying Rust library](https://docs.rs/object_store) is production quality and used in large scale production systems, such as the Rust package registry [crates.io](https://crates.io/).
30
29
- Zero-copy data exchange between Rust and Python via the [buffer protocol](https://jakevdp.github.io/blog/2014/05/05/introduction-to-the-python-buffer-protocol/).
31
30
32
31
<!-- For Rust developers looking to add object_store support to their Python packages, refer to pyo3-object_store. -->
Construct an fsspec-compatible filesystem with [`FsspecStore`][obstore.fsspec.FsspecStore]. This implements [`AbstractFileSystem`][fsspec.spec.AbstractFileSystem], so you can use it wherever an API expects an fsspec-compatible filesystem.
Using the `FsspecStore` class directly may be preferred because the type hinting should work automatically, which may help IDEs like VSCode suggest valid keyword parameters.
50
+
51
+
### Register as a global handler
52
+
53
+
Use [`register`][obstore.fsspec.register] to register obstore as the default
54
+
handler for various protocols. Then use [`fsspec.filesystem`][] to create an
55
+
fsspec filesystem object for a specific protocol. Or use [`fsspec.open`][] to
56
+
open a file given a URL.
57
+
58
+
```py
59
+
import fsspec
60
+
from obstore.fsspec import register
61
+
62
+
# Register obstore as the default handler for all protocols supported by
63
+
# obstore.
64
+
# You may wish to register only specific protocols, instead.
65
+
register()
66
+
67
+
# Create a new fsspec filesystem for the given protocol
Some stores may require configuration. You may pass configuration parameters to the [`FsspecStore`][obstore.fsspec.FsspecStore] constructor directly. Or, if you're using [`fsspec.filesystem`][], you may pass configuration parameters to that call, which will pass parameters down to the `FsspecStore` constructor internally.
The fsspec API is not conducive to type checking. The easiest way to get type hinting for parameters is to use [`FsspecStore`][obstore.fsspec.FsspecStore] to construct fsspec-compatible stores instead of [`fsspec.filesystem`][].
103
+
104
+
[`fsspec.open`][] and [`fsspec.filesystem`][] take arbitrary keyword arguments that they pass down to the underlying store, and these pass-through arguments are not typed.
105
+
106
+
However, it is possible to get type checking of store configuration by defining config parameters as a dictionary:
Then your type checker will validate that the `config` dictionary is compatible with [`S3ConfigInput`][obstore.store.S3ConfigInput]. VSCode also provides auto suggestions for parameters:
127
+
128
+

129
+
130
+
!!! note
131
+
132
+
`S3ConfigInput` is a "type-only" construct, and so it needs to be imported from within an `if TYPE_CHECKING` block. Additionally, `from __future__ import annotations` must be at the top of the file.
0 commit comments