Pluggable file upload + storage (local or S3 via extras) module for simple_module apps
Project description
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/filesupload endpoint with multipart + metadata.GET /api/files/{id}signed-URL or stream download.- Pluggable backend via
SM_FILE_STORAGE_BACKEND(local|s3). - S3 config via
SM_FILE_STORAGE_S3_BUCKET,SM_FILE_STORAGE_S3_ENDPOINT(for R2/MinIO/etc.),SM_FILE_STORAGE_S3_REGION.
Usage
From another module:
from file_storage.service import FileStorageService # type: ignore[import-not-found]
async def attach_receipt(
svc: FileStorageService = Depends(FileStorageService),
upload: UploadFile = File(...),
):
record = await svc.save(upload, folder="receipts/")
return {"file_id": record.id, "url": record.url}
Env config (example, S3):
SM_FILE_STORAGE_BACKEND=s3
SM_FILE_STORAGE_S3_BUCKET=my-app-uploads
SM_FILE_STORAGE_S3_REGION=us-east-1
AWS_ACCESS_KEY_ID=...
AWS_SECRET_ACCESS_KEY=...
Depends on
simple_module_core,simple_module_db,simple_module_hostingaiofiles- Optional:
aioboto3(install the[s3]extra)
License
MIT — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file simple_module_file_storage-0.0.1.tar.gz.
File metadata
- Download URL: simple_module_file_storage-0.0.1.tar.gz
- Upload date:
- Size: 23.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
687b81d0c1d9e0b124e27d94a5eff17a725fc3d04c755cf256dce03a91aea866
|
|
| MD5 |
036d2f95c16dd93d3e4739c23746d4f1
|
|
| BLAKE2b-256 |
4d1069fe5e5e5fe0fbb8225a15186de230eaa6f73f6770c9997f90c82d1257f2
|
Provenance
The following attestation bundles were made for simple_module_file_storage-0.0.1.tar.gz:
Publisher:
release.yml on antosubash/simple_module_python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
simple_module_file_storage-0.0.1.tar.gz -
Subject digest:
687b81d0c1d9e0b124e27d94a5eff17a725fc3d04c755cf256dce03a91aea866 - Sigstore transparency entry: 1358392695
- Sigstore integration time:
-
Permalink:
antosubash/simple_module_python@b4009cc872e81d3348b928230d13383d6b0fdd34 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/antosubash
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b4009cc872e81d3348b928230d13383d6b0fdd34 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file simple_module_file_storage-0.0.1-py3-none-any.whl.
File metadata
- Download URL: simple_module_file_storage-0.0.1-py3-none-any.whl
- Upload date:
- Size: 27.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11c995a835487a5c904f7590949d2ca07c8303db42a1adf9a61fe6a1c7bcec22
|
|
| MD5 |
d84b559263f7a264ab89b3260c76efbe
|
|
| BLAKE2b-256 |
630b849061c4c9482e1b78f130d9d82f3f2d779b04c2c6050795e6096ae4ef20
|
Provenance
The following attestation bundles were made for simple_module_file_storage-0.0.1-py3-none-any.whl:
Publisher:
release.yml on antosubash/simple_module_python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
simple_module_file_storage-0.0.1-py3-none-any.whl -
Subject digest:
11c995a835487a5c904f7590949d2ca07c8303db42a1adf9a61fe6a1c7bcec22 - Sigstore transparency entry: 1358392713
- Sigstore integration time:
-
Permalink:
antosubash/simple_module_python@b4009cc872e81d3348b928230d13383d6b0fdd34 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/antosubash
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b4009cc872e81d3348b928230d13383d6b0fdd34 -
Trigger Event:
workflow_dispatch
-
Statement type: