DocumentationMotionCommons · Developer preview

Create a Python module

Local execution

Keep your calculation small and expose explicit, versioned inputs and outputs.

Docs/Build extensions
Ask Claude

Create a Python module

Page Markdown

The complete guide, ready to copy or save as a Markdown file.

Download .md ↓

Custom functions and package blocks

Use the developer guide for typed module manifests, source/package layout, settings, workflow bundles, Python execution and authenticated catalog publication. The original SDK templates below remain supported.

Scaffold and run

Run these commands from an installed checkout. The generated module includes a function, manifest, synthetic input and behavior test. Use a new output filename for each run.

Inspect the saved JSON output with your editor or python -m json.tool result.json. Local Python executes with your user permissions. Only run code you trust.

sh
uv run hb init my-analysis
uv run hb validate my-analysis
uv run python -m pytest my-analysis/test_main.py -q
uv run hb run my-analysis --input my-analysis/sample.json --output result.json

Work with any file format

Declare named input/output ports and read files with your own installed libraries. A new format does not require a core platform parser. The runner records accepted files, hashes, sizes and declared metadata.

The file runner publishes a new result directory containing result.json and the declared files. It preserves bytes; your module must validate content, units, calibration and scientific compatibility.

sh
uv run hb init my-file-analysis --template files
uv run hb validate my-file-analysis
uv run python -m pytest my-file-analysis/test_main.py -q
uv run hb run my-file-analysis --input my-file-analysis/inputs.json --output new-result

Version the scientific contract

Do not install dependencies dynamically inside a patient job or the API. Runs execute on your organization’s enrolled machines from a pinned snapshot; container isolation for shared machines is future work.

  1. Declare semantic contract versions, units, time bases and missing-value behavior.
  2. Use synthetic known-answer cases and invalid-input tests; do not silently change algorithms or units.
  3. Pin dependencies through a reviewed runtime profile. Specialized dependencies need an appropriate reviewed image or native adapter.
  4. Create new outputs for reanalysis. Preserve original evidence and historical contract versions.

Publish a module or metric from GitHub

Keep the code in GitHub and publish a pinned version to your organization’s module library. The file must be committed and pushed. The published code names its repository, commit and path, and pipelines run that exact copy, never a later push.

sh
uv run --frozen hb agent login
uv run --frozen hb block publish module.json --code module.py --organization ORG --study PROJECT
uv run --frozen hb metric publish my_metric.py --organization ORG --study PROJECT

Accessibility

Make every MotionCommons page comfortable for you. Settings apply on this browser.

Text size

Your training, at your pace.

Reading & movement
Audio support

Spoken audio is unavailable in this browser. All instructions remain available as text.

Read this page speaks up to 1,800 characters of visible page text. Embedded dashboards have their own Read dashboard button.