This is an automated email from the ASF dual-hosted git repository.

400Ping pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/mahout.git


The following commit(s) were added to refs/heads/main by this push:
     new 9109143c7 docs: improve Python API reference UX (#1457)
9109143c7 is described below

commit 9109143c7b531b061059d007e6964caf6bf67099
Author: Vic Wen <[email protected]>
AuthorDate: Sat Aug 8 14:05:22 2026 +0800

    docs: improve Python API reference UX (#1457)
    
    Signed-off-by: viiccwen <[email protected]>
---
 docs/api/index.md             |  19 -----
 docs/api/qumat_header.md      |  16 +++--
 docs/api/qumat_qdp_header.md  |  21 ++++--
 docs/index.md                 |   5 +-
 docs/qdp/api.md               | 156 ----------------------------------------
 docs/qumat/api.md             | 162 ------------------------------------------
 docs/qumat/getting-started.md |  16 +++--
 website/README.md             |  18 +++--
 website/scripts/sync-docs.js  |  20 +++---
 website/sidebars.ts           |  10 ---
 10 files changed, 58 insertions(+), 385 deletions(-)

diff --git a/docs/api/index.md b/docs/api/index.md
deleted file mode 100644
index 6bf5de545..000000000
--- a/docs/api/index.md
+++ /dev/null
@@ -1,19 +0,0 @@
----
-title: API Reference
-sidebar_label: API Reference
-description: Generated API reference for Apache Mahout.
-hide_edit_button: true
-toc_min_heading_level: 2
-toc_max_heading_level: 3
----
-
-# API Reference
-
-This experimental reference is for developers trying Mahout's Python APIs.
-It focuses on the public interfaces you are expected to call while the API
-documentation is still evolving.
-
-## Packages
-
-- [Qumat](qumat.md)
-- [QDP](qumat_qdp.md)
diff --git a/docs/api/qumat_header.md b/docs/api/qumat_header.md
index 318175649..88734c164 100644
--- a/docs/api/qumat_header.md
+++ b/docs/api/qumat_header.md
@@ -1,10 +1,14 @@
 ---
-title: Qumat
-sidebar_label: Qumat
-description: Generated API reference for Apache Mahout.
-hide_edit_button: true
+title: API Reference
+sidebar_label: API Reference
+description: Generated Python API reference for the Qumat circuit interface.
+custom_edit_url: null
 toc_min_heading_level: 2
-toc_max_heading_level: 3
+toc_max_heading_level: 4
 ---
 
-# Qumat
+# API Reference
+
+Use this page when you know which class or method you need. For installation,
+backend configuration, and a complete first circuit, see
+[Qumat getting started](./getting-started.md).
diff --git a/docs/api/qumat_qdp_header.md b/docs/api/qumat_qdp_header.md
index 573ea06e3..14cb9b5f0 100644
--- a/docs/api/qumat_qdp_header.md
+++ b/docs/api/qumat_qdp_header.md
@@ -1,10 +1,21 @@
 ---
-title: QDP
-sidebar_label: QDP
-description: Generated API reference for Apache Mahout.
-hide_edit_button: true
+title: API Reference
+sidebar_label: API Reference
+description: Generated Python API reference for QDP encoding and data loading.
+custom_edit_url: null
 toc_min_heading_level: 2
 toc_max_heading_level: 3
 ---
 
-# QDP
+# API Reference
+
+Use the [QDP Python guide](./python-api.md) for backend selection and
+complete workflows. Use this generated reference for signatures, parameters,
+return values, and exceptions.
+
+## Key entry points
+
+- [QdpEngine](#qdpengine) — encode data with an explicitly selected backend
+- [QuantumDataLoader](#quantumdataloader) — build iterable encoding pipelines
+- [QdpBenchmark](#qdpbenchmark) — measure throughput and latency
+- [QdpTensor](#qdptensor) — exchange encoded results through DLPack
diff --git a/docs/index.md b/docs/index.md
index bb2dc9ec1..ee26b7e88 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -20,8 +20,9 @@ anywhere.'
 - [Basic Gates](./qumat/basic-gates) - Introduction to fundamental quantum 
gates (NOT, Hadamard, CNOT, Toffoli, SWAP, Pauli gates, CSWAP, U gate)
 - [Parameterized Quantum Circuits and Rotation 
Gates](./qumat/parameterized-circuits) - Rotation gates (Rx, Ry, Rz) and 
creating/optimizing parameterized circuits
 
-### API Reference
-- [API Documentation](./qumat/api) - Complete reference for all QuMat class 
methods
+### Python API Reference
+- [Qumat API](./qumat/api) - Generated reference for quantum circuits
+- [QDP API](./qdp/api) - Generated reference for quantum data encoding
 
 ### Additional Resources
 - [Parameterized Quantum Circuits: Developer's Guide](./advanced/pqc) - 
In-depth guide to PQCs
diff --git a/docs/qdp/api.md b/docs/qdp/api.md
deleted file mode 100644
index 38bc05986..000000000
--- a/docs/qdp/api.md
+++ /dev/null
@@ -1,156 +0,0 @@
----
-title: API Reference - QDP
----
-
-# API Reference
-
-Mahout QDP (Quantum Data Plane) provides GPU-accelerated quantum state 
encoding.
-It writes classical data directly into GPU memory and returns a 
DLPack-compatible
-handle for zero-copy integration with downstream frameworks.
-
-## Module: `qumat.qdp`
-
-Prefer importing from `qumat.qdp`; the native extension is `_qdp`.
-
-```python
-import qumat.qdp as qdp
-# or: from _qdp import QdpEngine, QuantumTensor
-```
-
-## Class: `QdpEngine`
-
-### `QdpEngine(device_id=0, precision="float32", backend="cuda")`
-
-Create a GPU encoder instance.
-
-**Parameters**
-- `device_id` (int): GPU device ordinal, default `0` (CUDA ordinal when 
`backend="cuda"`; ROCm/PyTorch device index when `backend="amd"`).
-- `precision` (str): `"float32"` or `"float64"`.
-- `backend` (str): Public Python route selector. `qumat.qdp` uses `"cuda"` for 
the Rust/CUDA path and `"amd"` for the Triton AMD route.
-
-**Raises**
-- `RuntimeError`: Initialization failure or unsupported precision.
-
-### `encode(data, num_qubits, encoding_method="amplitude") -> QuantumTensor`
-
-Encode classical input into a quantum state and return a DLPack tensor on GPU.
-
-**Parameters**
-- `data`: Supported inputs
-  - `list[float]`
-  - `numpy.ndarray` (1D/2D, dtype=float64, C-contiguous)
-  - `torch.Tensor` (CPU): float64, contiguous
-  - `torch.Tensor` (CUDA, direct-input fast path): float32 or float64, 
contiguous, on the same device as the engine. Limited to `amplitude`, `angle`, 
`basis`, `iqp`, and `iqp-z` (see Advanced Encoding Support Matrix). For 
`phase`, pass a CPU tensor, NumPy array, or list instead.
-  - `str` / `pathlib.Path` file path
-    - `.parquet`, `.arrow` / `.feather`, `.npy`, `.pt` / `.pth`, `.pb`
-    - remote URL (`s3://bucket/key`, `gs://bucket/key`) when built with 
`remote-io`
-- `num_qubits` (int): Number of qubits, range 1–30.
-- `encoding_method` (str): `"amplitude" | "angle" | "basis" | "phase" | "iqp" 
| "iqp-z"` (lowercase).
-
-**Returns**
-- `QuantumTensor` with 2D shape:
-  - single sample: `[1, 2^num_qubits]`
-  - batch: `[batch_size, 2^num_qubits]`
-
-**Notes**
-- Output dtype is `complex64` (`precision="float32"`) or `complex128` 
(`precision="float64"`).
-- Parquet streaming currently supports `"amplitude"` and `"basis"`.
-- PyTorch file inputs (`.pt`, `.pth`) require building with the `pytorch` 
feature.
-- Remote URL query/fragment is not supported (`?versionId=...`, `#...`).
-
-### Advanced Encoding Support Matrix
-
-For the advanced methods documented below, support currently differs by route:
-
-| Surface | `phase` | `iqp` | `iqp-z` |
-|---------|---------|-------|---------|
-| `qumat.qdp.QdpEngine(..., backend="cuda").encode(...)` | ✅ | ✅ | ✅ |
-| CUDA tensor direct-input fast path | ❌ | ✅ | ✅ |
-| `qumat.qdp.QdpEngine(..., backend="amd")` | ❌ | ❌ | ❌ |
-
-Notes:
-- `phase` is implemented and tested on the CUDA encode path, but it is not 
part of the CUDA tensor direct-input fast path today.
-- The AMD Triton route currently supports `amplitude`, `angle`, and `basis` 
only.
-
-**Raises**
-- `RuntimeError`: Invalid inputs, shapes, dtypes, or unsupported formats.
-
-### `encode_from_tensorflow(path, num_qubits, encoding_method="amplitude") -> 
QuantumTensor`
-
-Encode directly from a TensorFlow TensorProto file (`.pb`).
-
-## Class: `QuantumTensor`
-
-DLPack wrapper for GPU-resident quantum states.
-
-### `__dlpack__(stream=None)`
-
-Return a DLPack PyCapsule. This can be consumed only once.
-
-### `__dlpack_device__()`
-
-Return `(device_type, device_id)`; CUDA devices report `(2, gpu_id)`.
-
-**Ownership & Lifetime**
-- If not consumed, memory is freed when the object is dropped.
-- If consumed, ownership transfers to the consumer (e.g., PyTorch).
-
-## Encoding Methods
-
-### `amplitude`
-
-- Input length `<= 2^num_qubits`; remaining entries are zero-padded.
-- L2 normalization is applied.
-- Zero vectors / NaN / Inf raise errors.
-
-### `angle`
-
-- Each sample must provide exactly `num_qubits` angles.
-- NaN / Inf raise errors.
-
-### `basis`
-
-- Each sample provides one integer index in `[0, 2^num_qubits)`.
-
-### `phase`
-
-- Expects `n` phase angles for `n = num_qubits`.
-- Produces a product state of the form `(1/sqrt(2^n)) * sum_b exp(i * 
phase(b)) |b>`.
-- All phase angles must be finite (no NaN/Inf).
-- Available on the CUDA encode path; not currently exposed through the AMD 
route.
-
-### `iqp`
-
-- Expects `n + n*(n-1)/2` parameters for `n = num_qubits` (Z + ZZ terms).
-- All parameters must be finite (no NaN/Inf).
-
-### `iqp-z`
-
-- Expects `n` parameters for `n = num_qubits` (Z terms only).
-- All parameters must be finite (no NaN/Inf).
-
-## Supported File Formats
-
-- **Parquet**: `.parquet`
-- **Arrow IPC**: `.arrow`, `.feather`
-- **NumPy**: `.npy`
-- **PyTorch**: `.pt`, `.pth` (requires `pytorch` feature)
-- **TensorFlow**: `.pb` (TensorProto)
-
-## Common Errors
-
-- `num_qubits` out of range.
-- Input length exceeds `2^num_qubits`.
-- CPU NumPy / Torch inputs that are not contiguous `float64`.
-- CUDA Torch tensors used with unsupported encoding methods (e.g. `phase`), or 
CUDA tensors that are not contiguous / not on the same device as the engine.
-- DLPack capsule consumed more than once.
-
-## Requirements & Deprecation
-
-- Linux with an NVIDIA GPU (CUDA).
-- CUDA driver/toolkit installed.
-- Python 3.10–3.12 (`requires-python >=3.10,<3.13`).
-- `qumat` installed (the QDP native extension ships as `qumat-qdp`).
-- Optional: `torch` for DLPack integration, `numpy` for NumPy inputs.
-
-No deprecations are planned for the initial PoC.
diff --git a/docs/qumat/api.md b/docs/qumat/api.md
deleted file mode 100644
index 462829539..000000000
--- a/docs/qumat/api.md
+++ /dev/null
@@ -1,162 +0,0 @@
----
-title: QuMat Class Methods
-sidebar_label: API
----
-
-# QuMat Class Methods
-
-## `__init__(self, backend_config)`
-- **Purpose**: Initializes the QuMat instance with a specific backend.
-- **Parameters**:
-    - `backend_config` (dict): Configuration for the backend including its 
name and options.
-- **Usage**: Used to set up the quantum computing backend based on user 
configuration.
-
-## `create_empty_circuit(self, num_qubits)`
-- **Purpose**: Creates an empty quantum circuit with a specified number of 
qubits.
-- **Parameters**:
-    - `num_qubits` (int): Number of qubits in the quantum circuit.
-- **Usage**: Used at the start of quantum computations to prepare a new 
quantum circuit.
-
-## `apply_not_gate(self, qubit_index)`
-- **Purpose**: Applies a NOT gate (quantum equivalent of a classical NOT) to a 
specified qubit.
-- **Parameters**:
-    - `qubit_index` (int): Index of the qubit to which the gate is applied.
-- **Usage**: Used to flip the state of a qubit from 0 to 1 or from 1 to 0.
-
-## `apply_hadamard_gate(self, qubit_index)`
-- **Purpose**: Applies a Hadamard gate to a specified qubit.
-- **Parameters**:
-    - `qubit_index` (int): Index of the qubit.
-- **Usage**: Used to create a superposition state, allowing the qubit to be 
both 0 and 1 simultaneously.
-
-## `apply_cnot_gate(self, control_qubit_index, target_qubit_index)`
-- **Purpose**: Applies a Controlled-NOT (CNOT) gate between two qubits.
-- **Parameters**:
-    - `control_qubit_index` (int): Index of the control qubit.
-    - `target_qubit_index` (int): Index of the target qubit.
-- **Usage**: Fundamental for entangling qubits, which is essential for quantum 
algorithms.
-
-## `apply_toffoli_gate(self, control_qubit_index1, control_qubit_index2, 
target_qubit_index)`
-- **Purpose**: Applies a Toffoli gate (CCX gate) to three qubits.
-- **Parameters**:
-    - `control_qubit_index1` (int): Index of the first control qubit.
-    - `control_qubit_index2` (int): Index of the second control qubit.
-    - `target_qubit_index` (int): Index of the target qubit.
-- **Usage**: Acts as a quantum AND gate, used in algorithms requiring 
conditional logic.
-
-## `apply_swap_gate(self, qubit_index1, qubit_index2)`
-- **Purpose**: Swaps the states of two qubits.
-- **Parameters**:
-    - `qubit_index1` (int): Index of the first qubit.
-    - `qubit_index2` (int): Index of the second qubit.
-- **Usage**: Useful in quantum algorithms for rearranging qubit states.
-
-## `apply_cswap_gate(self, control_qubit_index, target_qubit_index1, 
target_qubit_index2)`
-- **Purpose**: Applies a controlled-SWAP (Fredkin) gate that swaps two targets 
when the control is |1⟩.
-- **Parameters**:
-    - `control_qubit_index` (int): Index of the control qubit.
-    - `target_qubit_index1` (int): Index of the first target qubit.
-    - `target_qubit_index2` (int): Index of the second target qubit.
-- **Usage**: Used in overlap estimation routines such as the swap test.
-
-## `apply_pauli_x_gate(self, qubit_index)`
-- **Purpose**: Applies a Pauli-X gate to a specified qubit.
-- **Parameters**:
-    - `qubit_index` (int): Index of the qubit.
-- **Usage**: Equivalent to a NOT gate, flips the qubit state.
-
-## `apply_pauli_y_gate(self, qubit_index)`
-- **Purpose**: Applies a Pauli-Y gate to a specified qubit.
-- **Parameters**:
-    - `qubit_index` (int): Index of the qubit.
-- **Usage**: Impacts the phase and amplitude of a qubit's state.
-
-## `apply_pauli_z_gate(self, qubit_index)`
-- **Purpose**: Applies a Pauli-Z gate to a specified qubit.
-- **Parameters**:
-    - `qubit_index` (int): Index of the qubit.
-- **Usage**: Alters the phase of a qubit without changing its amplitude.
-
-## `apply_t_gate(self, qubit_index)`
-- **Purpose**: Applies the T (π/8) phase gate to a specified qubit.
-- **Parameters**:
-    - `qubit_index` (int): Index of the qubit.
-- **Usage**: Adds a π/4 phase to |1⟩. Together with the Hadamard (H) and CNOT 
gates, it enables universal single-qubit control.
-
-## `execute_circuit(self)`
-- **Purpose**: Executes the quantum circuit and retrieves the results.
-- **Usage**: Used to run the entire set of quantum operations and measure the 
outcomes.
-
-## `get_final_state_vector(self)`
-- **Purpose**: Returns the final state vector of the circuit from the 
configured backend.
-- **Usage**: Retrieves the full quantum state for simulation and analysis 
workflows.
-
-## `draw_circuit(self)`
-- **Purpose**: Visualizes the quantum circuit.
-- **Returns**: A string representation of the circuit visualization (format 
depends on backend).
-- **Usage**: Returns a visualization string that can be printed or used 
programmatically. Example: `print(qc.draw_circuit())` or `viz = 
qc.draw_circuit()`.
-- **Note**: Uses underlying libraries' methods for drawing circuits (Qiskit's 
`draw()`, Cirq's `str()`, or Braket's `str()`).
-
-## `apply_rx_gate(self, qubit_index, angle)`
-- **Purpose**: Applies a rotation around the X-axis to a specified qubit with 
an optional parameter for optimization.
-- **Parameters**:
-    - `qubit_index` (int): Index of the qubit.
-    - `angle` (str or float): Angle in radians for the rotation. Can be a 
static value or a parameter name for optimization.
-- **Usage**: Used to rotate a qubit around the X-axis, often in parameterized 
quantum circuits for variational algorithms.
-
-## `apply_ry_gate(self, qubit_index, angle)`
-- **Purpose**: Applies a rotation around the Y-axis to a specified qubit with 
an optional parameter for optimization.
-- **Parameters**:
-    - `qubit_index` (int): Index of the qubit.
-    - `angle` (str or float): Angle in radians for the rotation. Can be a 
static value or a parameter name for optimization.
-- **Usage**: Used to rotate a qubit around the Y-axis in parameterized 
circuits, aiding in the creation of complex quantum states.
-
-## `apply_rz_gate(self, qubit_index, angle)`
-- **Purpose**: Applies a rotation around the Z-axis to a specified qubit with 
an optional parameter for optimization.
-- **Parameters**:
-    - `qubit_index` (int): Index of the qubit.
-    - `angle` (str or float): Angle in radians for the rotation. Can be a 
static value or a parameter name for optimization.
-- **Usage**: Utilized in parameterized quantum circuits to modify the phase of 
a qubit state during optimization.
-
-## `apply_u_gate(self, qubit_index, theta, phi, lambd)`
-- **Purpose**: Applies the universal single-qubit U(θ, φ, λ) gate.
-- **Parameters**:
-    - `qubit_index` (int): Index of the qubit.
-    - `theta` (float): Rotation angle θ.
-    - `phi` (float): Rotation angle φ.
-    - `lambd` (float): Rotation angle λ.
-- **Usage**: Provides full single-qubit unitary control via Z–Y–Z Euler 
decomposition.
-
-## `execute_circuit(self, parameter_values=None)`
-- **Purpose**: Executes the quantum circuit with the ability to bind specific 
parameter values if provided.
-- **Parameters**:
-    - `parameter_values` (dict, optional): A dictionary where keys are 
parameter names and values are the numerical values to bind.
-- **Usage**: Enables the execution of parameterized circuits by binding 
parameter values, facilitating optimization processes.
-
-## `bind_parameters(self, parameter_values)`
-- **Purpose**: Binds numerical values to the parameters of the quantum 
circuit, allowing for dynamic updates during optimization.
-- **Parameters**:
-    - `parameter_values` (dict): A dictionary with parameter names as keys and 
numerical values to bind.
-- **Usage**: Essential for optimization loops where parameters are adjusted 
based on cost function evaluations.
-
-## `_handle_parameter(self, param_name)`
-- **Purpose**: Internal function to manage parameter registration.
-- **Parameters**:
-    - `param_name` (str): The name of the parameter to handle.
-- **Usage**: Automatically invoked when applying parameterized gates to keep 
track of parameters efficiently.
-
-## `swap_test(self, ancilla_qubit, qubit1, qubit2)`
-- **Purpose**: Builds the swap-test subcircuit (H–CSWAP–H) to compare two 
quantum states.
-- **Parameters**:
-    - `ancilla_qubit` (int): Index of the ancilla control qubit.
-    - `qubit1` (int): Index of the first state qubit.
-    - `qubit2` (int): Index of the second state qubit.
-- **Usage**: Used in overlap/fidelity estimation between two states.
-
-## `measure_overlap(self, qubit1, qubit2, ancilla_qubit=0)`
-- **Purpose**: Executes the swap test and returns |⟨ψ|φ⟩|² using 
backend-specific measurement parsing.
-- **Parameters**:
-    - `qubit1` (int): Index of the first state qubit.
-    - `qubit2` (int): Index of the second state qubit.
-    - `ancilla_qubit` (int, default to 0): Index of the ancilla qubit.
-- **Usage**: Convenience wrapper for fidelity/overlap measurement across 
backends.
diff --git a/docs/qumat/getting-started.md b/docs/qumat/getting-started.md
index 4547e3ff5..bffaf3941 100644
--- a/docs/qumat/getting-started.md
+++ b/docs/qumat/getting-started.md
@@ -37,12 +37,16 @@ The project uses `uv` to handle dependency overrides 
required for Python 3.10+ c
 ## Basic Usage
 
 ```python
-from qumat import QumatCircuit
-
-circuit = QumatCircuit(2)
-circuit.h(0)
-circuit.cx(0, 1)
-result = circuit.run()
+from qumat import QuMat
+
+qumat = QuMat({
+    "backend_name": "qiskit",
+    "backend_options": {"simulator_type": "aer_simulator"},
+})
+qumat.create_empty_circuit(num_qubits=2)
+qumat.apply_hadamard_gate(0)
+qumat.apply_cnot_gate(0, 1)
+result = qumat.execute_circuit()
 print(result)
 ```
 
diff --git a/website/README.md b/website/README.md
index 8a36da761..f20f1920c 100644
--- a/website/README.md
+++ b/website/README.md
@@ -15,7 +15,7 @@ npm install
 npm run start
 ```
 
-This starts a local development server at `http://localhost:3000` with hot 
reload. The changes to the documentation will be reflected at 
`http://localhost:3000/docs/next/`.
+This starts a local development server at `http://localhost:3000` with hot 
reload. The changes to the documentation will be reflected at 
`http://localhost:3000/docs/master/`.
 
 ## Architecture
 
@@ -156,10 +156,14 @@ Syntax highlighting is available for: Python, Java, 
Scala, Rust, Bash, and more.
 
 ````markdown
 ```python
-from qumat import QumatCircuit
-
-circuit = QumatCircuit(2)
-circuit.h(0)
+from qumat import QuMat
+
+qumat = QuMat({
+    "backend_name": "qiskit",
+    "backend_options": {"simulator_type": "aer_simulator"},
+})
+qumat.create_empty_circuit(num_qubits=2)
+qumat.apply_hadamard_gate(0)
 ```
 ````
 
@@ -168,7 +172,7 @@ circuit.h(0)
 ### Current Versions
 
 Released versions are listed in `versions.json`. The first version in that 
file is
-served as `latest` at `/docs`; the editable current docs are served at 
`/docs/next`.
+served as `latest` at `/docs`; the editable current docs are served at 
`/docs/master`.
 
 ### Creating a New Version
 
@@ -227,7 +231,7 @@ Triggers:
 
 ### Changes are not reflected in the development server
 
-Please ensure that you are looking at `http://localhost:3000/docs/next/`.
+Please ensure that you are looking at `http://localhost:3000/docs/master/`.
 
 ### Broken Links
 
diff --git a/website/scripts/sync-docs.js b/website/scripts/sync-docs.js
index a21b50707..0e18613cd 100644
--- a/website/scripts/sync-docs.js
+++ b/website/scripts/sync-docs.js
@@ -25,7 +25,6 @@ const DEST_DIR = path.resolve(__dirname, '../docs');
 const BLOG_SOURCE_DIR = path.resolve(__dirname, '../../docs/blog');
 const BLOG_DEST_DIR = path.resolve(__dirname, '../blog');
 const API_SOURCE_DIR = path.resolve(__dirname, '../../docs/api');
-const API_DEST_DIR = path.resolve(__dirname, '../docs/api');
 
 // Files that should be preserved during sync (not deleted)
 const PRESERVE_FILES = ['.gitignore'];
@@ -37,7 +36,7 @@ const EXCLUDE_PATTERNS = [
   /\.pyc$/,
   /^__pycache__$/,
   /^blog$/, // Blog is synced separately to website/blog
-  /^api$/, // API generator config is rendered separately into website/docs/api
+  /^api$/, // API generator config replaces the Qumat and QDP API pages
 ];
 
 /**
@@ -217,28 +216,24 @@ function runCommand(command, args, options = {}) {
  * Generate Python API reference docs with pydoc-markdown.
  */
 function generateApiDocs() {
-  fs.rmSync(API_DEST_DIR, { recursive: true, force: true });
-  ensureDir(API_DEST_DIR);
-
-  copyFile(path.join(API_SOURCE_DIR, 'index.md'), path.join(API_DEST_DIR, 
'index.md'));
-
   const pages = [
     {
       header: 'qumat_header.md',
       config: 'qumat.yml',
-      output: 'qumat.md',
+      output: path.join('qumat', 'api.md'),
     },
     {
       header: 'qumat_qdp_header.md',
       config: 'qumat_qdp.yml',
-      output: 'qumat_qdp.md',
+      output: path.join('qdp', 'api.md'),
     },
   ];
 
   if (process.env.MAHOUT_SKIP_API_DOCS === '1') {
     console.log('Skipping generated Python API reference docs.');
     for (const page of pages) {
-      const outputPath = path.join(API_DEST_DIR, page.output);
+      const outputPath = path.join(DEST_DIR, page.output);
+      ensureDir(path.dirname(outputPath));
       copyFile(path.join(API_SOURCE_DIR, page.header), outputPath);
       fs.appendFileSync(
         outputPath,
@@ -251,7 +246,8 @@ function generateApiDocs() {
   runCommand('uv', ['sync', '--frozen', '--group', 'dev']);
 
   for (const page of pages) {
-    const outputPath = path.join(API_DEST_DIR, page.output);
+    const outputPath = path.join(DEST_DIR, page.output);
+    ensureDir(path.dirname(outputPath));
     copyFile(path.join(API_SOURCE_DIR, page.header), outputPath);
 
     const generated = runCommand(
@@ -259,7 +255,7 @@ function generateApiDocs() {
       ['run', '--frozen', '--group', 'dev', 'pydoc-markdown', 
path.join('docs/api', page.config)],
       { capture: true },
     );
-    fs.appendFileSync(outputPath, generated);
+    fs.appendFileSync(outputPath, `\n${generated}`);
   }
 }
 
diff --git a/website/sidebars.ts b/website/sidebars.ts
index 98a9b0351..04ab3f439 100644
--- a/website/sidebars.ts
+++ b/website/sidebars.ts
@@ -56,16 +56,6 @@ const sidebars: SidebarsConfig = {
         'advanced/gap-analysis',
       ],
     },
-    {
-      type: 'category',
-      label: 'API Reference (experiments)',
-      collapsed: true,
-      link: {type: 'doc', id: 'api/index'},
-      items: [
-        'api/qumat',
-        'api/qumat_qdp',
-      ],
-    },
     {
       type: 'category',
       label: 'Quantum Computing Primer',

Reply via email to