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

Release v0.1.0 #28

Merged
merged 17 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
214 changes: 107 additions & 107 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,77 +7,77 @@ on:
push:
branches:
- main
- 'wheel/**'
- 'runci/**'
- "wheel/**"
- "runci/**"
release:
types:
- created
- edited
schedule:
# 04:00 every Tuesday morning
- cron: '0 4 * * 2'
- cron: "0 4 * * 2"

jobs:
quest-checks:
name: QuEST - Build and test module
strategy:
matrix:
os: ['ubuntu-22.04', 'macos-12', 'windows-2022']
os: ["ubuntu-22.04", "macos-latest", "windows-2022"]
ferbetanzo marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* +refs/heads/*:refs/remotes/origin/*
- name: Install dependencies
shell: bash
run: |
if [[ "${{ matrix.os }}" == "ubuntu-22.04" ]]; then
sudo apt-get update && sudo apt-get install -y libopenmpi-dev
elif [[ "${{ matrix.os }}" == "macos-12" ]]; then
brew install open-mpi
elif [[ "${{ matrix.os }}" == "windows-2022" ]]; then
curl -L -o msmpisetup.exe https://github.com/microsoft/Microsoft-MPI/releases/download/v10.1.1/msmpisetup.exe
./msmpisetup.exe -unattend
fi
- name: Set up Python 3.10
if: github.event_name == 'push' || github.event_name == 'schedule'
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Build and test (3.10)
if: github.event_name == 'push' || github.event_name == 'schedule'
shell: bash
run: |
./.github/workflows/build-test nomypy
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Build and test including remote checks (3.11) mypy
if: (matrix.os == 'macos-12') && (github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || github.event_name == 'release' || github.event_name == 'schedule')
shell: bash
run: |
./.github/workflows/build-test mypy
- name: Build and test including remote checks (3.11) nomypy
if: (matrix.os != 'macos-12') && (github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || github.event_name == 'release' || github.event_name == 'schedule')
shell: bash
run: |
./.github/workflows/build-test nomypy
- uses: actions/upload-artifact@v4
if: github.event_name == 'release' || contains(github.ref, 'refs/heads/wheel')
with:
name: artefact-${{ matrix.os }}
path: wheelhouse/
- 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
- 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
- uses: actions/checkout@v4
with:
fetch-depth: "0"
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* +refs/heads/*:refs/remotes/origin/*
- name: Install dependencies
shell: bash
run: |
if [[ "${{ matrix.os }}" == "ubuntu-22.04" ]]; then
sudo apt-get update && sudo apt-get install -y libopenmpi-dev
elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then
brew install open-mpi
elif [[ "${{ matrix.os }}" == "windows-2022" ]]; then
curl -L -o msmpisetup.exe https://github.com/microsoft/Microsoft-MPI/releases/download/v10.1.1/msmpisetup.exe
./msmpisetup.exe -unattend
fi
- name: Set up Python 3.10
if: github.event_name == 'push' || github.event_name == 'schedule'
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Build and test (3.10)
if: github.event_name == 'push' || github.event_name == 'schedule'
shell: bash
run: |
./.github/workflows/build-test nomypy
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Build and test including remote checks (3.11) mypy
if: (matrix.os == 'macos-latest') && (github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || github.event_name == 'release' || github.event_name == 'schedule')
shell: bash
run: |
./.github/workflows/build-test mypy
- name: Build and test including remote checks (3.11) nomypy
if: (matrix.os != 'macos-latest') && (github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || github.event_name == 'release' || github.event_name == 'schedule')
shell: bash
run: |
./.github/workflows/build-test nomypy
- uses: actions/upload-artifact@v4
if: github.event_name == 'release' || contains(github.ref, 'refs/heads/wheel')
with:
name: artefact-${{ matrix.os }}
path: wheelhouse/
- name: Install docs dependencies
if: (matrix.os == 'ubuntu-22.04') && (github.event_name == 'pull_request' || github.event_name == 'schedule')
CalMacCQ marked this conversation as resolved.
Show resolved Hide resolved
run: |
pip install -r .github/workflows/docs/requirements.txt
- 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

distributed_tests:
name: Run distributed calculations
Expand All @@ -90,60 +90,60 @@ jobs:
needs: distributed_tests
runs-on: ubuntu-22.04
ferbetanzo marked this conversation as resolved.
Show resolved Hide resolved
steps:
- name: Download all wheels
# downloading all three files into the wheelhouse
# all files are identical, so there will only be one file
uses: actions/download-artifact@v4
with:
path: wheelhouse
pattern: artefact-*
merge-multiple: true
- name: Put them all in the dist folder
run: |
mkdir dist
for w in `find wheelhouse/ -type f -name "*.whl"` ; do cp $w dist/ ; done
- name: Publish wheels
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_PYTKET_QUEST_API_TOKEN }}
verbose: true
- name: Download all wheels
# downloading all three files into the wheelhouse
# all files are identical, so there will only be one file
uses: actions/download-artifact@v4
with:
path: wheelhouse
pattern: artefact-*
merge-multiple: true
- name: Put them all in the dist folder
run: |
mkdir dist
for w in `find wheelhouse/ -type f -name "*.whl"` ; do cp $w dist/ ; done
- name: Publish wheels
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_PYTKET_QUEST_API_TOKEN }}
verbose: true

build_docs:
name: Build docs
if: github.event_name == 'release'
needs: publish_to_pypi
runs-on: ubuntu-22.04
ferbetanzo marked this conversation as resolved.
Show resolved Hide resolved
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
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 extension
run: for w in `find wheelhouse/ -type f -name "*.whl"` ; do pip install $w ; done
- name: Install docs dependencies
run: |
pip install -r .github/workflows/docs/requirements.txt
- name: Build docs
timeout-minutes: 20
run: |
cd .github/workflows/docs
mkdir extensions
./build-docs -d ${GITHUB_WORKSPACE}/.github/workflows/docs/extensions/api
- name: Upload docs as artefact
uses: actions/upload-pages-artifact@v3
with:
path: .github/workflows/docs/extensions
- uses: actions/checkout@v4
with:
fetch-depth: "0"
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
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 extension
run: for w in `find wheelhouse/ -type f -name "*.whl"` ; do pip install $w ; done
- name: Install docs dependencies
run: |
pip install -r .github/workflows/docs/requirements.txt
- name: Build docs
timeout-minutes: 20
run: |
cd .github/workflows/docs
mkdir extensions
./build-docs -d ${GITHUB_WORKSPACE}/.github/workflows/docs/extensions/api
- name: Upload docs as artefact
uses: actions/upload-pages-artifact@v3
with:
path: .github/workflows/docs/extensions

publish_docs:
name: Publish docs
if: github.event_name == 'release'
Expand All @@ -156,6 +156,6 @@ jobs:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/[email protected]
- name: Deploy to GitHub Pages
id: deployment
uses: actions/[email protected]
31 changes: 15 additions & 16 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,21 @@ on:

jobs:
lint:

runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.x
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Update pip
run: pip install --upgrade pip
- name: Install black and pylint
run: pip install black~=24.4 pylint~=3.2
- name: Check files are formatted with black
run: |
black --check .
- name: Run pylint
run: |
pylint */
- uses: actions/checkout@v4
- name: Set up Python 3.x
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Update pip
run: pip install --upgrade pip
- name: Install black and pylint
run: pip install black pylint
- name: Check files are formatted with black
run: |
black --check .
ferbetanzo marked this conversation as resolved.
Show resolved Hide resolved
- name: Run pylint
run: |
pylint */
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ obj
.github/workflows/docs/extensions
.ipynb_checkpoints
pytket/extensions/quest/_metadata.py
.envrc
.env
.direnv

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion _metadata.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__extension_version__ = "0.0.1"
__extension_version__ = "0.1.0"
__extension_name__ = "pytket-quest"
2 changes: 2 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
API documentation
~~~~~~~~~~~~~~~~~

