Skip to content
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

Group Qiskit table of contents into sections #1255

Merged
merged 29 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
49088f1
Organize Qiskit left ToC into groups
Eric-Arellano Apr 30, 2024
92a93df
Regenerate qiskit 0.19.6
Eric-Arellano May 1, 2024
48add81
Regenerate qiskit 0.24.1
Eric-Arellano May 1, 2024
b9e4c5e
Regenerate qiskit 0.25.4
Eric-Arellano May 1, 2024
df714bb
Regenerate qiskit 0.26.2
Eric-Arellano May 1, 2024
7eede03
Regenerate qiskit 0.27.0
Eric-Arellano May 1, 2024
ce67fdd
Regenerate qiskit 0.28.0
Eric-Arellano May 1, 2024
37991db
Regenerate qiskit 0.29.1
Eric-Arellano May 1, 2024
eb8b91b
Regenerate qiskit 0.30.1
Eric-Arellano May 1, 2024
5786ad0
Regenerate qiskit 0.31.0
Eric-Arellano May 1, 2024
0f8238f
Regenerate qiskit 0.32.1
Eric-Arellano May 1, 2024
a5e79da
Regenerate qiskit 0.33.1
Eric-Arellano May 1, 2024
950f8ac
Regenerate qiskit 0.35.0
Eric-Arellano May 1, 2024
0d1594b
Regenerate qiskit 0.36.0
Eric-Arellano May 1, 2024
9ae18e7
Regenerate qiskit 0.37.2
Eric-Arellano May 1, 2024
edf6e9e
Regenerate qiskit 0.43.0
Eric-Arellano May 1, 2024
e4e6b46
Regenerate qiskit 0.44.0
Eric-Arellano May 1, 2024
99e12d6
Regenerate qiskit 0.45.3
Eric-Arellano May 1, 2024
f296318
Regenerate qiskit 0.46.1
Eric-Arellano May 1, 2024
e88bed0
Regenerate qiskit 1.0.2
Eric-Arellano May 1, 2024
82fd8e4
Regenerate qiskit 1.1.0-dev
Eric-Arellano May 1, 2024
43fe0ca
Regenerate Qiskit 0.38
Eric-Arellano May 2, 2024
54ea0a9
Regen qiskit 0.39
Eric-Arellano May 2, 2024
86a7aff
regen qiskit 0.40
Eric-Arellano May 2, 2024
a819316
regen qiskit 0.41
Eric-Arellano May 2, 2024
f4ee5ab
regen qiskit 0.42
Eric-Arellano May 2, 2024
ad28be5
Comply with expectations of https://github.com/Qiskit/documentation/p…
Eric-Arellano May 3, 2024
53dbe5d
Go back to using hasPrefix now that we have a test
Eric-Arellano May 3, 2024
6eab21b
Merge branch 'main' of github.com:Qiskit/documentation into EA/qiskit…
Eric-Arellano May 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5,620 changes: 2,825 additions & 2,795 deletions docs/api/qiskit/0.19/_toc.json

Large diffs are not rendered by default.

7,296 changes: 3,663 additions & 3,633 deletions docs/api/qiskit/0.24/_toc.json

Large diffs are not rendered by default.

8,524 changes: 4,282 additions & 4,242 deletions docs/api/qiskit/0.25/_toc.json

Large diffs are not rendered by default.

8,580 changes: 4,310 additions & 4,270 deletions docs/api/qiskit/0.26/_toc.json

Large diffs are not rendered by default.

8,580 changes: 4,310 additions & 4,270 deletions docs/api/qiskit/0.27/_toc.json

Large diffs are not rendered by default.

8,866 changes: 4,453 additions & 4,413 deletions docs/api/qiskit/0.28/_toc.json

Large diffs are not rendered by default.

8,858 changes: 4,449 additions & 4,409 deletions docs/api/qiskit/0.29/_toc.json

Large diffs are not rendered by default.

8,872 changes: 4,456 additions & 4,416 deletions docs/api/qiskit/0.30/_toc.json

Large diffs are not rendered by default.

8,872 changes: 4,456 additions & 4,416 deletions docs/api/qiskit/0.31/_toc.json

