Django Melnottam
⚠️ EXPERIMENTAL — This library is in early development. APIs may change without notice.
Bundle Django web workers and management-command workers behind a unified interface, using either Python 3.14+ subinterpreters (InterpreterPoolExecutor) or multiprocessing-based processes (ProcessPoolExecutor).
What it does
django-melnottam gives you one process manager for:
- Web workers — ASGI/WSGI application servers powered by Hypercorn.
- Command workers — any Django management command, run N times.
- Two isolation models — subinterpreters for low overhead, processes for full memory isolation.
- Graceful shutdown — queue-based stop signals, with process termination as a fallback.
Requirements
- Python 3.14+
- Django 6.0+
django-tasks-db >= 0.12.0django-prodserver >= 2.4.0hypercorn >= 0.18.0
Process backend note: It uses the
forkstart method so duplicated socket FDs are inherited by workers. On platforms withoutfork(e.g. Windows), web workers will not start; use the subinterpreter backend there.
Installation
pip install django-melnottam
Deployment with django-prodserver
If you use db_worker, add the task backend first:
INSTALLED_APPS = [
# ...
"django_tasks_db",
"django_prodserver",
]
TASKS = {
"default": {
"BACKEND": "django_tasks_db.DatabaseBackend",
"QUEUES": ["default"],
}
}
Then configure the server:
For Multiprocessing
PRODUCTION_PROCESSES = {
"web-with-command-workers": {
"BACKEND": "django_melnottam.prodserver_backends.process.ProcessWorkerServer",
"ARGS": {
"workers": 2,
"bind": "0.0.0.0:8000",
"app_path": "myapp.asgi:application",
"django_settings_module": "myapp.settings",
"command_workers": [
{
# Provided you have the django_tasks backend installed.
"command": "db_worker",
# Not doing this causes duplicate workers being loaded,
# So might as well be careful about it.
"options": {"reload": False},
"instances":1,
},
],
},
},
}
For Subinterpreters (which is still experimental as the subinterpreter eosystem is still changing)
PRODUCTION_PROCESSES = {
"web-with-command-workers": {
"BACKEND": "django_melnottam.prodserver_backends.subinterpreter.SubinterpreterWorkerServer",
"ARGS": {
"app_path": "myapp.wsgi:application",
"django_settings_module": "myapp.settings",
"workers": 4,
"bind": "0.0.0.0:8000",
"command_workers": [
{
"command": "myapp.management.commands.send_emails",
"instances": 1,
},
{
"command": "django_tasks_db.management.commands.db_worker",
"options": {"queue_names": ["default"]},
"instances": 2,
"worker_factory": "django_melnottam.tasks.db_worker_factory",
},
],
},
},
}
Run it with:
python manage.py prodserver web-with-command-workers
Use django_melnottam.prodserver_backends.process.ProcessWorkerServer for the process backend.
Command workers
Each entry in command_workers describes one management command:
command— explicit dotted path to the command module.args— positional/CLI-style arguments (optional).options— keyword options passed tocall_command(optional).instances— number of copies to run (default1).worker_factory— optional dotted path to a factory returning a stoppable object.
Without worker_factory, the worker runs call_command(...) and must exit on its own. This is ideal for one-shot commands.
For long-running commands like db_worker, provide a factory. The bundled django_melnottam.tasks.db_worker_factory returns a django_tasks_db worker that can be stopped through the shutdown queue.
The subinterpreter backend cannot force-stop a running command, so long-running commands there need a factory. The process backend does not require one: it terminates any remaining workers with ProcessPoolExecutor.terminate_workers().
CLI
django-melnottam-cli <application> [options]
-w, --workers— number of web workers (default2)-c, --command-workers— JSON list of command specs (default[])-b, --bind— bind address (default0.0.0.0:9001)-s, --settings— Django settings module-p, --pool—interpreterorprocess(defaultinterpreter)-v, --verbose— debug logging
Example:
django-melnottam-cli myapp.wsgi:application \
--workers 4 \
--bind 0.0.0.0:8000 \
--settings myapp.settings \
--command-workers '[{"command": "myapp.management.commands.send_emails", "instances": 1}]'
Programmatic usage
from django_melnottam.application import run_application
from django_melnottam.backends import PoolType
from django_melnottam.workers import CommandSpec
run_application(
app_path="myapp.wsgi:application",
workers=4,
bind="0.0.0.0:8000",
django_settings_module="myapp.settings",
pool_type=PoolType.INTERPRETER, # or PoolType.PROCESS
command_workers=[
CommandSpec(
command="myapp.management.commands.send_emails",
instances=1,
),
CommandSpec(
command="django_tasks_db.management.commands.db_worker",
options={"queue_names": ["default"]},
instances=2,
worker_factory="django_melnottam.tasks.db_worker_factory",
),
],
)
LLM Disclosure
The project idea and design are the author's. LLMs assisted with scaffolding boilerplate, drafting tests, and writing documentation (including this README). All generated output was reviewed and edited.
License
MIT License — see LICENSE. The software is provided "as is", without warranty of any kind, and the authors are not liable for any claim, damages, or other liability arising from its use (or misuse).
Metadata
Release files for django-melnottam 0.1.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_melnottam-0.1.3.tar.gz | 28.2 kB | With provenance | Details for django_melnottam-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_melnottam-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for django_melnottam-0.1.3-py3-none-any.whl |
Total release size: 50.9 kB
Release files / django_melnottam-0.1.3.tar.gz
| Download URL | django_melnottam-0.1.3.tar.gz |
|---|---|
| Size | 28.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f4f28606ad0269aaef3f4963706a486b46e4fad3285dcf3624af5147d6a43ced
|
|
BLAKE2b-256 checksum How to use checksums |
12b3f9450ad643b73e0da3e196589fee16c2afdf0707cf1bf42d4d0e8d0687a9
|
| 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 1, 2026.
Transparency logRelease files / django_melnottam-0.1.3-py3-none-any.whl
| Download URL | django_melnottam-0.1.3-py3-none-any.whl |
|---|---|
| Size | 22.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e48ce123d1702c77eca9907bdb9479d5867e7510475f2e699e92d0f1da74fcc2
|
|
BLAKE2b-256 checksum How to use checksums |
a9dcf23908a17138e33ece3d972bb147285ace1165e267cc980dd9badc65a67b
|
| 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 1, 2026.
Transparency logSecurity for django-melnottam 0.1.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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for django_melnottam-0.1.3.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 1, 2026.
Transparency logA 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.