Package Ecosystem¶
MicroQuantum is distributed as a single flat Python package — pip install
microquantum — whose public surface is organized into stable, layered
subpackages. This page is the canonical map: it tells users where each piece
of the SDK lives and how future extensions join the package without creating
duplicate APIs.
Import policy¶
The top-level
microquantummodule (src/microquantum/__init__.py) is the friendly gateway. Everything you need for daily work is available asfrom microquantum import ....Every top-level name is re-exported from exactly one canonical location.
from microquantum import StateVectorandfrom microquantum.core.state import StateVectorreturn the same object (identity, not a copy).Subpackage imports stay valid and are the home of deeper, lower-level APIs (capability constants, strategy handlers, CSV/plot utilities) that are not part of the minimal top-level surface.
Internal helpers are private: their names or modules start with
_(for examplemicroquantum._json— JSON helpers — andmicroquantum._cli— themicroquantumconsole script’s implementation). They are not covered by the compatibility contract and must not be imported by user code.
Conceptual boundaries¶
The ecosystem is described by nine boundaries. Each maps onto existing packages or modules — no duplicate implementations exist anywhere:
Boundary |
Canonical location |
Contents |
|---|---|---|
core |
|
The engine: |
circuit |
|
The circuit model. A circuit is a collection of registers,
parameters and gates; |
gates |
|
|
states |
|
|
measurement |
|
Measurement sampling, projections and the measurement IR node
( |
compiler |
|
|
runtime |
|
|
backends |
|
The |
stdlib |
|
The system standard library (Phase 117): |
One canonical implementation¶
Extension code — including future phases — must follow one rule: add new functionality in its own module and re-export it, never copy an existing implementation into a second module. Concretely:
Put new code in the subpackage that owns the concern (a new gate goes into
core.operators, a new pass intoir.passes, a new simulator intobackends, a shared utility intostdlib).Expose it through the subpackage’s curated
__all__and, when part of the minimal surface, re-export it from the top-level__init__.py.Contributor-facing boundaries (
adapters,providers,qml,qec,chemistry,benchmarks,mitigation,analytics) stay independent verticals: they consume the core through public APIs only.
Packaging¶
The distribution metadata (pyproject.toml) uses setuptools package discovery
under src/, so every microquantum subpackage — including
microquantum.stdlib — is included in the sdist and wheel automatically.
The only hard runtime dependency is NumPy; everything else (docs, GPU
acceleration, optional integrations) is declared as an optional extra and
never imported by the SDK itself.
The package surface is locked by the tests/test_package_ecosystem.py
conformance module: subpackage discovery, curated __all__ sets, canonical
alias identity and stdlib exclusivity are all verified on every test run.