From d6c5d99cbec69e867fec8507d10c7f2631b16009 Mon Sep 17 00:00:00 2001 From: CalMacCQ <93673602+CalMacCQ@users.noreply.github.com> Date: Mon, 3 Feb 2025 12:42:29 -0500 Subject: [PATCH 01/11] add exit flags --- docs/build-docs.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/build-docs.sh b/docs/build-docs.sh index 8a5eae08..ea231d47 100644 --- a/docs/build-docs.sh +++ b/docs/build-docs.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -e rm -rf build/ # Move theming elements into the docs folder @@ -26,4 +27,6 @@ fi # Remove copied files. This ensures reusability. rm -r _static rm -r quantinuum-sphinx -rm conf.py \ No newline at end of file +rm conf.py + +set +e \ No newline at end of file From 4535b8b1f8901a3b9d09d313a214060c1f54a919 Mon Sep 17 00:00:00 2001 From: CalMacCQ <93673602+CalMacCQ@users.noreply.github.com> Date: Mon, 3 Feb 2025 12:44:22 -0500 Subject: [PATCH 02/11] sync build script with website, fail on sphinx warnings --- docs/build-docs.sh | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/docs/build-docs.sh b/docs/build-docs.sh index ea231d47..ab480632 100644 --- a/docs/build-docs.sh +++ b/docs/build-docs.sh @@ -2,20 +2,31 @@ set -e rm -rf build/ +# This build script is only used for local docs build. +# The docs build for the website uses a different script. + # 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 . +cp -R pytket-docs-theming/_static . # Currently unused # Get the name of the project -EXTENSION_NAME="$(basename "$(dirname `pwd`)")" +PACKAGE="$(basename "$(dirname `pwd`)")" + +# Get pytket extension version +VERSION="$(pip show $PACKAGE | grep Version | awk '{print $2}')" + +# Output package version +echo extension version $VERSION -# Correct github link in navbar -sed -i '' 's#CQCL/tket#CQCL/'$EXTENSION_NAME'#' _static/nav-config.js +# Combine to set title +PACKAGE+=" $VERSION" -# Build the docs. Ensure we have the correct project title. -sphinx-build -b html -D html_title="$EXTENSION_NAME" . build +# Build the docs setting the html_title +sphinx-build -b html . build -D html_title="$PACKAGE API documentation" -W +# Find and replace all generated links that use _tket in the built html. +# Note that MACOS and linux have differing sed syntax. if [[ "$OSTYPE" == "darwin"* ]]; then find build/ -type f -name "*.html" | xargs sed -e 's/pytket._tket/pytket/g' -i "" sed -i '' 's/pytket._tket/pytket/g' build/searchindex.js @@ -24,8 +35,7 @@ else sed -i 's/pytket._tket/pytket/g' build/searchindex.js fi -# Remove copied files. This ensures reusability. -rm -r _static +# Remove copied files after build is done. This ensures reusability. rm -r quantinuum-sphinx rm conf.py From a10815d5763caf6a11df14cfad7b4a2fd18837cd Mon Sep 17 00:00:00 2001 From: CalMacCQ <93673602+CalMacCQ@users.noreply.github.com> Date: Mon, 3 Feb 2025 12:45:26 -0500 Subject: [PATCH 03/11] exit flags in install script --- docs/install.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/install.sh b/docs/install.sh index 74f12341..9e7cc603 100644 --- a/docs/install.sh +++ b/docs/install.sh @@ -1,3 +1,5 @@ +set -e + # Copy over poetry dependencies from theming repository cp pytket-docs-theming/extensions/pyproject.toml . cp pytket-docs-theming/extensions/poetry.lock . @@ -5,4 +7,5 @@ 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. +set +e \ No newline at end of file From fa95eaffa8d534a747298eb77bef70b1329b7d39 Mon Sep 17 00:00:00 2001 From: CalMacCQ <93673602+CalMacCQ@users.noreply.github.com> Date: Mon, 3 Feb 2025 12:57:03 -0500 Subject: [PATCH 04/11] use recursive submodules --- .github/workflows/build_and_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index d4bafa07..7eb11bde 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -31,7 +31,7 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: '0' - submodules: true + submodules: recursive - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* +refs/heads/*:refs/remotes/origin/* - name: Set up Python 3.10 if: github.event_name == 'push' || github.event_name == 'schedule' From ef59dec3d0db3c0ef8c20a4f5babb77a6e67a547 Mon Sep 17 00:00:00 2001 From: CalMacCQ <93673602+CalMacCQ@users.noreply.github.com> Date: Mon, 3 Feb 2025 13:21:08 -0500 Subject: [PATCH 05/11] try cd fix --- .github/workflows/build_and_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 7eb11bde..95cd1803 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -79,7 +79,7 @@ jobs: - name: Install docs dependencies if: (matrix.os == 'ubuntu-latest') && (github.event_name == 'pull_request' || github.event_name == 'schedule' ) run: | - cd docs && bash ./install.sh + cd docs && bash ./install.sh && cd .. for w in `find wheelhouse/ -type f -name "*.whl"` ; do poetry run pip install $w ; done - name: Build docs if: (matrix.os == 'ubuntu-latest') && (github.event_name == 'pull_request' || github.event_name == 'schedule' ) From 233951c26653202f317e7e1d6827a8e16907391e Mon Sep 17 00:00:00 2001 From: CalMacCQ <93673602+CalMacCQ@users.noreply.github.com> Date: Wed, 5 Feb 2025 01:01:30 -0500 Subject: [PATCH 06/11] use recursive submodules throughout --- .github/workflows/build_and_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 95cd1803..7eb11bde 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -79,7 +79,7 @@ jobs: - name: Install docs dependencies if: (matrix.os == 'ubuntu-latest') && (github.event_name == 'pull_request' || github.event_name == 'schedule' ) run: | - cd docs && bash ./install.sh && cd .. + cd docs && bash ./install.sh for w in `find wheelhouse/ -type f -name "*.whl"` ; do poetry run pip install $w ; done - name: Build docs if: (matrix.os == 'ubuntu-latest') && (github.event_name == 'pull_request' || github.event_name == 'schedule' ) From 59de7b1f5a86c806a4b082054f3f9282eca41430 Mon Sep 17 00:00:00 2001 From: CalMacCQ <93673602+CalMacCQ@users.noreply.github.com> Date: Wed, 5 Feb 2025 01:03:10 -0500 Subject: [PATCH 07/11] don't use cd --- .github/workflows/build_and_test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 7eb11bde..440e5a2e 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -79,13 +79,13 @@ jobs: - name: Install docs dependencies if: (matrix.os == 'ubuntu-latest') && (github.event_name == 'pull_request' || github.event_name == 'schedule' ) run: | - cd docs && bash ./install.sh + bash ./docs/install.sh for w in `find wheelhouse/ -type f -name "*.whl"` ; do poetry run pip install $w ; done - name: Build docs if: (matrix.os == 'ubuntu-latest') && (github.event_name == 'pull_request' || github.event_name == 'schedule' ) timeout-minutes: 20 run: | - cd docs && poetry run bash ./build-docs.sh + poetry run bash ./docs/build-docs.sh publish_to_pypi: From 764084d5942564247742d497e20eed1221b1c63e Mon Sep 17 00:00:00 2001 From: CalMacCQ <93673602+CalMacCQ@users.noreply.github.com> Date: Wed, 5 Feb 2025 13:43:25 -0500 Subject: [PATCH 08/11] try install fix --- .github/workflows/build_and_test.yml | 2 +- docs/install.sh | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 440e5a2e..ee97a570 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -85,7 +85,7 @@ jobs: if: (matrix.os == 'ubuntu-latest') && (github.event_name == 'pull_request' || github.event_name == 'schedule' ) timeout-minutes: 20 run: | - poetry run bash ./docs/build-docs.sh + cd docs && poetry run bash ./build-docs.sh publish_to_pypi: diff --git a/docs/install.sh b/docs/install.sh index 9e7cc603..00a5d76a 100644 --- a/docs/install.sh +++ b/docs/install.sh @@ -1,5 +1,7 @@ set -e + +cd docs # Copy over poetry dependencies from theming repository cp pytket-docs-theming/extensions/pyproject.toml . cp pytket-docs-theming/extensions/poetry.lock . @@ -7,5 +9,7 @@ cp pytket-docs-theming/extensions/poetry.lock . # Install the docs dependencies. Creates a .venv directory in docs poetry install +cd .. + # NOTE: Editable wheel should be installed separately. set +e \ No newline at end of file From 0773b8cfaa85ab3e4f6b30a121921726c1f26d39 Mon Sep 17 00:00:00 2001 From: CalMacCQ <93673602+CalMacCQ@users.noreply.github.com> Date: Wed, 5 Feb 2025 13:57:13 -0500 Subject: [PATCH 09/11] try another fix --- .github/workflows/build_and_test.yml | 4 +++- docs/install.sh | 7 ++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index ee97a570..c8e6e2f6 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -80,7 +80,9 @@ jobs: if: (matrix.os == 'ubuntu-latest') && (github.event_name == 'pull_request' || github.event_name == 'schedule' ) run: | bash ./docs/install.sh - for w in `find wheelhouse/ -type f -name "*.whl"` ; do poetry run pip install $w ; done + cd docs + for w in `find ../wheelhouse/ -type f -name "*.whl"` ; do poetry run pip install $w ; done + cd .. - name: Build docs if: (matrix.os == 'ubuntu-latest') && (github.event_name == 'pull_request' || github.event_name == 'schedule' ) timeout-minutes: 20 diff --git a/docs/install.sh b/docs/install.sh index 00a5d76a..23b141c5 100644 --- a/docs/install.sh +++ b/docs/install.sh @@ -1,15 +1,12 @@ set -e -cd docs # Copy over poetry dependencies from theming repository -cp pytket-docs-theming/extensions/pyproject.toml . -cp pytket-docs-theming/extensions/poetry.lock . +cp docs/pytket-docs-theming/extensions/pyproject.toml . +cp docs/pytket-docs-theming/extensions/poetry.lock . # Install the docs dependencies. Creates a .venv directory in docs poetry install -cd .. - # NOTE: Editable wheel should be installed separately. set +e \ No newline at end of file From b8f653c6bf80511cbc01ad3e0d6be6d13e3e9447 Mon Sep 17 00:00:00 2001 From: CalMacCQ <93673602+CalMacCQ@users.noreply.github.com> Date: Thu, 6 Feb 2025 13:32:56 +0000 Subject: [PATCH 10/11] add comment explaining submodules --- .github/workflows/build_and_test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index c8e6e2f6..97a12106 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -31,6 +31,8 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: '0' + # recursive needed as the pytket-docs-theming submodule contains + # the quantinuum-sphinx submodule submodules: recursive - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* +refs/heads/*:refs/remotes/origin/* - name: Set up Python 3.10 From b1ae083fe45eb1fbbf654bd9d39590b60b37c6ca Mon Sep 17 00:00:00 2001 From: CalMacCQ <93673602+CalMacCQ@users.noreply.github.com> Date: Tue, 11 Mar 2025 23:45:38 +0000 Subject: [PATCH 11/11] update docs theming submodule --- docs/pytket-docs-theming | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/pytket-docs-theming b/docs/pytket-docs-theming index 70992467..7046a405 160000 --- a/docs/pytket-docs-theming +++ b/docs/pytket-docs-theming @@ -1 +1 @@ -Subproject commit 70992467293c057b06ebf8836ddca0b6ddd067c0 +Subproject commit 7046a405b50355b096ac4ae07d53854c2370deab