{"id":44039773,"url":"https://github.com/qubit-os/qubit-os-hardware","last_synced_at":"2026-02-10T03:01:18.951Z","repository":{"id":334892770,"uuid":"1142100043","full_name":"qubit-os/qubit-os-hardware","owner":"qubit-os","description":"Hardware Abstraction Layer (HAL) for QubitOS - Rust+PyO3 backend implementations for QuTiP and IQM","archived":false,"fork":false,"pushed_at":"2026-02-07T19:05:59.000Z","size":122,"stargazers_count":0,"open_issues_count":5,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-08T03:13:42.714Z","etag":null,"topics":["hal","pyo3","quantum","quantum-computing","qutip","rust"],"latest_commit_sha":null,"homepage":"https://qubit-os.github.io","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/qubit-os.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-26T00:12:35.000Z","updated_at":"2026-02-07T19:06:03.000Z","dependencies_parsed_at":"2026-01-27T23:00:29.647Z","dependency_job_id":null,"html_url":"https://github.com/qubit-os/qubit-os-hardware","commit_stats":null,"previous_names":["qubit-os/qubit-os-hardware"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/qubit-os/qubit-os-hardware","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qubit-os%2Fqubit-os-hardware","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qubit-os%2Fqubit-os-hardware/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qubit-os%2Fqubit-os-hardware/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qubit-os%2Fqubit-os-hardware/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qubit-os","download_url":"https://codeload.github.com/qubit-os/qubit-os-hardware/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qubit-os%2Fqubit-os-hardware/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29289899,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-10T02:32:08.756Z","status":"ssl_error","status_checked_at":"2026-02-10T02:30:31.937Z","response_time":65,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hal","pyo3","quantum","quantum-computing","qutip","rust"],"created_at":"2026-02-07T20:14:58.314Z","updated_at":"2026-02-10T03:01:18.918Z","avatar_url":"https://github.com/qubit-os.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# QubitOS Hardware Abstraction Layer (HAL)\n\n[![CI](https://github.com/qubit-os/qubit-os-hardware/actions/workflows/ci.yaml/badge.svg)](https://github.com/qubit-os/qubit-os-hardware/actions/workflows/ci.yaml)\n[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\nRust implementation of the QubitOS Hardware Abstraction Layer - the bridge between pulse optimization and quantum backends.\n\n## Overview\n\nThe HAL provides:\n\n- **gRPC Server** - Protocol buffer interface for pulse execution\n- **REST API** - HTTP/JSON facade for the gRPC service\n- **Backend Registry** - Pluggable backend system for simulators and hardware\n- **QuTiP Backend** - Local quantum simulator (via PyO3)\n- **IQM Backend** - Cloud access to IQM quantum processors\n\n## Quick Start\n\n### Running the HAL\n\n```bash\n# Development mode\ncargo run -- --config config.yaml\n\n# Or with environment variables\nQUBITOS_LOG_LEVEL=debug cargo run\n\n# Production (release build)\ncargo build --release\n./target/release/qubit-os-hal --config config.yaml\n```\n\n### Docker\n\n```bash\n# Build\ndocker build -t qubit-os-hardware .\n\n# Run\ndocker run -p 50051:50051 -p 8080:8080 qubit-os-hardware\n```\n\n### Configuration\n\n```yaml\n# config.yaml\nserver:\n  host: \"127.0.0.1\"  # Default - use 0.0.0.0 for external access\n  grpc_port: 50051\n  rest_port: 8080\n  shutdown_timeout_sec: 30\n  rate_limit:\n    enabled: true\n    requests_per_second: 100\n\nbackends:\n  qutip_simulator:\n    enabled: true\n    default: true\n  iqm_garnet:\n    enabled: false\n    gateway_url: \"${IQM_GATEWAY_URL}\"\n    auth_token: \"${IQM_AUTH_TOKEN}\"\n\nlogging:\n  level: \"info\"\n  format: \"json\"\n```\n\n## Security\n\nThe HAL includes several security features:\n\n- **Input Validation**: All requests are validated at the API boundary (envelope sizes, qubit bounds, amplitude limits). See [qubit-os-proto/LIMITS.md](../qubit-os-proto/LIMITS.md).\n- **Timeout Protection**: Python/QuTiP execution has a 300s timeout to prevent hangs.\n- **Error Sanitization**: Production builds return generic error messages to prevent information leakage.\n- **Rate Limiting**: Configurable rate limits (enforced at infrastructure layer).\n- **Secure Defaults**: Binds to localhost by default, restrictive CORS.\n- **Secret Handling**: IQM tokens use SecretString (optional `iqm` feature).\n\n## Architecture\n\n```\n┌─────────────────────────────────────────┐\n│              HAL Server                  │\n├──────────────────┬──────────────────────┤\n│   gRPC Service   │   REST Service       │\n│   (tonic)        │   (axum)             │\n├──────────────────┴──────────────────────┤\n│           Backend Registry               │\n├────────────────┬────────────────────────┤\n│ QuTiP Backend  │     IQM Backend        │\n│ (PyO3)         │     (reqwest)          │\n└────────────────┴────────────────────────┘\n```\n\n## Development\n\n### Prerequisites\n\n- Rust 1.83+\n- Python 3.11+ (for QuTiP backend)\n- Protocol Buffers compiler (protoc)\n\n### Building\n\n```bash\n# Debug build\ncargo build\n\n# Release build\ncargo build --release\n\n# Run tests\ncargo test\n\n# Run with logging\nRUST_LOG=debug cargo run\n```\n\n### Code Structure\n\n```\nsrc/\n├── main.rs           # Entry point\n├── lib.rs            # Library exports\n├── config.rs         # Configuration handling\n├── server/\n│   ├── mod.rs\n│   ├── grpc.rs       # gRPC service implementation\n│   └── rest.rs       # REST API facade\n├── backend/\n│   ├── mod.rs\n│   ├── trait.rs      # QuantumBackend trait\n│   ├── registry.rs   # Backend registration\n│   ├── qutip/        # QuTiP simulator backend\n│   └── iqm/          # IQM hardware backend\n├── validation/\n│   ├── mod.rs\n│   ├── pulse.rs      # Pulse validation\n│   └── hamiltonian.rs\n└── error.rs          # Error types\n```\n\n## Adding a New Backend\n\n1. Implement the `QuantumBackend` trait:\n\n```rust\n#[async_trait]\nimpl QuantumBackend for MyBackend {\n    fn name(\u0026self) -\u003e \u0026str { \"my_backend\" }\n    fn backend_type(\u0026self) -\u003e BackendType { BackendType::Hardware }\n    \n    async fn execute_pulse(\u0026self, request: ExecutePulseRequest) \n        -\u003e Result\u003cMeasurementResult, BackendError\u003e {\n        // Implementation\n    }\n    \n    // ... other methods\n}\n```\n\n2. Register in `backend/mod.rs`\n\n3. Add configuration in `config.rs`\n\n4. Write tests in `tests/`\n\n## License\n\nApache 2.0 - See [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqubit-os%2Fqubit-os-hardware","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqubit-os%2Fqubit-os-hardware","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqubit-os%2Fqubit-os-hardware/lists"}