Skip to content

Commit

Permalink
docs: use pytket-docs-theming submodule (#153)
Browse files Browse the repository at this point in the history
# Description

Updating the docs build to use the
[pytket-docs-theming](https://github.com/CQCL/pytket-docs-theming)
repository as a submodule. This means the docs can be built locally with
the latest theme config.

I also took great pleasure in deleting a bunch of legacy docs files ;).
If we go with this solution then we don't these anymore.

Take a look at the README for building the docs locally ->
https://github.com/CQCL/pytket-docs-theming/tree/main/extensions#building-the-api-docs-for-pytket-extensions

I've added some bash scripts to automate installing dependencies and
building the docs. Note that these scripts are only intended for local
development and will not be used in the website build. I don't want to
have to make sure that they match in all of the different repositories.

<img width="1421" alt="Screenshot 2024-09-04 at 01 27 54"
src="https://github.com/user-attachments/assets/8da592c8-8a03-495b-be54-7f24c018e2a1">


TODOS

- [x] Finalise how docs dependencies are specified. (proposal added in
README) Happy to have input on this
- [x] Fix docs build in C.I.
- [x] Discuss whether this is feasible for all other extenions that we
care about.


# Related issues

Please mention any github issues addressed by this PR.
  • Loading branch information
CalMacCQ authored Oct 2, 2024
1 parent a4eade6 commit e61af70
Show file tree
Hide file tree
Showing 16 changed files with 80 additions and 339 deletions.
27 changes: 18 additions & 9 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
submodules: true
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* +refs/heads/*:refs/remotes/origin/*
- name: Set up Python 3.10
uses: actions/setup-python@v5
Expand Down Expand Up @@ -66,15 +67,20 @@ jobs:
with:
name: artefact-${{ matrix.os }}
path: wheelhouse/
- name: install poetry
run: pip install poetry
- name: Install docs dependencies
if: (matrix.os == 'ubuntu-22.04') && (github.event_name == 'pull_request' || github.event_name == 'schedule' )
run: |
pip install -r .github/workflows/docs/requirements.txt
cd docs
bash ./install.sh
for w in `find wheelhouse/ -type f -name "*.whl"` ; do poetry install $w ; done
- name: Build docs
if: (matrix.os == 'ubuntu-22.04') && (github.event_name == 'pull_request' || github.event_name == 'schedule' )
timeout-minutes: 20
run: |
./.github/workflows/docs/check-build-docs
cd docs
poetry run bash ./build-docs.sh
publish_to_pypi:
Expand Down Expand Up @@ -111,24 +117,27 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Set up Python 3.10
submodules: true
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: '3.11'
- name: Download all wheels
uses: actions/download-artifact@v4
with:
path: wheelhouse
- name: Install pip, wheel
run: pip install -U pip wheel
- name: Install poetry
run: pip install poetry
- name: Install extension
run: for w in `find wheelhouse/ -type f -name "*.whl"` ; do pip install $w ; done
run: for w in `find wheelhouse/ -type f -name "*.whl"` ; do poetry install $w ; done
- name: Install docs dependencies
run: |
pip install -r .github/workflows/docs/requirements.txt
cd docs
bash ./install.sh
- name: Build docs
timeout-minutes: 20
run: |
cd .github/workflows/docs
mkdir extensions
./build-docs -d ${GITHUB_WORKSPACE}/.github/workflows/docs/extensions/api
cd docs
poetry run bash ./build-docs.sh
29 changes: 13 additions & 16 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,27 @@ on:
schedule:
# 04:00 every Tuesday morning
- cron: '0 4 * * 2'

jobs:
docs:
name: build docs
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
with:
submodules: true
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Upgrade pip and install wheel
run: pip install --upgrade pip wheel
- name: Install pytket-cutensornet
run: pip install .
python-version: '3.11'
- name: install poetry
run: pip install poetry
- name: Install docs dependencies
run: |
pip install -r .github/workflows/docs/requirements.txt
run: cd docs && bash install.sh
- name: Install pytket cutensornet
run: cd docs && poetry run pip install ../.
- name: Test building docs
timeout-minutes: 20
timeout-minutes: 10
run: |
cd .github/workflows/docs
mkdir extensions
./build-docs -d ${GITHUB_WORKSPACE}/.github/workflows/docs/extensions
- uses: actions/upload-artifact@v4
with:
name: pytket-extension-docs
path: .github/workflows/docs/extensions/
cd docs
poetry run bash build-docs.sh
Binary file removed .github/workflows/docs/Quantinuum_logo_black.png
Binary file not shown.
Binary file removed .github/workflows/docs/Quantinuum_logo_white.png
Binary file not shown.
114 changes: 0 additions & 114 deletions .github/workflows/docs/build-docs

This file was deleted.

10 changes: 0 additions & 10 deletions .github/workflows/docs/check-build-docs

This file was deleted.

149 changes: 0 additions & 149 deletions .github/workflows/docs/conf.py

This file was deleted.

6 changes: 0 additions & 6 deletions .github/workflows/docs/requirements.txt

This file was deleted.

Loading

0 comments on commit e61af70

Please sign in to comment.