Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate closed source documentation (Qiskit#70)
Closes Qiskit#21. The code was copied with the below script. The closed source repository got most of its content from open source, but did not use a Git migration to transfer over commit history. So rather than using a Git migration like we did with `qiskit-tutorials` (Qiskit/qiskit#10710), this manually attributes relevant contributors for the files they had an influence on. ```python import shutil import subprocess from dataclasses import dataclass from pathlib import Path IQP_ROOT = Path("../iqp-channel-docs") DOCS_ROOT = Path("./") @DataClass(frozen=True) class Author: name: str email: str def commit_line(self) -> str: return f"Co-authored-by: {self.name} <{self.email}>" AXEL = Author("Axel Hernández Ferrera", "axelhzf@gmail.com") ABBY_C = Author("Abby Cross", "across@us.ibm.com") BECKY = Author("Rebecca Dimock", "66339736+beckykd@users.noreply.github.com") FRANK = Author("Frank Harkins", "frankharkins@hotmail.co.uk") KEVIN = Author("Kevin Tian", "kevin.tian@ibm.com") JESSIE = Author("Jessie Yu", "jessieyu@us.ibm.com") ELENA = Author("Elena Peña Tapia", "57907331+ElePT@users.noreply.github.com") PAUL_N = Author("Paul Nation", "nonhermitian@gmail.com") SOOLU = Author("Soolu Thomas", "soolu.thomas@ibm.com") THOMAS_A = Author("Thomas Alexander", "thomas.a.alexander@ibm.com") JAKE_L = Author("Jake Lishman", "jake.lishman@ibm.com") MICHAEL_H = Author("Michael Healy", "mbhealy@ibm.com") MARIUS = Author("Marius Hillenbrand", "marius.hillenbrand@ibm.com") REZA = Author("Reza Jokar", "jokar@ibm.com") def main() -> None: # Copy images copy_image_folders( [ "build", "migration", "optimize", "qiskit-ibm-runtime", "run", "start", ] ) commit("Migrate images from closed source", []) # Copy TOC files copy_docs_files( [ "build/_toc.json", "optimize/_toc.json", "run/_toc.json", "start/_toc.json", "test/_toc.json", ] ) commit("Migrate TOC files from closed source", [AXEL]) # Copy original content copy_docs_files( [ "start/index.mdx", "start/install.mdx", "start/intro-to-qiskit.ipynb", "start/runtime.mdx", "build/index.mdx", "build/first-circuit.mdx", "build/operators_overview.ipynb", "build/primitives.mdx", "build/primitives-get-started.mdx", "build/primitives-examples.mdx", "build/feature-table.mdx", "build/backend_reset.ipynb", "build/pulse.ipynb", "test/index.mdx", "test/simulators.mdx", "optimize/index.mdx", "run/hardware.mdx", "run/instances.mdx", "run/backends.mdx", "run/estimate-job.mdx", "run/queue.mdx", "run/circuit-execution.mdx", "run/reserve-system-time.mdx", "run/retired-systems.mdx", ] ) commit("Migrate original content from closed source", [ABBY_C, BECKY]) # Copy hello world copy_docs_files(["start/hello-world.ipynb"]) commit("Migrate Hello World guide from closed source", [FRANK, BECKY, ABBY_C]) # Copy runtime migration guides copy_docs_files( ["start/compare.mdx", "start/migrate.mdx", "start/migrate-examples.mdx"] ) commit( "Migrate Runtime migration guides from closed source", [JESSIE, KEVIN, BECKY, FRANK, ELENA], ) # Copy dynamic circuits copy_docs_files( [ "build/getting-started-with-dynamic-circuits.ipynb", "build/midcircuit_measurement.ipynb", "build/dynamic-circuits-basics-with-qiskit.ipynb", "build/dynamic-circuits-basics-with-openqasm3.ipynb", ] ) commit( "Migrate Dynamic Circuits content from closed source", [SOOLU, THOMAS_A, JAKE_L, MARIUS, MICHAEL_H, REZA, BECKY, ABBY_C], ) # Copy runtime content copy_docs_files( [ "build/primitive-options.mdx", "test/noise.mdx", "optimize/algorithm-tuning-options.mdx", "optimize/error-mitigation.mdx", "optimize/error-suppression.mdx", "run/account-management.mdx", "run/sessions.mdx", "run/run-sessions.mdx", "run/monitor.mdx", "run/cost.mdx", "run/max-execution-time.mdx", ] ) commit( "Migrate Runtime content from closed source", [JESSIE, KEVIN, BECKY, ABBY_C], ) # Copy Aer tutorial copy_docs_files(["test/building_noise_models.ipynb"]) commit("Migrate Aer noise model from closed source", [PAUL_N]) def copy_docs_files(files: list[str]) -> None: for f in files: dest = DOCS_ROOT / "docs" / f dest.parent.mkdir(parents=True, exist_ok=True) shutil.copy(IQP_ROOT / "docs" / f, dest) def copy_image_folders(folders: list[str]) -> None: for folder in folders: shutil.copytree( IQP_ROOT / "packages" / "web" / "public" / "images" / folder, DOCS_ROOT / "public" / "images" / folder, ) def commit(msg: str, authors: list[Author]) -> None: subprocess.run(["git", "add", "."], check=True) if authors: author_lines = "\n".join(author.commit_line() for author in authors) msg += f"\n\n{author_lines}" subprocess.run(["git", "commit", "-m", msg], check=True) main() ```
- Loading branch information