55<a href =" https://github.com/psf/black " ><img alt =" code style: black " src =" https://img.shields.io/badge/code%20style-black-000000.svg " ></a >
66</p >
77
8- Recently the excellent [ ` object_store ` ] ( https://crates.io/crates/object_store ) crate has been
9- [ donated] ( https://www.influxdata.com/blog/rust-object-store-donation/ ) to the Apache Software Foundation.
8+ Recently, the excellent [ ` object_store ` ] ( https://crates.io/crates/object_store ) crate has been
9+ [ donated] ( https://www.influxdata.com/blog/rust-object-store-donation/ ) to the Apache Software Foundation
10+ And powers many popular projects like [ datafusion] ( https://github.com/apache/arrow-datafusion ) ,
11+ [ InfluxDB IOX] ( https://github.com/influxdata/influxdb_iox ) , [ delta-rs] ( https://github.com/delta-io/delta-rs ) , and more.
12+ THe ` object-store-python ` package provides python bindings as well some convenience and pythonic adjustments
13+ around the native APIs.
1014
11- ## Prerequisites
15+ ## Installation
1216
13- - [ poetry] ( https://python-poetry.org/docs/ )
14- - [ Rust toolchain] ( https://www.rust-lang.org/tools/install )
15- - [ just] ( https://github.com/casey/just#readme )
16-
17- ## Development
18-
19- If you do not have [ ` just ` ] ( < (https://github.com/casey/just#readme) > ) installed and do not wish to install it,
20- have a look at the [ ` justfile ` ] ( https://github.com/roeap/object-store-python/blob/main/justfile ) to see the raw commands.
21-
22- To set up the development environment, and install a dev version of the native package just run:
17+ The ` object-store-python ` package is available on PyPI and can be installed via
2318
2419``` sh
25- just init
20+ poetry add object-store-python
2621```
2722
28- This will also configure [ ` pre-commit ` ] ( https://pre-commit.com/ ) hooks in the repository.
29-
30- To run the rust as well as python tests:
23+ or using pip
3124
3225``` sh
33- just test
26+ pip install object-store-python
3427```
3528
3629## Usage
3730
31+ The main idea behind the ` ObjectStore ` API is to provide a common interface to various
32+ storage backends including the objects stores from most major cloud providers. The APIs
33+ are very focussed and taylored towards modern cloud native applications by hiding away
34+ many features (and complexities) encountered in full fledges file systems.
35+
36+ Among the included backend are:
37+
38+ - Amazon S3 and S3 compliant APIs
39+ - Google Cloud Storage Buckets
40+ - Azure Blob Gen1 and Gen2 accounts (including ADLS Gen2)
41+ - local storage
42+ - in-memory store
43+
44+ Additionally, an integration is provided to seamlessly work with the (py)arrow ecosystem.
45+
3846### ` ObjectStore ` api
3947
40- The ` object-store-python ` tries to directly exposes the APIs defined on the
41- [ ` ObjectStore ` ] ( https://docs.rs/object_store/latest/object_store/trait.ObjectStore.html ) trait
42- in the underlying rust crate.
48+ ``` py
49+ from object_store import ObjectStore, ObjectMeta
50+
51+ # we use an in-memory store for demonstration purposes.
52+ # data will not be persisted and is not shared across store instances
53+ store = ObjectStore(" memory://" )
54+
55+ store.put(" data" , b " some data" )
56+
57+ data = store.get(" data" )
58+ assert data == b " some data"
59+
60+ blobs = store.list()
61+
62+ meta: ObjectMeta = store.head(" data" )
63+
64+ range = store.get_range(" data" , start = 0 , length = 4 )
65+ assert range == b " some"
66+
67+ store.copy(" data" , " copied" )
68+ copied = store.get(" copied" )
69+ assert copied == data
70+ ```
4371
4472### with ` pyarrow `
4573
@@ -64,3 +92,30 @@ pq.write_table(table.slice(5, 10), "data/data2.parquet", filesystem=store)
6492
6593dataset = ds.dataset(" data" , format = " parquet" , filesystem = store)
6694```
95+
96+ ## Development
97+
98+ ### Prerequisites
99+
100+ - [ poetry] ( https://python-poetry.org/docs/ )
101+ - [ Rust toolchain] ( https://www.rust-lang.org/tools/install )
102+ - [ just] ( https://github.com/casey/just#readme )
103+
104+ ### Running tests
105+
106+ If you do not have [ ` just ` ] ( < (https://github.com/casey/just#readme) > ) installed and do not wish to install it,
107+ have a look at the [ ` justfile ` ] ( https://github.com/roeap/object-store-python/blob/main/justfile ) to see the raw commands.
108+
109+ To set up the development environment, and install a dev version of the native package just run:
110+
111+ ``` sh
112+ just init
113+ ```
114+
115+ This will also configure [ ` pre-commit ` ] ( https://pre-commit.com/ ) hooks in the repository.
116+
117+ To run the rust as well as python tests:
118+
119+ ``` sh
120+ just test
121+ ```
0 commit comments