Skip to main content

Storage functionality for Mindtrace

Project description

PyPI version License Downloads

Storage Module

This directory contains the storage-related components for the Mindtrace project. It provides abstractions and implementations for interacting with various storage backends, such as Google Cloud Storage (GCS).

Structure

  • mindtrace/storage — Contains the core storage handler implementations and interfaces.
  • pyproject.toml — Build and dependency configuration for the storage package.

Main Components

  • base.py: Defines the abstract StorageHandler interface for storage operations.
  • gcs.py: Implements GCSStorageHandler, a wrapper around Google Cloud Storage APIs for uploading, downloading, listing, and managing objects in GCS buckets.

Google Cloud Storage (GCS) Usage

Usage Example

To use the GCS storage handler:

from mindtrace.storage.gcs import GCSStorageHandler

handler = GCSStorageHandler(
    bucket_name="your-bucket-name",
    project_id="your-gcp-project-id",
    credentials_path="/path/to/service-account.json",  # Optional if using ADC
    create_if_missing=True,
)

# Upload a file
gcs_uri = handler.upload("local_file.txt", "remote/path/in/bucket.txt")

# List objects
print(handler.list_objects(prefix="remote/path/"))

Available GCS APIs

The following methods are available via the GCSStorageHandler for explicit use:

  • upload(local_path, remote_path, metadata=None): Upload a local file to a GCS bucket.
  • download(remote_path, local_path): Download a file from GCS to a local path.
  • delete(remote_path): Delete an object from the GCS bucket.
  • list_objects(prefix="", max_results=None): List objects in the bucket, optionally filtered by prefix.
  • exists(remote_path): Check if an object exists in the bucket.
  • get_presigned_url(remote_path, expiration_minutes=60, method="GET"): Generate a presigned URL for accessing an object.
  • get_object_metadata(remote_path): Retrieve metadata for a specific object.

Notes

  • Ensure you have the required Google Cloud credentials and permissions to access the target bucket.
  • For local development, you can use gcloud auth application-default login to set up default credentials.

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

mindtrace_storage-0.10.1.tar.gz (16.2 kB view details)

Uploaded Source

Built Distribution

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

mindtrace_storage-0.10.1-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

File details

Details for the file mindtrace_storage-0.10.1.tar.gz.

File metadata

  • Download URL: mindtrace_storage-0.10.1.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for mindtrace_storage-0.10.1.tar.gz
Algorithm Hash digest
SHA256 69d7a2a25ae9a862b1de9403029f476342411092b1f4350f9097d4868e54c854
MD5 1871f616034f925c9757a1708b3e5cc4
BLAKE2b-256 5c006d0de163b12a37def4f4992e68502b184902383ba31bfa0dfa1b7723ed80

See more details on using hashes here.

File details

Details for the file mindtrace_storage-0.10.1-py3-none-any.whl.

File metadata

  • Download URL: mindtrace_storage-0.10.1-py3-none-any.whl
  • Upload date:
  • Size: 18.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for mindtrace_storage-0.10.1-py3-none-any.whl
Algorithm Hash digest
SHA256 722c1f15afea11c3f243afd5ad44f512b5fd1ee17eab53caa894dd6355174f33
MD5 9aba003c918c2e128538d1ab181a12e1
BLAKE2b-256 6c9459459ac4179f0524014ff78c67f98132cdd05ceca5a15e32afb54d62fd9a

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