Skip to main content

Scope

keepluggable is an open source, (MIT licensed), highly configurable Python library to manage storage of images and other documents (any kind of file, really), with metadata.

The documentation is at http://docs.nando.audio/keepluggable/latest/

The file metadata can be stored in a different place than the file payload. This is recommended because many operations, such as listing files, do not involve actual file content, so you should avoid loading it. Also, payloads should be optimized for serving and metadata should be optimized for querying.

For file payloads, we currently have implemented one backend that stores them in Amazon S3. There is also a very simple backend that stores files in the local filesystem (useful during development).

For (optionally) storing the metadata we currently provide a base SQLAlchemy backend for you to subclass.

In both cases, you can easily write other storage backends.

Using this library you can more easily have your user upload images (or any kind of file) and enter metadata about them, such as name, description, date, place, alt text, title attribute etc.

Some of the metadata is automatically found, such as file size, mime type, image size, aspect ratio, MD5 checksum etc.

The code is highly decoupled so you can tweak the behaviour easily.

The business rules are implemented in a separate layer (isolated from any of the storage strategies and any UI), called an “action” layer. (This is commonly known as a “service” layer, but we call it “action”.) This makes it possible for us to have any storage backends and use any web frameworks or other UI frameworks.

Each application has its own business rules, therefore it is likely that you will subclass the provided action layer to tweak the workflow for your purposes.

One such “action” is the pluggable policy for uploaded image treatment. For instance, the default policy converts the original uploaded image to the JPEG format (so it will never store an unecessarily large BMP), optionally stores the original image in whatever size it is, then creates configurable smaller versions of it.

Some cameras do not rotate the photo, they just add orientation metadata to the image file, so keepluggable rotates it for you, before creating the thumbnails.

Get started with keepluggable!

There exists a similar library called filedepot.

Collaboration

We want your help. We are open to feature requests, suggestions, bug reports and pull requests, in reverse order of openness.

Migration to keepluggable 0.8

keepluggable 0.8 changes the way files are stored. How?

  • It separates namespaces using the “/” character rather than “-”. This creates a better user experience in the S3 Management console.

  • Now you can use only one bucket per environment if you wish to. Multiple keepluggable integrations (in a single app) can use the same bucket, because each keepluggable integration can use its own directories.

  • Between the bucket name and the file name you can create your own directory scheme (e. g. “/users/42/avatars/angry_mode/”). I am calling this a “middle path”. See the function get_middle_path() in the orchestrator.py file.

A migration function is provided so you can update your old storages to keepluggable 0.8. See the method migrate_bucket() in the file amazon_s3.py.

The names of the configuration settings also changed in 0.8.

Metadata

Release files for keepluggable 0.11.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 keepluggable 0.11.1
File Size Uploaded
keepluggable-0.11.1.tar.gz 24.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for keepluggable 0.11.1
File Interpreter ABI Platform
keepluggable-0.11.1-py3-none-any.whl Python 3 none any Details

Total release size: 51.8 kB

Release files / keepluggable-0.11.1.tar.gz

Download URL keepluggable-0.11.1.tar.gz
Size 24.2 kB
Tags Source
SHA-256 checksum
How to use checksums
6afaab3dc716c8b73633c6ac05b17704588ce0263252fb797ab9fb54b0c6529c
BLAKE2b-256 checksum
How to use checksums
1587babe662329cfb61e892d626b1348d4b45b9db1317b264a25aa5b205d4c40
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.1 CPython/3.10.7 Linux/5.10.148-1-MANJARO

Release files / keepluggable-0.11.1-py3-none-any.whl

Download URL keepluggable-0.11.1-py3-none-any.whl
Size 27.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2643b9cd0e401c78928006546a84ab8de6e30a47efd0cdc5afd5542e1c6b8c24
BLAKE2b-256 checksum
How to use checksums
9b99fe0e00c70c7346e4e1e2dae95d184d1db6f7b991ed1e3e9985ecb9c543da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.1 CPython/3.10.7 Linux/5.10.148-1-MANJARO

Release history Release notifications | RSS feed

This release

0.11.1 This release

2 release files

0.11.0

2 release files

0.10.0

2 release files

0.9.0

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.3.2

2 release files

0.3.0

1 release file

0.2.0

1 release file

0.1.0

1 release file

0.1.0a0

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