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]"

Install simple_module_file_storage[tasks] to include the matching simple_module_background_tasks package, then enable background_tasks and run its worker for asynchronous multipart-upload checksums. Run its beat scheduler as well for upload cleanup jobs. The extras combine as simple_module_file_storage[s3,tasks]. Without background_tasks, uploads still work; completed multipart uploads keep checksum_sha256 null. Streamed uploads compute their checksum inline.

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.

Sync workers

With the [tasks] extra installed, synchronous task bodies can import store_path, open_local, and presigned_url from file_storage.contracts. Run calls inside simple_module_db.tenant_context(tenant_id). store_path accepts a path or binary stream and returns committed StoredFileOut metadata; open_local(file_id) yields a temporary local path and always cleans it up. presigned_url(file_id) requires a backend with signing support.

Uploads retain the existing MIME, quota, size and hashing rules. S3 writes above direct_upload_threshold_bytes use bounded multipart. A file path's size is known, so parts grow to fit S3's 10,000-part limit; an unknown-size stream uses multipart_part_size_bytes as is (raise it for streams beyond ~156 GiB). Raise the DB's max_file_size_bytes for large worker outputs. An incomplete multipart upload left by a killed job is aborted by the upload reaper. See docs/modules/file_storage.md in the repository for transaction and cleanup semantics.

Usage

From another module, inject the service via its dependency:

from fastapi import Depends, File, UploadFile

from file_storage.web.deps import get_file_storage_service
from file_storage.files.service import FileStorageService


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 /admin/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)
  • Optional: simple_module_background_tasks (install the [tasks] extra)

License

MIT — see LICENSE.

Metadata

Release files for simple-module-file-storage 0.0.48

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

Source distribution (sdist)

Source distribution for simple-module-file-storage 0.0.48
File Size Uploaded Provenance Actions
simple_module_file_storage-0.0.48.tar.gz 187.9 kB With provenance Details for simple_module_file_storage-0.0.48.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for simple-module-file-storage 0.0.48
File Interpreter ABI Platform Actions
simple_module_file_storage-0.0.48-py3-none-any.whl Python 3 none any Details for simple_module_file_storage-0.0.48-py3-none-any.whl

Total release size: 333.4 kB

Release files / simple_module_file_storage-0.0.48.tar.gz

Download URL simple_module_file_storage-0.0.48.tar.gz
Size 187.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ffa3e8cbb41ca61238b088717fcedf8e6aabcf0c5355c8fd124b41386e68b3df
BLAKE2b-256 checksum
How to use checksums
660f06f40b878ed26164f6aefa290c1b4f8dd243c47a7c7f00a65259f4a420a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Release files / simple_module_file_storage-0.0.48-py3-none-any.whl

Download URL simple_module_file_storage-0.0.48-py3-none-any.whl
Size 145.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9c1ccc049c1fd24bd84702b27d1315dddd13af48c8287f2666eb103a8fb5b0fb
BLAKE2b-256 checksum
How to use checksums
f2c23769e817bbcbe8333b64f3c192633f49badcf178c6d4e4e98c77dcb23035
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Security for simple-module-file-storage 0.0.48

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for simple_module_file_storage-0.0.48.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

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.48 This release

2 release files Full 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