The pytket-quest extension allows submission of pytket circuits to the QuEST simulator via the :py:class:`QuESTBackend`.

.. automodule:: pytket.extensions.quest
:members: tk_to_quest, QuESTBackend
21 changes: 21 additions & 0 deletions docs/build-docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
rm -rf build/

# Move theming elements into the docs folder
cp -R pytket-docs-theming/_static .
CalMacCQ marked this conversation as resolved.
Show resolved Hide resolved
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
CalMacCQ marked this conversation as resolved.
Show resolved Hide resolved

# Build the docs. Ensure we have the correct project title.
sphinx-build -b html -D html_title="$EXTENSION_NAME" . build
CalMacCQ marked this conversation as resolved.
Show resolved Hide resolved

# Remove copied files. This ensures reusability.
rm -r _static
rm -r quantinuum-sphinx
rm conf.py
6 changes: 6 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
Changelog
~~~~~~~~~

0.1.0 (October 2024)
-------------------
CalMacCQ marked this conversation as resolved.
Show resolved Hide resolved

* ``QuESTBackend`` that uses ``pyQuEST`` for running simulations in QuEST.
CalMacCQ marked this conversation as resolved.
Show resolved Hide resolved
* ``tk_to_quest`` for converting pytket circuits to QuEST circuits.
8 changes: 8 additions & 0 deletions docs/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# 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.
1 change: 1 addition & 0 deletions docs/pytket-docs-theming
Submodule pytket-docs-theming added at fe7829
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,12 @@
license="Apache 2",
packages=find_namespace_packages(include=["pytket.extensions.*"]),
include_package_data=True,
install_requires=["pytket ~= 1.28", "pyquest ~= 0.0.1", "numpy >= 1.20, < 2.0.0"],
install_requires=["pytket ~= 1.34.0", "pyquest ~= 0.0.1", "numpy >= 1.20, < 2.0.0"],
classifiers=[
"Environment :: Console",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"License :: OSI Approved :: Apache Software License",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX :: Linux",
Expand Down