Large diffs are not rendered by default.

8,872 changes: 4,456 additions & 4,416 deletions docs/api/qiskit/0.32/_toc.json

Large diffs are not rendered by default.

5,415 changes: 2,735 additions & 2,680 deletions docs/api/qiskit/0.33/_toc.json

Large diffs are not rendered by default.

5,761 changes: 2,908 additions & 2,853 deletions docs/api/qiskit/0.35/_toc.json

Large diffs are not rendered by default.

5,735 changes: 2,895 additions & 2,840 deletions docs/api/qiskit/0.36/_toc.json

Large diffs are not rendered by default.

6,089 changes: 3,072 additions & 3,017 deletions docs/api/qiskit/0.37/_toc.json

Large diffs are not rendered by default.

6,127 changes: 3,091 additions & 3,036 deletions docs/api/qiskit/0.38/_toc.json

Large diffs are not rendered by default.

6,825 changes: 3,440 additions & 3,385 deletions docs/api/qiskit/0.39/_toc.json

Large diffs are not rendered by default.

7,555 changes: 3,805 additions & 3,750 deletions docs/api/qiskit/0.40/_toc.json

Large diffs are not rendered by default.

7,581 changes: 3,818 additions & 3,763 deletions docs/api/qiskit/0.41/_toc.json

Large diffs are not rendered by default.

7,605 changes: 3,830 additions & 3,775 deletions docs/api/qiskit/0.42/_toc.json

Large diffs are not rendered by default.

6,095 changes: 3,070 additions & 3,025 deletions docs/api/qiskit/0.43/_toc.json

Large diffs are not rendered by default.

4,709 changes: 2,372 additions & 2,337 deletions docs/api/qiskit/0.44/_toc.json

Large diffs are not rendered by default.

4,475 changes: 2,255 additions & 2,220 deletions docs/api/qiskit/0.45/_toc.json

Large diffs are not rendered by default.

4,519 changes: 2,277 additions & 2,242 deletions docs/api/qiskit/0.46/_toc.json

Large diffs are not rendered by default.

2,508 changes: 1,269 additions & 1,239 deletions docs/api/qiskit/_toc.json

Large diffs are not rendered by default.

2,434 changes: 1,232 additions & 1,202 deletions docs/api/qiskit/dev/_toc.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions scripts/lib/api/Pkg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { join } from "path/posix";
import { findSeparateReleaseNotesVersions } from "./releaseNotes";
import { getRoot } from "../fs";
import { determineHistoricalQiskitGithubUrl } from "../qiskitMetapackage";
import { TocGrouping } from "./TocGrouping";
import { TocGrouping, QISKIT_TOC_GROUPING } from "./TocGrouping";

export class ReleaseNotesConfig {
readonly enabled: boolean;
Expand Down Expand Up @@ -91,7 +91,7 @@ export class Pkg {
releaseNotesConfig: new ReleaseNotesConfig({
separatePagesVersions: releaseNoteEntries,
}),
nestModulesInToc: true,
tocGrouping: QISKIT_TOC_GROUPING,
});
}

Expand Down
138 changes: 138 additions & 0 deletions scripts/lib/api/TocGrouping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
// copyright notice, and modified files need to carry a notice indicating
// that they have been altered from the originals.

import { hasPrefix } from "../stringUtils";

