Skip to main content

python-file-storage

A Python package that exposes a consistent API for working with different storage backends.

WARNING: This is still under active development.

Why does this package exist?

I needed something that does not depend on Django but exposes a similar interface to Django's base storage in django.core.files.storage.base.Storage. So, if you're using Django: use Django and django-storages instead. Currently, this package only does the bare minimum that I need it for so if you're looking for something more full-featured perhaps look at the cloudstorage package.

Available backends

  • Filesystem.
  • Amazon S3.

Quickstart

  1. Install the package:

    pip install python-file-storage
    
  2. Add your configuration. Set the following as environment variables or add them to a .env file in the root of your project:

    DEFAULT_STORAGE_BACKEND = storage.backends.s3.S3Storage
    S3_BUCKET_NAME = my-bucket-name
    S3_ENDPOINT_URL = example.com # Optional
    S3_ACCESS_KEY_ID = 123
    S3_SECRET_ACCESS_KEY = 123
    

    Currently, using more than one storage backend at a time is unsupported.

  3. Import default_storage and start using the package:

    from storage import default_storage
    
    default_storage.save('example.txt', 'Content')
    file = default_storage.open('example.txt', 'Content')
    

Compatibility

  • Python 3.8+
  • Django is unsupported.

Versioning

This project follows semantic versioning (SemVer).

Metadata

Release files for python-file-storage 0.3.0

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

Source distribution (sdist)

Source distribution for python-file-storage 0.3.0
File Size Uploaded Provenance Actions
python-file-storage-0.3.0.tar.gz 15.6 kB Without provenance Details for python-file-storage-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for python-file-storage 0.3.0
File Interpreter ABI Platform Actions
python_file_storage-0.3.0-py3-none-any.whl Python 3 none any Details for python_file_storage-0.3.0-py3-none-any.whl

Total release size: 35.5 kB

Release files / python-file-storage-0.3.0.tar.gz

Download URL python-file-storage-0.3.0.tar.gz
Size 15.6 kB
Tags Source
SHA-256 checksum
How to use checksums
b382161d56c17e55228129cd54b82b9d53e8532a50209e429c784eec97254b13
BLAKE2b-256 checksum
How to use checksums
184a8c313baa99db0d6eab51b02eecebe511de8ea55e4615f1c4cc91c6957337
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Release files / python_file_storage-0.3.0-py3-none-any.whl

Download URL python_file_storage-0.3.0-py3-none-any.whl
Size 19.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bf1d4448485aa7d4bdd715e211a7b43aec061cd81eab860c771b05c7c8e31ac0
BLAKE2b-256 checksum
How to use checksums
24c03735499655fcc26c2f518724999d6868056f98b9ea56c3ff07a8e3336b5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Security for python-file-storage 0.3.0

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.

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