Skip to main content

simple_module_file_storage

Pluggable file-upload + storage module for simple_module apps. Defaults to local-disk storage for development; install the [s3] extra to switch to any S3-compatible backend via aioboto3.

Install

# local-disk storage (dev default)
pip install simple_module_file_storage

# S3-compatible storage (production)
pip install "simple_module_file_storage[s3]"

What it provides

  • POST /api/file-storage/upload multipart upload endpoint.
  • GET /api/file-storage/files (paged list), GET /api/file-storage/files/{file_id} (metadata), GET /api/file-storage/files/{file_id}/download (signed-URL redirect or stream), DELETE /api/file-storage/files/{file_id}.
  • Pluggable backend selected by the backend setting (filesystem default | s3); third-party backends can register under any id.
  • Settings (backend, s3_bucket, s3_region, s3_endpoint_url for R2/MinIO/etc., s3_access_key_id, s3_secret_access_key, s3_presign_ttl_seconds) are configured from the DB settings store via the admin UI — they are not read from SM_FILE_STORAGE_* environment variables at runtime.

Usage

From another module, inject the service via its dependency:

from fastapi import Depends, File, UploadFile

from file_storage.deps import get_file_storage_service  # type: ignore[import-not-found]
from file_storage.service import FileStorageService  # type: ignore[import-not-found]


async def attach_receipt(
    upload: UploadFile = File(...),
    svc: FileStorageService = Depends(get_file_storage_service),
):
    record = await svc.upload(upload)
    return {"file_id": record.id}

Backend and S3 credentials are configured from the admin UI at /settings/modules → FileStorage (DB-backed settings); switch backend to s3 and fill in s3_bucket, s3_region, s3_endpoint_url (for MinIO/R2), s3_access_key_id, and s3_secret_access_key.

Depends on

  • simple_module_core, simple_module_db, simple_module_hosting, simple_module_settings
  • aiofiles
  • Optional: aioboto3 (install the [s3] extra)

License

MIT — see LICENSE.

Download files

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

Source Distribution

simple_module_file_storage-0.0.33.tar.gz (50.8 kB view details)

Uploaded Source

Built Distribution

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

simple_module_file_storage-0.0.33-py3-none-any.whl (51.9 kB view details)

Uploaded Python 3

File details

Details for the file simple_module_file_storage-0.0.33.tar.gz.

File metadata

File hashes

Hashes for simple_module_file_storage-0.0.33.tar.gz
Algorithm Hash digest
SHA256 1b6cc59783c2fc88b0ecf9df1928882e9f1cdc4563bd6da583a8d7d0a7b86569
MD5 cdb003c9eb51b0610724da0d8019d3b2
BLAKE2b-256 5e232c25fe44e974343ee9790f2a585dc397fd6f3d62c394c837948ab07d8324

See more details on using hashes here.

Provenance

The following attestation bundles were made for simple_module_file_storage-0.0.33.tar.gz:

Publisher: release.yml on antosubash/simple_module_python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file simple_module_file_storage-0.0.33-py3-none-any.whl.

File metadata

File hashes

Hashes for simple_module_file_storage-0.0.33-py3-none-any.whl
Algorithm Hash digest
SHA256 27cebf3eacaa3b57805bbde6ce2d9029033646ec4ad4dd1d5f85f2ced4334d79
MD5 c623b6c0c18df30efbd278f40c42c36a
BLAKE2b-256 0f0a5647802a9488c0464b564c8ea44588abd47ec28cf8c3df2c891f8f9441db

See more details on using hashes here.

Provenance

The following attestation bundles were made for simple_module_file_storage-0.0.33-py3-none-any.whl:

Publisher: release.yml on antosubash/simple_module_python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.0.33 This release

2 files

0.0.32

2 files

0.0.31

2 files

0.0.30

2 files

0.0.29

2 files

0.0.28

2 files

0.0.27

2 files

0.0.26

2 files

0.0.25

2 files

0.0.24

2 files

0.0.23

2 files

0.0.22

2 files

0.0.21

2 files

0.0.20

2 files

0.0.19

2 files

0.0.18

2 files

0.0.17

2 files

0.0.16

2 files

0.0.15

2 files

0.0.14

2 files

0.0.13

2 files

0.0.12

2 files

0.0.11

2 files

0.0.10

2 files

0.0.9

2 files

0.0.8

2 files

0.0.7

2 files

0.0.6

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 files

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