From 8e801f7b202895bc8c3d4f8c9e4eb90d28e50fe8 Mon Sep 17 00:00:00 2001 From: CalMacCQ <93673602+CalMacCQ@users.noreply.github.com> Date: Fri, 6 Sep 2024 14:38:43 +0100 Subject: [PATCH 01/10] delete conf.py for now --- docs/source/conf.py | 46 --------------------------------------------- 1 file changed, 46 deletions(-) delete mode 100644 docs/source/conf.py diff --git a/docs/source/conf.py b/docs/source/conf.py deleted file mode 100644 index e8139fed..00000000 --- a/docs/source/conf.py +++ /dev/null @@ -1,46 +0,0 @@ -############################################################################## -# -# Copyright (c) 2023 Quantinuum LLC All rights reserved. -# Use of this source code is governed by a BSD-style -# license that can be found in the LICENSE file. -# -############################################################################## - -# Configuration file for the Sphinx documentation builder. -# -# For the full list of built-in configuration values, see the documentation: -# https://www.sphinx-doc.org/en/master/usage/configuration.html - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. -import datetime -import pathlib -import sys -from importlib.metadata import version as get_version - -sys.path.insert(0, pathlib.Path(__file__).parents[2].resolve().as_posix()) - -# -- Project information ----------------------------------------------------- -# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information - -project = "pytket-phir" -project_copyright = f"2023-{datetime.date.today().year}, Quantinuum LLC" -author = "Quantinuum LLC" -release: str = ".".join(get_version("pytket-phir").split(".")[:2]) - -# -- General configuration --------------------------------------------------- -# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration - -extensions = [ - "sphinx.ext.doctest", - "sphinx.ext.autodoc", - "sphinx.ext.napoleon", -] - -exclude_patterns = [] - - -# -- Options for HTML output ------------------------------------------------- -# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output - -html_theme = "pydata_sphinx_theme" From dcd057cf2fe8ea4ae27f088b133218fbb8f52f35 Mon Sep 17 00:00:00 2001 From: CalMacCQ <93673602+CalMacCQ@users.noreply.github.com> Date: Fri, 6 Sep 2024 14:39:06 +0100 Subject: [PATCH 02/10] remove docs makefile --- docs/Makefile | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 docs/Makefile diff --git a/docs/Makefile b/docs/Makefile deleted file mode 100644 index d0c3cbf1..00000000 --- a/docs/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# Minimal makefile for Sphinx documentation -# - -# You can set these variables from the command line, and also -# from the environment for the first two. -SPHINXOPTS ?= -SPHINXBUILD ?= sphinx-build -SOURCEDIR = source -BUILDDIR = build - -# Put it first so that "make" without argument is like "make help". -help: - @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) - -.PHONY: help Makefile - -# Catch-all target: route all unknown targets to Sphinx using the new -# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). -%: Makefile - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) From 94c73beb82a43292c9b6385262639092c4bbefa9 Mon Sep 17 00:00:00 2001 From: CalMacCQ <93673602+CalMacCQ@users.noreply.github.com> Date: Fri, 6 Sep 2024 14:39:43 +0100 Subject: [PATCH 03/10] flatten docs folder --- docs/{source => }/index.rst | 0 docs/{source => }/modules.rst | 0 docs/{source => }/pytket.phir.rebasing.rst | 0 docs/{source => }/pytket.phir.rst | 0 docs/{source => }/pytket.phir.sharding.rst | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename docs/{source => }/index.rst (100%) rename docs/{source => }/modules.rst (100%) rename docs/{source => }/pytket.phir.rebasing.rst (100%) rename docs/{source => }/pytket.phir.rst (100%) rename docs/{source => }/pytket.phir.sharding.rst (100%) diff --git a/docs/source/index.rst b/docs/index.rst similarity index 100% rename from docs/source/index.rst rename to docs/index.rst diff --git a/docs/source/modules.rst b/docs/modules.rst similarity index 100% rename from docs/source/modules.rst rename to docs/modules.rst diff --git a/docs/source/pytket.phir.rebasing.rst b/docs/pytket.phir.rebasing.rst similarity index 100% rename from docs/source/pytket.phir.rebasing.rst rename to docs/pytket.phir.rebasing.rst diff --git a/docs/source/pytket.phir.rst b/docs/pytket.phir.rst similarity index 100% rename from docs/source/pytket.phir.rst rename to docs/pytket.phir.rst diff --git a/docs/source/pytket.phir.sharding.rst b/docs/pytket.phir.sharding.rst similarity index 100% rename from docs/source/pytket.phir.sharding.rst rename to docs/pytket.phir.sharding.rst From a1b9c70bb1a272e72e63992d9176ed147e0a36e4 Mon Sep 17 00:00:00 2001 From: CalMacCQ <93673602+CalMacCQ@users.noreply.github.com> Date: Fri, 6 Sep 2024 14:41:37 +0100 Subject: [PATCH 04/10] add theming submodule --- .gitmodules | 4 ++++ docs/pytket-docs-theming | 1 + 2 files changed, 5 insertions(+) create mode 100644 .gitmodules create mode 160000 docs/pytket-docs-theming diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..fdc8b037 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "docs/pytket-docs-theming"] + path = docs/pytket-docs-theming + url = https://github.com/CQCL/pytket-docs-theming.git + branch = main diff --git a/docs/pytket-docs-theming b/docs/pytket-docs-theming new file mode 160000 index 00000000..7141e767 --- /dev/null +++ b/docs/pytket-docs-theming @@ -0,0 +1 @@ +Subproject commit 7141e767a94c13d818e94669b3aaafba76e9348a From 840b04b2dc9d1c8a104b1b420c96a33326d514ca Mon Sep 17 00:00:00 2001 From: CalMacCQ <93673602+CalMacCQ@users.noreply.github.com> Date: Fri, 6 Sep 2024 15:15:37 +0100 Subject: [PATCH 05/10] add script for building the docs --- docs/build-docs.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 docs/build-docs.sh diff --git a/docs/build-docs.sh b/docs/build-docs.sh new file mode 100644 index 00000000..c1737ec1 --- /dev/null +++ b/docs/build-docs.sh @@ -0,0 +1,20 @@ +rm -rf build/ + +# Move theming elements into the docs folder +cp -R pytket-docs-theming/_static . +cp -R pytket-docs-theming/quantinuum-sphinx . +cp pytket-docs-theming/conf.py . + +# Get the name of the project +EXTENSION_NAME="$(basename "$(dirname `pwd`)")" + +# Correct github link in navbar +sed -i '' 's#CQCL/tket#CQCL/'$EXTENSION_NAME'#' _static/nav-config.js + +# Build the docs. Ensure we have the correct project title. +sphinx-build -b html -D html_title="$EXTENSION_NAME" . build + +# Remove copied files. This ensures reusability. +rm -r _static +rm -r quantinuum-sphinx +rm conf.py \ No newline at end of file From d777592800feceba0d0b7279c0ef6435d098addb Mon Sep 17 00:00:00 2001 From: CalMacCQ <93673602+CalMacCQ@users.noreply.github.com> Date: Fri, 6 Sep 2024 15:16:03 +0100 Subject: [PATCH 06/10] add script for installing docs deps --- docs/install.sh | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 docs/install.sh diff --git a/docs/install.sh b/docs/install.sh new file mode 100644 index 00000000..3ca10794 --- /dev/null +++ b/docs/install.sh @@ -0,0 +1,9 @@ + +# Copy over poetry dependencies from theming repository +cp pytket-docs-theming/extensions/pyproject.toml . +cp pytket-docs-theming/extensions/poetry.lock . + +# Install the docs dependencies. Creates a .venv directory in docs +poetry install + +# NOTE: Editable wheel should be installed separately. \ No newline at end of file From 3bccdca182844dceea3605dffcf23ab96e4e8ba9 Mon Sep 17 00:00:00 2001 From: CalMacCQ <93673602+CalMacCQ@users.noreply.github.com> Date: Fri, 6 Sep 2024 15:16:31 +0100 Subject: [PATCH 07/10] update workflow for building the docs --- .github/workflows/python-app.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 092a8aa8..19920c85 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -41,12 +41,12 @@ jobs: python -m pytest - name: Sphinx documentation build run: | - make docs + bash docs/build-docs.sh - name: Deploy to GitHub Pages uses: peaceiris/actions-gh-pages@v4 if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && matrix.deploy-gh-pages }} with: publish_branch: gh-pages github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: docs/build/html/ + publish_dir: docs/build/ force_orphan: true From 0ad538d50cda6a67ce6ef17bfbb6f76d46acb6ba Mon Sep 17 00:00:00 2001 From: CalMacCQ <93673602+CalMacCQ@users.noreply.github.com> Date: Fri, 6 Sep 2024 15:25:03 +0100 Subject: [PATCH 08/10] update .gitignore with unneeded files --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 5774c658..f80b1717 100644 --- a/.gitignore +++ b/.gitignore @@ -70,6 +70,9 @@ instance/ # Sphinx documentation docs/_build/ +docs/pyproject.toml +docs/poetry.lock +docs/build # PyBuilder .pybuilder/ From 0311f0b761d48bdd32ba6e441aaadf20b708c773 Mon Sep 17 00:00:00 2001 From: CalMacCQ <93673602+CalMacCQ@users.noreply.github.com> Date: Fri, 6 Sep 2024 15:27:38 +0100 Subject: [PATCH 09/10] add short docs README --- docs/README.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 docs/README.md diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 00000000..d401a96b --- /dev/null +++ b/docs/README.md @@ -0,0 +1,5 @@ +# Building the docs + +The docs are built by using the [pytket-docs-theming](https://github.com/CQCL/pytket-docs-theming/) repository as a git submodule. If there are issues with the docs build, feel free to open an issue or pull request there. + +For instructions on how to build the docs, take a look at the [extensions README](https://github.com/CQCL/pytket-docs-theming/blob/main/extensions/README.md). \ No newline at end of file From f98da8d1ad19ce2f3353b8bd5f5ca037f304e8a2 Mon Sep 17 00:00:00 2001 From: Kartik Singhal Date: Fri, 25 Oct 2024 07:45:47 -0500 Subject: [PATCH 10/10] fix: lint updates --- docs/README.md | 2 +- docs/build-docs.sh | 6 +++--- docs/install.sh | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/README.md b/docs/README.md index d401a96b..6e20b650 100644 --- a/docs/README.md +++ b/docs/README.md @@ -2,4 +2,4 @@ The docs are built by using the [pytket-docs-theming](https://github.com/CQCL/pytket-docs-theming/) repository as a git submodule. If there are issues with the docs build, feel free to open an issue or pull request there. -For instructions on how to build the docs, take a look at the [extensions README](https://github.com/CQCL/pytket-docs-theming/blob/main/extensions/README.md). \ No newline at end of file +For instructions on how to build the docs, take a look at the [extensions README](https://github.com/CQCL/pytket-docs-theming/blob/main/extensions/README.md). diff --git a/docs/build-docs.sh b/docs/build-docs.sh index c1737ec1..d96cdc22 100644 --- a/docs/build-docs.sh +++ b/docs/build-docs.sh @@ -12,9 +12,9 @@ EXTENSION_NAME="$(basename "$(dirname `pwd`)")" sed -i '' 's#CQCL/tket#CQCL/'$EXTENSION_NAME'#' _static/nav-config.js # Build the docs. Ensure we have the correct project title. -sphinx-build -b html -D html_title="$EXTENSION_NAME" . build +sphinx-build -b html -D html_title="$EXTENSION_NAME" . build # Remove copied files. This ensures reusability. -rm -r _static +rm -r _static rm -r quantinuum-sphinx -rm conf.py \ No newline at end of file +rm conf.py diff --git a/docs/install.sh b/docs/install.sh index 3ca10794..379bca1b 100644 --- a/docs/install.sh +++ b/docs/install.sh @@ -6,4 +6,4 @@ cp pytket-docs-theming/extensions/poetry.lock . # Install the docs dependencies. Creates a .venv directory in docs poetry install -# NOTE: Editable wheel should be installed separately. \ No newline at end of file +# NOTE: Editable wheel should be installed separately.