Skip to main content

Ascender MinIO SDK

Overview

The Ascender MinIO SDK is a storage service built for the Ascender Framework, supporting Amazon S3 and other S3-compatible storage providers. It integrates smoothly with Dependency Injection (DI) and simplifies common object storage tasks like:

  • Uploading, downloading, and deleting files
  • Managing buckets
  • Generating pre-signed URLs
  • Listing objects in a bucket

Installation

Create a new ascender framework project or use existing:

ascender new --name my_project

Navigate to the project directory:

cd my_project

To install the SDK with Poetry:

poetry add ascender-minio

Usage

1. Register MinIO in appBootstrap

In bootstrap.py:

from ascender.core.types import IBootstrap
from minio.minio_provider import provideMinio

appBootstrap: IBootstrap = {
    "providers": [
        provideMinio(
            minio_endpoint="http://localhost:9000",
            minio_access_key="your-access-key",
            minio_secret_key="your-secret-key"
        )
    ]
}

2. Inject MinioService into a Controller

In main_controller.py:

from ascender.core import Controller, Post, Get
from minio_service import MinioService

@Controller(standalone=False)
class MainController:
    def __init__(self, minio_service: MinioService):
        self.minio = minio_service

    @Post("upload")
    async def upload_file(self, bucket: str, key: str, data: bytes):
        """Upload a file to MinIO."""
        return await self.minio.put_object(
            Bucket=bucket, Key=key, Data=data,
            ContentLength=len(data), ContentType="application/octet-stream"
        )

    @Get("download/{bucket}/{key}")
    async def download_file(self, bucket: str, key: str):
        """Download a file from MinIO."""
        return await self.minio.read_object(Bucket=bucket, Key=key)

    @Get("list/{bucket}")
    async def list_files(self, bucket: str):
        """List all files in a bucket."""
        return await self.minio.list_objects(Bucket=bucket)

    @Get("presigned/{bucket}/{key}")
    async def generate_presigned_url(self, bucket: str, key: str):
        """Generate a pre-signed URL for a file."""
        return await self.minio.generate_presigned_url(Bucket=bucket, Key=key)

    @Post("delete/{bucket}/{key}")
    async def delete_file(self, bucket: str, key: str):
        """Delete a file from MinIO."""
        return await self.minio.remove_object(Bucket=bucket, Key=key)

3. Example Usage

Uploading a File

POST /upload
Content-Type: application/octet-stream

{
    "bucket": "my-bucket",
    "key": "file.txt",
    "data": "SGVsbG8gV29ybGQh"
}

Downloading a File

GET /download/my-bucket/file.txt

Listing Files in a Bucket

GET /list/my-bucket

Generating a Pre-signed URL

GET /presigned/my-bucket/file.txt

Deleting a File

POST /delete/my-bucket/file.txt

This setup ensures clean DI-based injection without exposing the inner workings of MinioService.

Metadata

Release files for ascender-minio 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ascender-minio 0.0.1
File Size Uploaded Provenance Actions
ascender_minio-0.0.1.tar.gz 3.8 kB Without provenance Details for ascender_minio-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ascender-minio 0.0.1
File Interpreter ABI Platform Actions
ascender_minio-0.0.1-py3-none-any.whl Python 3 none any Details for ascender_minio-0.0.1-py3-none-any.whl

Total release size: 8.7 kB

Release files / ascender_minio-0.0.1.tar.gz

Download URL ascender_minio-0.0.1.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
d0faa536501202a3bcac617ddc0f68d86aecb2369ad0b6c3629d051483c5dfd5
BLAKE2b-256 checksum
How to use checksums
81c0cae5c7fb66a678be1dfc3e22abc9917180a5e254ef6cf99c1601aec74c14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.11.10 Darwin/23.6.0

Release files / ascender_minio-0.0.1-py3-none-any.whl

Download URL ascender_minio-0.0.1-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bd85f6db55e5372c8e03ddf366f9bae819fd2ddf56289187b3cb07c8d83fc2eb
BLAKE2b-256 checksum
How to use checksums
46322a8e8d1f1ce3418b6b36cadef48d455601a8ee3d4b784ce0bb2cc989f144
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.11.10 Darwin/23.6.0

Security for ascender-minio 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page