Implementing Qibo Nexus backend - #1
Conversation
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
| @@ -0,0 +1,60 @@ | |||
| name: Tests | |||
There was a problem hiding this comment.
Replace this file by using the workflow stored in https://github.com/qiboteam/workflows/blob/v2/.github/workflows/test.yml, see example from qibolab: https://github.com/qiboteam/qibolab/blob/main/.github/workflows/test.yml
There was a problem hiding this comment.
Thanks @jf-kong, please find some comments here. Could you please check coverage? I think we can avoid the sphinx for now and just keep the docs in the README (so we can avoid the documentation workflow too). If we decide to upload to pypi then we can rethink about it.
| [tool.poe.tasks] | ||
| test = "pytest" | ||
| lint = "pylint --errors-only src" | ||
| lint-warnings = "pylint --exit-zero src" |
There was a problem hiding this comment.
| lint-warnings = "pylint --exit-zero src" | |
| lint-warnings = "pylint --exit-zero src" | |
| types = "true" |
Summary
Initial implementation of
nexus-backend, a standalone Qibo backend for compiling and executing circuits on Quantinuum hardware throughqnexusAPI, modelled on the layout ofqibojitandqibolab.The Nexus client was previously developed inside
qibo-cloud-backends(never released or merged into main). This PR carves the Nexus pieces out into their own home.What's in this PR
src/nexus_backend/, 7 modules)backend.py—NexusClientBackend(formerlynexus_client.py);name = "nexus-backend".auth.py,config.py,errors.py,translation.py,results.py,helios.py— moved with sibling-import rewrites only.__init__.py— exposesMetaBackend,NexusClientBackend,NexusBackendConfig,EstimateItem,ExecutionEstimate,run_compile_execute,PLATFORMS,__version__.tests/, 6 files, 50 tests, all green)test_meta_backend.pycovers theqibo.set_backend("nexus-backend", ...)discovery path.test_backend_contract.pycovers directNexusClientBackend(...).execute_circuit/.execute_circuits/.estimate_circuit/.estimate_circuitsagainst mocked qnexus.test_translator.py,test_config.py,test_results.py,test_helios.py— unit tests for the translation, config, result-mapping, and Helios HUGR layers.qnexus,pytket,pytket.qasm,guppylang,guppylang.std.*,qibo.resultviamonkeypatch.setitem(sys.modules, …). No live Nexus calls; CI runs offline.pyproject.toml)qibojit's shape.qibo ^0.2.16,qnexus >=0.39,<1,pytket >=2.8,<3,guppylang >=0.21,<1.tests(pytest, pytest-cov, pytest-mock, pylint),docs(sphinx, furo, …).doc/source/)conf.pyindex.rst(install + quickstart) andapi.rst(autoclass onNexusClientBackendandMetaBackend)..github/workflows/)unit_test.yml: Linux + macOS × Python 3.10/3.11/3.12, Poetry install,poe lint+poe test, Codecov upload on Linux 3.10.deploy.yml: scaffolded but gated toworkflow_dispatchonly; PyPI publish is deferred.pip install git+…), quickstart.Additional note
qibo.set_backend("nexus-backend", platform=...)triggersqibo.backends.construct_backend(...), which substitutes-→_in the backend string, callsimportlib.import_module("nexus_backend"), and invokesmodule.MetaBackend.load(**kwargs). The contract this PR satisfies is therefore minimal: be importable asnexus_backendand expose a top-levelMetaBackend.loadreturning aqibo.backends.abstract.Backendsubclass. Same shape qibojit and qibolab use.Verification done locally
poetry install --with tests— resolves cleanly.poetry run pytest— 50 passed in 44s, fully offline, no Nexus credentials required.qibo.set_backend("nexus-backend", platform="hseries:H2-1LE")— returns a realNexusClientBackend(module=nexus_backend.backend,name=nexus-backend,config.platform=hseries:H2-1LE).from nexus_backend import NexusClientBackend; backend = NexusClientBackend(platform="...")— direct construction works as before; allexecute_circuit/execute_circuits/estimate_circuit/estimate_circuitsmethods are reachable.grep -RIn "qibo_cloud_backends|nexus-client|qibo-cloud-backends" src tests doc README.md pyproject.toml— zero hits (no stale references).Test plan for reviewers
poetry install --with tests && poetry run pytestpasses locally.python -c "import qibo; qibo.set_backend('nexus-backend', platform='hseries:H2-1LE'); print(qibo.get_backend())"reports aNexusClientBackendwithname == "nexus-backend".