Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

skyio-1.0.0.tar.gz (60.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

skyio-1.0.0-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

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

Hashes for skyio-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b96feb6ea4e5ff7c0601b282877d8c972995396326cbeeddfcb079c2cd81a3ce
MD5 0e8f2f398b91d68cc43d9b187e1de0ad
BLAKE2b-256 681bac3323a607a8c922f41314b7ed06c2a63b568e5adf48e67d4abfaedcc89e

See more details on using hashes here.

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

Hashes for skyio-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1bf3bcff9610f283b542356308d2f9bb6c16293164046c06a8257d1732a0282e
MD5 836d521db0302047ceff6b95f722e8f5
BLAKE2b-256 579e954de6d36072a54a01948f8978511274ba002557d41ee054bd978f6b5090

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page