django-fsspec
A Django app that provides a file system interface via fsspec, backed by Django ORM.
Features
- fsspec compatible — use standard
fsspec.filesystem("django")API - Multi-database — works through Django ORM on supported relational databases
- Configurable block size — tune storage granularity per deployment
- Optimistic locking — safe concurrent writes with conflict detection
- Append-safe API — append mode uses the same database-backed append operation as the public API
- Namespace partitioning — separate path spaces via integer namespace; authorization remains the host app's responsibility
- Path validation — blacklist rules + Unicode NFC normalization
- Implicit directories — no directory records, derived from file paths
- Management commands —
fsspec_gc,fsspec_fsck,fsspec_repair,fsspec_rechunk,fsspec_stats
Quick Start
pip install django-fsspec
Add to INSTALLED_APPS:
INSTALLED_APPS = [
...
"django_fsspec",
]
Run migrations:
python manage.py migrate
Use it:
import fsspec
fs = fsspec.filesystem("django", namespace_id=1)
# Write
with fs.open("/hello.txt", "wb") as f:
f.write(b"Hello World")
# Read
data = fs.cat("/hello.txt") # b"Hello World"
# List
fs.ls("/") # ["/hello.txt"]
# Delete
fs.rm("/hello.txt")
Configuration
Add to your Django settings.py:
# Block size in bytes (default: 32KB)
DJANGO_FSSPEC_BLOCK_SIZE = 32 * 1024
# Maximum file size in bytes (default: 2MB)
DJANGO_FSSPEC_MAX_FILE_SIZE = 2 * 1024 * 1024
Supported File Modes
| Mode | Description |
|---|---|
rb |
Read (file must exist) |
wb |
Write (create or overwrite) |
ab |
Append (create or append) |
xb |
Exclusive create (file must not exist) |
Performance
Benchmarked on GitHub Actions (ubuntu-latest), using the historical 256KB block size. The table below uses CI run 28412676243 on commit 2236341 with --scale ci --seed 1. Format: average latency (throughput).
| Operation | SQLite | MySQL 8.0 / Django 4.2 | MySQL 8.0 / Django 5.2 | PostgreSQL 16 / Django 4.2 | PostgreSQL 16 / Django 5.2 | Oracle 23 |
|---|---|---|---|---|---|---|
| Write small (100B) | 4.2ms (237/s) | 7.7ms (129/s) | 7.2ms (138/s) | 6.6ms (152/s) | 6.4ms (157/s) | 6.3ms (159/s) |
| Write medium (10KB) | 4.4ms (228/s) | 8.1ms (124/s) | 7.7ms (130/s) | 6.6ms (153/s) | 6.2ms (160/s) | 6.5ms (153/s) |
| Write large (1MB) | 8.4ms (118/s) | 30.2ms (33/s) | 30.0ms (33/s) | 33.4ms (30/s) | 29.9ms (33/s) | 14.0ms (71/s) |
| Read small (100B) | 1.4ms (693/s) | 2.6ms (381/s) | 2.4ms (409/s) | 3.0ms (338/s) | 2.5ms (393/s) | 2.8ms (355/s) |
| Read large (1MB) | 1.9ms (536/s) | 4.6ms (219/s) | 4.3ms (235/s) | 9.5ms (106/s) | 9.5ms (105/s) | 5.3ms (188/s) |
| List 1000 files | 4.3ms (234/s) | 7.1ms (141/s) | 6.8ms (147/s) | 7.0ms (144/s) | 6.5ms (153/s) | 7.6ms (132/s) |
| Delete | 3.4ms (294/s) | 7.0ms (143/s) | 6.4ms (156/s) | 5.2ms (193/s) | 5.0ms (199/s) | 5.1ms (196/s) |
Full benchmark results, including concurrency and manually triggered seeded runs, are documented in Benchmarks and available as GitHub Actions artifacts.
Documentation
- Getting Started
- Configuration
- Usage Guide
- Architecture
- Management Commands
- Benchmarks
- Block Size Operations
- Roadmap
- Release Checklist
- Exceptions
License
MIT — see LICENSE.
Metadata
Release files for django-fsspec 0.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django_fsspec-0.2.3.tar.gz | 1.2 MB | Without provenance | Details for django_fsspec-0.2.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_fsspec-0.2.3-py3-none-any.whl | Python 3 | none | any | Details for django_fsspec-0.2.3-py3-none-any.whl |
Total release size: 1.3 MB
Release files / django_fsspec-0.2.3.tar.gz
| Download URL | django_fsspec-0.2.3.tar.gz |
|---|---|
| Size | 1.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a4fefc2b9dac1968ae7b9c9c4b9576fc3444044ab139f4d056b5cb1f11391678
|
|
BLAKE2b-256 checksum How to use checksums |
5108e72d0e7c7a9b24ee59e66c71b8f7132cc783d93cfa50f16cca38355a8bb5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Release files / django_fsspec-0.2.3-py3-none-any.whl
| Download URL | django_fsspec-0.2.3-py3-none-any.whl |
|---|---|
| Size | 42.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e28d9920fb87c80311e636229ea4e394e3337aab4795735cf4fb97a70aa2edff
|
|
BLAKE2b-256 checksum How to use checksums |
19d4976bc58a30f659089bd34fa92d8367561c2b77c2830beaee995a48b58f66
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Security for django-fsspec 0.2.3
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.