/** A human-written section used to group several modules, e.g. 'Circuit Construction'. */
type Section = {
name: string;
Expand Down Expand Up @@ -38,3 +40,139 @@ export type TocGrouping = {
* Return `undefined` if the module does not belong in any specific Section.*/
moduleToSection: (module: string) => string | undefined;
};

// Qiskit section names
const _CIRCUITS = "Circuit construction";
const _TRANSPILATION = "Transpilation";
const _PRIMITVES = "Primitives and providers";
const _RESULTS = "Results and visualizations";
const _OPFLOW = "Opflow";
const _SERIALIZATION = "Serialization (OpenQASM and QPY)";
const _PULSE = "Pulse-level programming";
const _OTHER = "Other";
const _AER = "Qiskit Aer";
const _IBMQ = "IBM Q Provider";
const _ALGORITHMS = "Algorithms";
const _AQUA = "Qiskit Aqua";
const _IGNIS = "Qiskit Ignis";
const _FINANCE = "Finance";
const _CHEMISTRY = "Chemistry";
const _ML = "Machine learning";
const _OPTIMIZATION = "Optimization";

// The ordering of Qiskit ToC
const QISKIT_ENTRIES = [
{ moduleId: "qiskit", title: "API index", kind: "module" },
{ name: _CIRCUITS, kind: "section" },
{
moduleId: "qiskit.quantum_info",
title: "Quantum information (qiskit.quantum_info)",
kind: "module",
},
{ name: _TRANSPILATION, kind: "section" },
{ name: _PRIMITVES, kind: "section" },
{ name: _RESULTS, kind: "section" },
{ name: _OPFLOW, kind: "section" },
{ name: _SERIALIZATION, kind: "section" },
{ name: _PULSE, kind: "section" },
{ moduleId: "qiskit.execute", title: "qiskit.execute", kind: "module" },
{
moduleId: "qiskit.execute_function",
title: "qiskit.execute_function",
kind: "module",
},
{ name: _OTHER, kind: "section" },
{ name: _AER, kind: "section" },
{ name: _IBMQ, kind: "section" },
{ name: _ALGORITHMS, kind: "section" },
{ name: _AQUA, kind: "section" },
{ name: _IGNIS, kind: "section" },
{ name: _FINANCE, kind: "section" },
{ name: _CHEMISTRY, kind: "section" },
{ name: _ML, kind: "section" },
{ name: _OPTIMIZATION, kind: "section" },
] as const;

function qiskitModuleToSection(module: string): string | undefined {
if (
hasPrefix(module, ["qiskit.circuit", "qiskit.extensions"]) &&
module === "qiskit.circuit.qpy_serialization"
) {
return _CIRCUITS;
}

if (
hasPrefix(module, [
"qiskit.converters",
"qiskit.dagcircuit",
"qiskit.passmanager",
"qiskit.synthesis",
"qiskit.synthesis",
"qiskit.transpiler",
"qiskit.transpiler.passes",
])
) {
return _TRANSPILATION;
}

if (
hasPrefix(module, ["qiskit.primitives", "qiskit.providers"]) &&
!hasPrefix(module, ["qiskit.providers.aer", "qiskit.providers.ibmq"])
) {
return _PRIMITVES;
}

if (
hasPrefix(module, [
"qiskit.result",
"qiskit.validation",
"qiskit.visualization",
])
) {
return _RESULTS;
}

if (hasPrefix(module, ["qiskit.opflow"])) return _OPFLOW;

if (
hasPrefix(module, [
"qiskit.circuit.qpy_serialization",
"qiskit.qpy",
"qiskit.qasm",
])
) {
return _SERIALIZATION;
}

if (hasPrefix(module, ["qiskit.scheduler", "qiskit.pulse"])) return _PULSE;

if (
hasPrefix(module, [
"qiskit.assembler",
"qiskit.compiler",
"qiskit.exceptions",
"qiskit.qobj",
"qiskit.tools",
"qiskit.utils",
])
) {
return _OTHER;
}

if (hasPrefix(module, ["qiskit.providers.aer", "qiskit_aer"])) return _AER;
if (hasPrefix(module, ["qiskit.providers.ibmq"])) return _IBMQ;
if (hasPrefix(module, ["qiskit.algorithms"])) return _ALGORITHMS;
if (hasPrefix(module, ["qiskit.aqua"])) return _AQUA;
if (hasPrefix(module, ["qiskit.ignis"])) return _IGNIS;
if (hasPrefix(module, ["qiskit.finance"])) return _FINANCE;
if (hasPrefix(module, ["qiskit.chemistry"])) return _CHEMISTRY;
if (hasPrefix(module, ["qiskit.ml"])) return _ML;
if (hasPrefix(module, ["qiskit.optimization"])) return _OPTIMIZATION;

return undefined;
}

export const QISKIT_TOC_GROUPING: TocGrouping = {
entries: QISKIT_ENTRIES,
moduleToSection: qiskitModuleToSection,
};
Loading