Skip to main content

MLD Plugin SDK - Build analysis plugins for the MLD platform

Project description

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

Project details


Release history Release notifications | RSS feed

This version

0.9.3

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mld_sdk-0.9.3.tar.gz (44.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mld_sdk-0.9.3-py3-none-any.whl (21.1 kB view details)

Uploaded Python 3

File details

Details for the file mld_sdk-0.9.3.tar.gz.

File metadata

  • Download URL: mld_sdk-0.9.3.tar.gz
  • Upload date:
  • Size: 44.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.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}

File hashes

Hashes for mld_sdk-0.9.3.tar.gz
Algorithm Hash digest
SHA256 2aa23c7b853cf5643fe8ad905d7bd30bdc21c57bd1bc1c57172b539000b50fd8
MD5 254dfa1981a55ab92c38ef1f05217c60
BLAKE2b-256 acc53cae4a85f31fc6d4edb78e0104be100e8bddadf771692ef693cca5b37d5a

See more details on using hashes here.

File details

Details for the file mld_sdk-0.9.3-py3-none-any.whl.

File metadata

  • Download URL: mld_sdk-0.9.3-py3-none-any.whl
  • Upload date:
  • Size: 21.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.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}

File hashes

Hashes for mld_sdk-0.9.3-py3-none-any.whl
Algorithm Hash digest
SHA256 378262f637dd5b1e3961a4cc48d82b5469efbac3870932f5ab1a4bb0a578b711
MD5 cf7c5953215a1159a8a32aaf41bb1028
BLAKE2b-256 1d3d476fce11f41e7d85b0f778e30d478ffae791f2289bde3bac99a6402a808e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page