A pathlib-like cloud agnostic object storage library
Project description
blob-path
A library providing a simple interface to storing your files in a cloud agnostic fashion
Features
-
Cloud-agnostic storage of files
-
Serialisation + De-serialisation: Allowing you to move your path objects around different processes, making it easy to handle remote file locations
-
Easy interactions between different kinds of cloud locations
- You could run
s3_path.cp(azure_blob_path)and it would just work
- You could run
Motivation
The library is meant for developers maintaining services in multiple clouds (or on-premise).
Storing files in a way that works across clouds always generally requires developers to come up with some abstraction. The easiest way to do it is to create interfaces which would abstract away certain abstractions (like upload, download, etc.). This becomes slightly cumbersome when you want to move your file paths around in different services across HTTP calls. Now you need to share some implicit environment between these services (like which S3 bucket to use), to reliably do any serialisation/de-serialisation operations on your file paths.
We provide a central interface BlobPath, it contains all abstracted functionality for working with different clouds, while giving an intuitive interface (bits of which are copied from pathlib). You can throw around this abstraction everywhere and it should just work.
Installation
Downloading the core library.
pip install blob-path
Cloud storage providers are provided as extra pip installation dependencies. Currently only AWS S3 and Azure Blob Storage are supported.
pip install 'blob-path[aws]'
pip install 'blob-path[azure]'
Usage
Basic example usage:
from blob_path.backends.s3 import S3BlobPath
from pathlib import PurePath
bucket_name = "my-bucket"
object_key = PurePath("hello_world.txt")
region = "us-east-1"
blob_path = S3BlobPath(bucket_name, region, object_key)
# check if the file exists
blob_path.exists()
# read the file
with blob_path.open("rb") as f:
# a file handle is returned here, just like `open`
print(f.read())
Check out the notebook Basic Usage for learning how to use this library
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file blob_path-0.1.2.tar.gz.
File metadata
- Download URL: blob_path-0.1.2.tar.gz
- Upload date:
- Size: 198.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
440e152ac2700f06bb86dc56b8e6614c7a4a5d9aec18e694cbb903d5fe219c75
|
|
| MD5 |
5348086f8c36bee9d4cb9df983b4fc34
|
|
| BLAKE2b-256 |
66594032dde7944603b360f16d21ac5ecd5657a4729bf1a87a3bce05e6741ff8
|
File details
Details for the file blob_path-0.1.2-py3-none-any.whl.
File metadata
- Download URL: blob_path-0.1.2-py3-none-any.whl
- Upload date:
- Size: 18.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1f5e92bc6dcd9a88c3f922a16614ad22fad4f54eee9e6708b29d2baff06609f
|
|
| MD5 |
93838e4424ffb3a4f0524eea7ef9c6bf
|
|
| BLAKE2b-256 |
825789c76ea68c9df88ce1c57f1a07892c9be9e9520f2b2e65e71d4b89c5d6b6
|