MLD SDK (Python)
SDK for building analysis plugins that integrate with the MLD platform.
Full Documentation: See the comprehensive docs for detailed API reference and guides.
Installation
# From PyPI (when published)
uv add mld-sdk
# From git
uv add git+https://github.com/EstrellaXD/mld#subdirectory=sdk
Quick Start
Create a plugin by implementing the AnalysisPlugin interface:
from mld_sdk import AnalysisPlugin, PluginMetadata, PluginCapabilities
from fastapi import APIRouter
router = APIRouter()
@router.get("/hello")
async def hello():
return {"message": "Hello from my plugin!"}
class MyPlugin(AnalysisPlugin):
@property
def metadata(self) -> PluginMetadata:
return PluginMetadata(
name="My Plugin",
version="1.0.0",
description="My analysis plugin",
analysis_type="metabolomics",
routes_prefix="/my-plugin",
capabilities=PluginCapabilities(
requires_auth=True,
requires_experiments=True,
),
)
def get_routers(self):
return [(router, "")]
async def initialize(self, context=None):
self._context = context
async def shutdown(self):
pass
Plugin Package Structure
mld-plugin-example/
├── pyproject.toml
├── README.md
└── src/mld_plugin_example/
├── __init__.py
└── plugin.py
pyproject.toml
[project]
name = "mld-plugin-example"
version = "1.0.0"
dependencies = ["mld-sdk>=1.0.0"]
[project.entry-points."mld.plugins"]
example = "mld_plugin_example.plugin:MyPlugin"
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.build.targets.wheel]
packages = ["src/mld_plugin_example"]
The entry point mld.plugins is how the platform discovers your plugin.
Platform Context
When running integrated with the platform, your plugin receives a PlatformContext that provides access to:
- Authentication dependencies (
get_current_user_dependency()) - Repositories for experiments, samples, users, etc.
- Platform configuration
async def initialize(self, context=None):
self._context = context
if context:
# Running integrated - use platform services
self.experiment_repo = context.get_experiment_repository()
else:
# Running standalone
pass
Installation Commands
# Install from GitHub
uv add git+https://github.com/org/mld-plugin-example
# Install specific version
uv add git+https://github.com/org/mld-plugin-example@v1.0.0
# Install from PyPI
uv add mld-plugin-example
# Install local plugin for development
uv add --editable ./my-plugin
Metadata
Release files for mld-sdk 0.16.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mld_sdk-0.16.5.tar.gz | 171.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mld_sdk-0.16.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 311.0 kB
Release files / mld_sdk-0.16.5.tar.gz
| Download URL | mld_sdk-0.16.5.tar.gz |
|---|---|
| Size | 171.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
36329c055706a614e156fc3d25f0958cf9e102203bba3e350c2380fb2336af7e
|
|
BLAKE2b-256 checksum How to use checksums |
07278f230e3582728712827994c889d994e068f80053c03a05419bb9225d9378
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","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 / mld_sdk-0.16.5-py3-none-any.whl
| Download URL | mld_sdk-0.16.5-py3-none-any.whl |
|---|---|
| Size | 139.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
84529b71d99a91a2b21a3fc0c8fde75c99aff3596a75d7e51dd889dc98033f00
|
|
BLAKE2b-256 checksum How to use checksums |
be1b79c982b684a68c435fe75887a044b7ca8038e98f01bc126bd755ab47c610
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","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}
|