djmux
One config, many DataJoint packages on one server. djmux lets several DataJoint
table-set packages run side-by-side on the same MySQL server — each under its own schema
prefix — from a single shared config file. It patches nothing else about DataJoint.
Why
DataJoint natively supports a single schema prefix. As soon as you have more than one table-set
package on a server — a shared lab pipeline, a couple of per-user downstream packages, a v1 and a
v2 of the same schema — they either collide or need each package to hardcode a prefix. djmux
solves this with one YAML file that provides:
- the shared MySQL connection (standard
dj.configkeys), and - a map of schema prefixes keyed by package.
Each package's schemas are then named <prefix>__<name>, so many packages activate together with
no package hardcoding a prefix, and versioning (v1 → v2) is a one-line config edit. Everything
else works exactly like stock DataJoint — djmux only patches dj.config.
Install
pip install djmux
Use
A single config file (~/.djmux.yaml, or point $DJMUX_CONFIG at it):
datajoint: # standard DataJoint connection
host: db.lab
port: 3306
user: alice
password: ...
use_tls: true
prefixes: # one prefix per table-set package (v1 -> v2 = edit here)
mypipeline: mypipeline_v1 # shared pipeline package -> schemas mypipeline_v1__<name>
mine: alice_replay # your downstream package -> schemas alice_replay__<name>
stores: # optional filepath@ external store(s)
tree: { location: /data/store }
Then several packages activate together, each under its own prefix:
import djmux, mypipeline, my_replay
djmux.load("~/.djmux.yaml") # sets the shared connection + prefix map (once)
mypipeline.activate() # -> mypipeline_v1__*
my_replay.activate() # -> alice_replay__*
A package makes itself djmux-aware by decorating tables with a deferred schema and delegating activation:
import datajoint as dj, djmux
schema = dj.Schema() # deferred (unnamed)
@schema
class Session(dj.Manual): ...
def activate(**kw):
djmux.activate(schema, key="mypipeline", name="core", linking_module=__name__, **kw)
API
| function | purpose |
|---|---|
djmux.load(path=None) |
read the YAML, patch dj.config (connection + custom.prefixes + stores); enables filepath@ |
djmux.activate(schema, key, name, ...) |
activate a deferred dj.Schema() as <prefix>__<name> (prefix from config key) |
djmux.get_datajoint_schema(file, module, key) |
eager per-file modular schema, <prefix>__<filestem> (orm-patterns style) |
djmux.schema_name(key, name) / resolve_prefix(key) |
naming helpers |
Prefix resolution order: explicit override= arg → $DJMUX_PREFIX_<KEY> env → config prefixes[key].
Credentials may live in ~/.datajoint_config.json instead and be omitted from the djmux config.
Development
git clone https://github.com/larsrollik/djmux.git
cd djmux
uv sync --extra dev
uv run pre-commit install --hook-type pre-commit --hook-type commit-msg
uv run pytest
Release
Bump VERSION, merge to main; the tag triggers a GitHub release + OIDC trusted-publish to PyPI
(no tokens). See .github/workflows/release.yml.
License
BSD-3-Clause — see LICENSE.
Metadata
Release files for djmux 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| djmux-1.0.1.tar.gz | 7.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| djmux-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.3 kB
Release files / djmux-1.0.1.tar.gz
| Download URL | djmux-1.0.1.tar.gz |
|---|---|
| Size | 7.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1d3dca574e159b69a2b56e79532d81ac614662b22c2de97c9dccab3c18c42565
|
|
BLAKE2b-256 checksum How to use checksums |
24b1222a294fdd7e7ebdbcd6d84636f57ad832afa3c7cbb0d5a2d1c40cdc75f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / djmux-1.0.1-py3-none-any.whl
| Download URL | djmux-1.0.1-py3-none-any.whl |
|---|---|
| Size | 8.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
03202098c3373025a81a06e4ecc2e002df3ae2b35ecb396c7ad1f17f5a08bf53
|
|
BLAKE2b-256 checksum How to use checksums |
0b81147bccf6f82ccf7d53a14b1322700756affefc10511808495da5a06a65e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|