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.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file djmux-1.0.1.tar.gz.
File metadata
- Download URL: djmux-1.0.1.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d3dca574e159b69a2b56e79532d81ac614662b22c2de97c9dccab3c18c42565
|
|
| MD5 |
14791a3e256ee8cfefd55fc71706360f
|
|
| BLAKE2b-256 |
24b1222a294fdd7e7ebdbcd6d84636f57ad832afa3c7cbb0d5a2d1c40cdc75f9
|
File details
Details for the file djmux-1.0.1-py3-none-any.whl.
File metadata
- Download URL: djmux-1.0.1-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
03202098c3373025a81a06e4ecc2e002df3ae2b35ecb396c7ad1f17f5a08bf53
|
|
| MD5 |
0c04f2e1d3661964de023e0d89fa58f9
|
|
| BLAKE2b-256 |
0b81147bccf6f82ccf7d53a14b1322700756affefc10511808495da5a06a65e8
|