Skip to main content

djmux

PyPI Python versions License: BSD-3-Clause CI

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.config keys), 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.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for djmux 1.0.2
File Size Uploaded Provenance Actions
djmux-1.0.2.tar.gz 8.9 kB Without provenance Details for djmux-1.0.2.tar.gz

Built distribution (wheel)

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

Total release size: 18.2 kB

Release files / djmux-1.0.2.tar.gz

Download URL djmux-1.0.2.tar.gz
Size 8.9 kB
Tags Source
SHA-256 checksum
How to use checksums
c5217a94a2757710687f61d66e79abf7d61e0e7915df5874d824513957b0db01
BLAKE2b-256 checksum
How to use checksums
7dbba55a27200285253a01f5909cc2a2e2d586c48cb8c938bcdfefc7cebc765e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.12 {"installer":{"name":"uv","version":"0.13.12","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.2-py3-none-any.whl

Download URL djmux-1.0.2-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e4945edea68f64f1ec679745b99a1bad407fd0219ecf1c7f611dd3b6d3921c62
BLAKE2b-256 checksum
How to use checksums
707435cc84d90aac0f160904e09786279744a6e7540e97fe7baf5c8f2df388d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.12 {"installer":{"name":"uv","version":"0.13.12","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}

Security for djmux 1.0.2

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.

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files No provenance

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