-
-
Notifications
You must be signed in to change notification settings - Fork 53
feat: Adding AGENTS.md repository instructions for AI tooling #1518
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
CodeMaverick2
wants to merge
17
commits into
munich-quantum-toolkit:main
Choose a base branch
from
CodeMaverick2:aiToolingInstructions
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+244
−0
Open
Changes from 8 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
4c3caca
Added AGENTS.md repository instructions for AI tooling
CodeMaverick2 12c464d
Merge branch 'munich-quantum-toolkit:main' into aiToolingInstructions
CodeMaverick2 b42b050
🎨 pre-commit fixes
pre-commit-ci[bot] dfcc66f
captilazation ci fail fix
CodeMaverick2 6316c72
coderabbit suggested fix
CodeMaverick2 3d97cfe
ci: retrigger CI
CodeMaverick2 ec9e4d0
suggestion fixes
CodeMaverick2 987b2f7
coderabbit suggestion
CodeMaverick2 61c7602
fix
CodeMaverick2 0ed2284
Merge branch 'main' into aiToolingInstructions
CodeMaverick2 f2c50d5
Merge branch 'main' into aiToolingInstructions
CodeMaverick2 6eebd51
review fixes
CodeMaverick2 20abc0b
🎨 pre-commit fixes
pre-commit-ci[bot] 63a1553
2 fixes
CodeMaverick2 26d810d
Merge branch 'aiToolingInstructions' of https://github.com/CodeMaveri…
CodeMaverick2 9590c8c
Merge branch 'main' into aiToolingInstructions
CodeMaverick2 78d22a3
Merge branch 'main' into aiToolingInstructions
CodeMaverick2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,243 @@ | ||
| # MQT Core | ||
|
|
||
| MQT Core is the backbone of the [Munich Quantum Toolkit (MQT)](https://mqt.readthedocs.io/) — a C++20 and Python library providing core data structures and algorithms for quantum computing design automation. | ||
| Key components include an intermediate representation (IR) for quantum computations, a state-of-the-art decision diagram (DD) package, a ZX-calculus engine, an OpenQASM 3.0 parser, MLIR-based quantum compilation dialects, and implementations of the [quantum device management interface (QDMI)](https://github.com/Munich-Quantum-Software-Stack/QDMI). | ||
CodeMaverick2 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## Tech Stack | ||
|
|
||
| | Area | Tool | Notes | | ||
| | ----------------------- | ------------------------- | ------------------------------------------- | | ||
| | C++ standard | C++20 | Minimum required | | ||
| | Build system | CMake 3.24+ | Up to 4.2 supported | | ||
| | Python | 3.10+ | Supports 3.10 through 3.14 | | ||
CodeMaverick2 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| | MLIR/LLVM | 21+ | Required only when `BUILD_MQT_CORE_MLIR=ON` | | ||
CodeMaverick2 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| | Python package manager | **uv** (>=0.5.20) | NEVER use pip | | ||
| | Python build backend | scikit-build-core | With nanobind for bindings | | ||
| | Python linter/formatter | **ruff** | NEVER use pylint, black, flake8, or isort | | ||
| | Python type checker | **ty** | NEVER use mypy | | ||
| | Python bindings | **nanobind** (~2.11.0) | NOT pybind11 | | ||
CodeMaverick2 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| | C++ formatter | clang-format (LLVM style) | | | ||
CodeMaverick2 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| | C++ linter | clang-tidy | | | ||
CodeMaverick2 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| | CMake formatter | cmake-format | | | ||
CodeMaverick2 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| | C++ test framework | Google Test | | | ||
| | Python test framework | pytest | With pytest-xdist for parallelism | | ||
| | Pre-commit runner | prek | Wraps pre-commit hooks | | ||
|
|
||
| ## Building the C++ Library | ||
|
|
||
| ```bash | ||
| # Configure and build (Release) | ||
| cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_MQT_CORE_TESTS=ON | ||
| cmake --build build | ||
|
|
||
| # Debug build | ||
| cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DBUILD_MQT_CORE_TESTS=ON | ||
| cmake --build build | ||
| ``` | ||
|
|
||
| Key CMake options: | ||
|
|
||
| | Option | Default | Description | | ||
| | ---------------------------- | ---------------------- | ---------------------------------------------------------- | | ||
| | `BUILD_MQT_CORE_TESTS` | ON (if master project) | Build C++ test suite | | ||
| | `BUILD_MQT_CORE_BINDINGS` | OFF | Build Python bindings via nanobind | | ||
| | `BUILD_MQT_CORE_MLIR` | ON | Build MLIR quantum compilation dialects (requires LLVM 21) | | ||
| | `BUILD_MQT_CORE_SHARED_LIBS` | OFF | Build as shared libraries | | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| | `BUILD_MQT_CORE_BENCHMARKS` | OFF | Build evaluation benchmarks | | ||
CodeMaverick2 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| | `ENABLE_COVERAGE` | OFF | Enable code coverage instrumentation | | ||
|
|
||
| In-source builds are prevented. | ||
CodeMaverick2 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| External dependencies (nlohmann_json, Boost.Multiprecision, Google Test, spdlog, QDMI, Eigen) are fetched automatically via CMake FetchContent if not found on the system. | ||
CodeMaverick2 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## Running C++ Tests | ||
|
|
||
| ```bash | ||
| # Run the full C++ test suite | ||
| ctest --test-dir build | ||
|
|
||
| # Run a single test by name (regex match) | ||
| ctest --test-dir build -R mqt-core-dd-test | ||
|
|
||
| # Run with verbose output on failure | ||
| ctest --test-dir build --output-on-failure | ||
|
|
||
| # Run a specific test binary directly for more control | ||
| ./build/test/dd/mqt-core-dd-test | ||
| ``` | ||
CodeMaverick2 marked this conversation as resolved.
Show resolved
Hide resolved
CodeMaverick2 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| Tests are organized by component under `test/`: `algorithms/`, `circuit_optimizer/`, `dd/`, `ir/` (includes QASM3 parser tests), `na/`, `zx/`, `qdmi/`, `qir/`, `fomac/`. | ||
CodeMaverick2 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| MLIR tests are located at `mlir/unittests/`. | ||
| Prefer running targeted tests over the full suite during development. | ||
|
|
||
| ## Building the Python Package | ||
|
|
||
| ```bash | ||
| # Install all dev dependencies and build the package in one step | ||
| uv sync | ||
|
|
||
| # Build only (produces wheel) | ||
| uv build | ||
CodeMaverick2 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ``` | ||
|
|
||
| Build artifacts are placed in `build/{wheel_tag}/{build_type}/`. | ||
| The Python package uses scikit-build-core as its build backend with nanobind for C++ bindings. | ||
CodeMaverick2 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| IMPORTANT: Always use `uv` for dependency management. | ||
| Never use `pip install`, `pip install -e .`, or any pip-based workflow. | ||
CodeMaverick2 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## Running Python Tests | ||
|
|
||
| ```bash | ||
| # Full test suite (via nox, handles environment setup) | ||
| uvx nox -s tests | ||
|
|
||
| # Single test file (if environment is already set up via uv sync) | ||
| uv run pytest test/python/dd/test_dd_package.py | ||
|
|
||
| # Single test function | ||
| uv run pytest test/python/dd/test_dd_package.py::test_sample_simple_circuit | ||
|
|
||
| # With coverage | ||
| uvx nox -s tests -- --cov | ||
|
|
||
| # Test with minimum dependency versions | ||
| uvx nox -s minimums | ||
|
|
||
| # Test against latest Qiskit from git | ||
| uvx nox -s qiskit | ||
| ``` | ||
CodeMaverick2 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| Python tests live in `test/python/` and use pytest with parallel execution (pytest-xdist). | ||
CodeMaverick2 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Prefer running individual test files during development. | ||
|
|
||
| ## Linting, Formatting, and Code Style | ||
|
|
||
| ```bash | ||
| # Run ALL pre-commit checks (recommended before committing) | ||
| uvx prek run -a | ||
|
|
||
| # Alternative via nox | ||
| uvx nox -s lint | ||
|
|
||
| # Python type checking only | ||
| uv run ty check | ||
| ``` | ||
CodeMaverick2 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ### Pre-commit hook priority order | ||
|
|
||
| 1. **Validation**: merge conflicts, pyproject schema, GitHub workflows, ReadTheDocs config, capitalization, typos, license headers, uv lockfile sync | ||
| 2. **Formatting**: clang-format (C++), cmake-format (CMake), prettier (YAML/MD/JSON), ruff format (Python) | ||
| 3. **Linting**: ruff check (Python) | ||
| 4. **Type checking**: ty check (Python) | ||
CodeMaverick2 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ### C++ | ||
|
|
||
| - Formatting: LLVM-based (see `.clang-format`) | ||
| - Linting: clang-tidy (see `.clang-tidy`). | ||
| To include nanobind bindings in clang-tidy analysis, configure with `-DBUILD_MQT_CORE_BINDINGS=ON`. | ||
| - Naming: `camelBack` for functions, methods, variables, parameters; `CamelCase` for classes, structs, enums; `UPPER_CASE` for global/static constants; `lower_case` for namespaces | ||
CodeMaverick2 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - Indentation: 2 spaces | ||
| - Header guards: `#pragma once` | ||
|
|
||
| ### Python | ||
|
|
||
| - Formatter: ruff format (line length 120) | ||
| - Linter: ruff check with ALL rules enabled | ||
| - Type checker: ty (not mypy) | ||
| - Docstrings: Google style | ||
| - Indentation: 4 spaces | ||
| - Imports: sorted by ruff (isort rules), `from __future__ import annotations` enforced | ||
|
|
||
| The ruff config in `pyproject.toml` uses `select = ["ALL"]` — **all rules are enabled by default**. | ||
| Only a small set of rules are selectively disabled. | ||
| Do not add new rules; only disable specific ones if necessary and document why. | ||
| Line length is 120. | ||
| Google-style docstrings are enforced. | ||
CodeMaverick2 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ### CMake | ||
|
|
||
| - Keywords: `UPPER_CASE` | ||
| - Line width: 100 | ||
| - Formatter: cmake-format (see `.cmake-format.yaml`) | ||
| - Indentation: 2 spaces | ||
CodeMaverick2 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ### General | ||
|
|
||
| - Line endings: LF | ||
| - Charset: UTF-8 | ||
| - Trailing whitespace: trimmed (except Markdown) | ||
| - Final newline: required | ||
CodeMaverick2 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## Documentation | ||
|
|
||
| ```bash | ||
| # Build and serve docs locally (requires doxygen installed) | ||
| uvx nox -s docs | ||
|
|
||
| # Build without serving (non-interactive) | ||
| uvx nox --non-interactive -s docs | ||
|
|
||
| # Check links | ||
| uvx nox -s docs -- -b linkcheck | ||
| ``` | ||
|
|
||
| Documentation uses Sphinx with MyST (Markdown) and the furo theme. | ||
| Source files are in `docs/`. | ||
| C++ API docs require doxygen and are integrated via Breathe. | ||
| MLIR docs are auto-generated from tablegen during the build. | ||
|
|
||
| ## Type Stubs | ||
|
|
||
| ```bash | ||
| # Regenerate Python type stubs from nanobind bindings | ||
| uvx nox -s stubs | ||
| ``` | ||
|
|
||
| Stub files (`.pyi`) in `python/mqt/core/` are **auto-generated** by nanobind's stubgen. | ||
| NEVER edit `.pyi` files manually — they will be overwritten. | ||
| If bindings change, regenerate stubs and commit the updated `.pyi` files. | ||
CodeMaverick2 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ## Project Layout | ||
|
|
||
| ```text | ||
| include/mqt-core/ C++ public headers (organized by component) | ||
| src/ C++ source files (mirrors include/ structure) | ||
| python/mqt/core/ Python package and auto-generated .pyi stubs | ||
| bindings/ nanobind C++ → Python bindings | ||
| test/ C++ tests (Google Test) | ||
| test/python/ Python tests (pytest) | ||
| cmake/ CMake modules and helpers | ||
| docs/ Sphinx documentation source | ||
| mlir/ MLIR quantum compilation dialects (QC, QCO) and QIR builder | ||
| eval/ Benchmarking and evaluation | ||
| json/ Device configuration files (NA, SC) | ||
| ``` | ||
CodeMaverick2 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| Components: `ir` (intermediate representation), `dd` (decision diagrams), `zx` (ZX-calculus), `algorithms`, `circuit_optimizer`, `qasm3` (OpenQASM 3.0 parser), `na` (neutral atoms), `qdmi` (device management), `qir` (QIR runtime), `fomac` (formal methods), `mlir` (MLIR dialects). | ||
CodeMaverick2 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## Platform Support | ||
|
|
||
| - **Operating systems**: Linux (Ubuntu 24.04), macOS (14, 15), Windows (2022, 2025) | ||
| - **Architectures**: x86_64 and arm64 | ||
| - **C++ compilers**: GCC 14+, Clang 20+, MSVC (latest), AppleClang 17+ | ||
| - **CI**: GitHub Actions with reusable workflows from `munich-quantum-toolkit/workflows` | ||
CodeMaverick2 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## Important Notes | ||
CodeMaverick2 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| - **License headers are required** on all source files: MIT license, SPDX identifier. | ||
| Managed by `mz-lictools`. | ||
| The license-tools pre-commit hook will fail if headers are missing. | ||
| - **Capitalization matters**: use the exact capitalizations "nanobind", "CMake", "ccache", "GitHub", "NumPy", "pytest", "MQT", and "TUM". | ||
| A pre-commit hook (`disallow-caps`) enforces this and will reject common misspellings. | ||
CodeMaverick2 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - **MLIR caveats**: MLIR is disabled automatically on macOS with GCC (ABI incompatibility) and with AppleClang < 17 (incomplete C++20 support). | ||
CodeMaverick2 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - **Stub files**: Never edit `.pyi` files by hand. | ||
CodeMaverick2 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Always regenerate with `uvx nox -s stubs`. | ||
CodeMaverick2 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - **uv lockfile**: The `uv.lock` file must stay in sync. | ||
| The pre-commit hook `uv-lock` checks this. | ||
| Run `uv lock` if you change dependencies in `pyproject.toml`. | ||
CodeMaverick2 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - **Templated files**: Some files are generated by the [templating action](https://github.com/munich-quantum-toolkit/templates) and must not be edited directly, as changes will be overwritten. | ||
| These files are marked by an initial comment such as `# This file has been generated from an external template. Please do not modify it directly.` | ||
| - **Pre-commit hooks must pass** before submitting pull requests. | ||
| Run `uvx prek run -a` to check locally. | ||
CodeMaverick2 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - **Test your changes**: all changes must be tested. | ||
| Write C++ tests with Google Test in `test/`, Python tests with pytest in `test/python/`. | ||
CodeMaverick2 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.