Skip to main content

Python SDK for HLA-Compass bioinformatics platform - Build powerful modules for immuno-peptidomics analysis

Project description

HLA-Compass Python SDK

PyPI version Python Versions

The official Python SDK (Python 3.11+) for developing modules and integrations on the HLA-Compass platform.

🚀 Quick Start

# 1. Install
pip install "hla-compass>=4.2.0"

# 2. Authenticate
hla-compass auth login --env dev

# 3. Optionally pin a default organization for publish operations
hla-compass auth use-org 00000000-0000-0000-0000-000000000000 --env dev

# 4. Create
hla-compass init my-module --template no-ui
cd my-module

# 5. Validate and smoke test
hla-compass validate
hla-compass test --input examples/sample_input.json

# 6. Publish (source-upload — the platform builds the container)
hla-compass publish --env dev --scope org --wait

This README is intentionally concise. The public documentation portal is docs.alithea.bio; every generated module also ships with a self-contained SKILL.md authoring and runtime reference.

📚 Docs Model

  • Public documentation: SDK, module-authoring, API, and release workflows.
  • SKILL.md generated by hla-compass init: canonical in-module runtime and API reference for developers and AI assistants.
  • CLAUDE.md generated by hla-compass init: short in-module orientation that points back to SKILL.md.
  • This repository's internal-docs/guides/sdk-developer/ tree: contributor guidance for maintainers with repository access.

🤖 AI-Assisted Development

Every module scaffolded by hla-compass init includes two reference files designed for both human developers and AI coding assistants:

File Purpose
SKILL.md Canonical in-module reference. Covers the runtime contract, helper APIs, testing patterns, and current publish commands. Point your AI assistant here first.
CLAUDE.md Concise in-module orientation file. Quick-reference for architecture, key commands, and import conventions. References SKILL.md for details.

Tip: When using an AI coding assistant (Claude, Copilot, etc.), ensure it reads SKILL.md in your module directory. It contains everything needed to build a correct, production-ready HLA-Compass module without guessing at API signatures or platform conventions.


🛠️ CLI Entry Points

Command Description
init Scaffold a new module (includes SKILL.md reference guide)
validate Validate module structure and manifest
test Run a containerized module smoke execution
dev Run the interactive local rerun loop
serve Serve the UI template locally
publish Upload module source to the platform for server-side build and registration
publish-status Inspect or watch module intake status
auth Manage platform login and keys
mcp Print MCP schema or run a local MCP server for the current module

🔧 Local SDK Development

When iterating on the SDK itself, use the HLA_COMPASS_SDK_PATH environment variable so that dev/test/serve commands pick up your local checkout:

export HLA_COMPASS_SDK_PATH=../sdk/python
hla-compass dev
hla-compass test --input examples/sample_input.json

💎 Key Features

  • Module-first CLI: Scaffold, test, and publish with a single toolchain.
  • Source-upload publishing: hla-compass publish uploads source; the platform builds the container, scans it, and registers the module. No Docker, GHCR, or signing keys required.
  • Data helpers: Storage + data access helpers for module runtimes.
  • Local dev loop: Containerized dev/serve/test flow that matches production.

The CLI uses the active org for the selected environment by default, or --org-id to override it.

Compute Types

Public module manifests use these compute types:

  • lambda
  • fargate
  • batch
  • pipeline (pipeline-ui / Nextflow modules; the platform routes execution through the Nextflow runner)

docker remains accepted only as a legacy publish alias and is normalized to fargate.

Scientific Helper Notes

The convenience helpers get_hla_alleles(), get_hla_frequencies(), and get_protein_coverage() are implemented as typed REST calls in SDK 3.0.0+. They no longer switch implicitly between direct database access and REST.

Migration guidance:

  • High-level SDK callers now need a reachable HLA-Compass API endpoint for these helpers.
  • Module runtimes that need direct read access should use self.data.sql.query(...) explicitly.
  • API-key authenticated clients continue to work; the SDK now targets /v1/api/data/... typed endpoints instead of issuing raw SQL on the caller's behalf.
  • Plain JWT user sessions now work through /v1/data/... typed endpoints.

predict_hla_binding() is also implemented, but it is a wrapper over an async module run and requires a configured binding module id (HLA_BINDING_MODULE_ID or hla_binding_module_id in SDK config).


📖 Advanced Documentation

  • Public documentation – SDK, module workflow, and API reference.
  • Generated SKILL.md – Version-aligned, self-contained module runtime and authoring contract.
  • hla-compass --help – Installed command and subcommand reference.

🤝 Support & Issues

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

hla_compass-4.2.1.tar.gz (271.2 kB view details)

Uploaded Source

Built Distribution

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

hla_compass-4.2.1-py3-none-any.whl (305.4 kB view details)

Uploaded Python 3

File details

Details for the file hla_compass-4.2.1.tar.gz.

File metadata

  • Download URL: hla_compass-4.2.1.tar.gz
  • Upload date:
  • Size: 271.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.14

File hashes

Hashes for hla_compass-4.2.1.tar.gz
Algorithm Hash digest
SHA256 66f52ac1f7e99ad1a2bc8d6bcdc8c2f9667f65098b34bb0fc1e8580509d4b254
MD5 b5f2c2ed42a8b41d40deb3544f210c26
BLAKE2b-256 b4c1e8f0c44d8ee201a6449e565e2a89397af05e1df23f73fa791fd047a8fe32

See more details on using hashes here.

File details

Details for the file hla_compass-4.2.1-py3-none-any.whl.

File metadata

  • Download URL: hla_compass-4.2.1-py3-none-any.whl
  • Upload date:
  • Size: 305.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.14

File hashes

Hashes for hla_compass-4.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c98ef329ca9b78b6c912eb56d55e361c3883845a2af2d53b9682ae597b597bf0
MD5 952e65c2f69a452cc8b44d0871a1753a
BLAKE2b-256 37800ad07bbc3c5cafa3f5770d6207efae6fe851f9d1d54c7cb8d1fce84272ef

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