This library provides a simple interface to interact with Google Cloud Storage and other cloud storage services.
Project description
cloudfspy
cloudfspy is a Python library that offers a pathlib-style interface for interacting with various cloud storage services, including Amazon S3, Azure Blob Storage, and Google Cloud Storage. It provides a simple and consistent API, modeled after the Path class from the pathlib module, enabling seamless access and manipulation of files and folder in cloud storage. Currently, cloudfspy supports the following cloud storage services:
- Google Cloud Storage (GCS)
- Amazon S3
- Azure Blob Storage
- Dropbox
- OneDrive
- FTP/SFTP
Installation
pip install cloudfspy
Usage
cloudfspy uses a GenericPath class that is a subclass of pathlib.Path. This class provides a consistent interface for accessing files on cloud storage services.
Downloading and Uploading Files
from cloudfspy import GenericPath as Path
# Download a file from GCS to a local file
from_path = Path("gs://my-bucket/my-file.txt")
to_path = Path("/path/to/my-file.txt")
from_path.download_to(to_path)
# Upload a local file to GCS
from_path = Path("/path/to/my-file.txt")
to_path = Path("gs://my-bucket/my-file.txt")
from_path.upload_to(to_path)
Working with Directories
from cloudfspy import GenericPath as Path
# Create a directory on GCS
cloud_dir = Path("gs://my-bucket/my-directory")
cloud_dir.mkdir(exist_ok=True, parents=True)
# Iterate over the files in a directory
for file in cloud_dir.iterdir():
print(file)
# Remove a directory
cloud_dir.rmdir()
Metadata
from cloudfspy import GenericPath as Path
# Get the metadata of a file
cloud_file = Path("gs://my-bucket/my-file.txt")
metadata = cloud_file.metadata
# Set the metadata of a file
cloud_file.metadata = {"description": "My file"}
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 skyio-1.0.0.tar.gz.
File metadata
- Download URL: skyio-1.0.0.tar.gz
- Upload date:
- Size: 60.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b96feb6ea4e5ff7c0601b282877d8c972995396326cbeeddfcb079c2cd81a3ce
|
|
| MD5 |
0e8f2f398b91d68cc43d9b187e1de0ad
|
|
| BLAKE2b-256 |
681bac3323a607a8c922f41314b7ed06c2a63b568e5adf48e67d4abfaedcc89e
|
File details
Details for the file skyio-1.0.0-py3-none-any.whl.
File metadata
- Download URL: skyio-1.0.0-py3-none-any.whl
- Upload date:
- Size: 13.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1bf3bcff9610f283b542356308d2f9bb6c16293164046c06a8257d1732a0282e
|
|
| MD5 |
836d521db0302047ceff6b95f722e8f5
|
|
| BLAKE2b-256 |
579e954de6d36072a54a01948f8978511274ba002557d41ee054bd978f6b5090
|