Skip to content

Commit

Permalink
Merge branch '2343-new-technique-probabilistic-error-amplification' of
Browse files Browse the repository at this point in the history
…https://github.com/unitaryfund/mitiq into 2343-new-technique-probabilistic-error-amplification
  • Loading branch information
Misty-W committed Dec 20, 2024
2 parents eadf1af + d6c1cfb commit a9b5b56
Show file tree
Hide file tree
Showing 116 changed files with 9,368 additions and 462 deletions.
2 changes: 2 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[run]
omit =
*/tests/*
mitiq/_about.py


[report]
# Regexes for lines to exclude from consideration
Expand Down
2 changes: 2 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ updates:
update-types: ["version-update:semver-minor", "version-update:semver-patch"]
- dependency-name: "pandas"
update-types: ["version-update:semver-minor", "version-update:semver-patch"]
- dependency-name: "qrack"
update-types: ["version-update:semver-minor", "version-update:semver-patch"]
# Allow up to 10 open pull requests for pip dependencies
open-pull-requests-limit: 10
labels:
Expand Down
58 changes: 6 additions & 52 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,64 +22,18 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.12"
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
make install requirements
make install
- name: Check types with mypy
run: make check-types

- name: Check code style/formatting
run: make check-format

docs:
runs-on: ubuntu-latest
steps:
- name: Check out mitiq
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
make install requirements
- name: Run the quilc & qvm Docker images
run: |
docker run --rm -idt -p 5000:5000 rigetti/qvm -S
docker run --rm -idt -p 5555:5555 rigetti/quilc -R
- name: Generate hash from all files excluding example notebooks
id: gen_hash
run: |
HASH=$(find . -type f -not -path './docs/source/examples/*' | sort | xargs cat | sha256sum | awk '{print $1}')
echo "hash=$HASH" >> $GITHUB_OUTPUT
- name: Fetch Jupyter cache
uses: actions/cache@v4
with:
path: ./docs/build/.jupyter_cache
key: jupyter-cache-${{ steps.gen_hash.outputs.hash }}

- name: Build and test Sphinx docs
run: |
export BQSKIT_DOC_CHECK_OVERRIDE=1
export PYDEVD_DISABLE_FILE_VALIDATION=1
make docs
- name: Run linkcheck on 'release' PRs
if: github.event_name == 'pull_request'
run: |
pr_title_lower=$(echo "${{ github.event.pull_request.title }}" | tr '[:upper:]' '[:lower:]')
if [[ "$pr_title_lower" == *"release"* ]]; then
make linkcheck
fi

# This is to make sure Mitiq works without optional 3rd party packages like Qiskit, pyQuil, etc.
# E.g., if we accidentally `import qiskit` in Mitiq where we shouldn't, this test will catch that.
Expand All @@ -91,7 +45,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.12"
- name: Install Mitiq
# Since requirements.txt includes cirq, which in turn has pyquil as dependency,
# we explicitly remove pyquil from the installed packages after installing mitiq
Expand All @@ -110,7 +64,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.10", "3.11", "3.12"]
runs-on: ${{ matrix.os }}
steps:
- name: Check out mitiq
Expand All @@ -125,7 +79,7 @@ jobs:
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
make install requirements
make install
- name: Run the quilc & qvm Docker images
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
Expand All @@ -135,7 +89,7 @@ jobs:
run: ${{ matrix.os == 'ubuntu-latest' && 'make test-all' || 'make test' }}
- name: Submit coverage report to Codecov
# Only submit to Codecov once.
if: ${{ matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest'}}
if: ${{ matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest'}}
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
Expand Down
64 changes: 64 additions & 0 deletions .github/workflows/docs-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: docs-build

on:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
branches:
- main
push:
branches:
- main

jobs:
docs:
runs-on: ubuntu-latest
steps:
- name: Check out mitiq
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
make install
- name: Run the quilc & qvm Docker images
run: |
docker run --rm -idt -p 5000:5000 rigetti/qvm -S
docker run --rm -idt -p 5555:5555 rigetti/quilc -R
- name: Generate hash from all files excluding example notebooks
id: gen_hash
run: |
HASH=$(find . -type f -not -path './docs/source/examples/*' | sort | xargs cat | sha256sum | awk '{print $1}')
echo "hash=$HASH" >> $GITHUB_OUTPUT
- name: Fetch Jupyter cache
uses: actions/cache@v4
with:
path: ./docs/build/.jupyter_cache
key: jupyter-cache-${{ steps.gen_hash.outputs.hash }}

- name: Build and test Sphinx docs
run: |
sudo apt update
sudo apt install ocl-icd-opencl-dev
export BQSKIT_DOC_CHECK_OVERRIDE=1
export PYDEVD_DISABLE_FILE_VALIDATION=1
make docs
- name: Run linkcheck on 'release' PRs
if: github.event_name == 'pull_request'
run: |
pr_title_lower=$(echo "${{ github.event.pull_request.title }}" | tr '[:upper:]' '[:lower:]')
if [[ "$pr_title_lower" == *"release"* ]]; then
make linkcheck
fi
3 changes: 0 additions & 3 deletions .github/workflows/greeting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,3 @@ jobs:
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
pr-message: 'Hello @${{ github.actor }}, thank you for submitting a PR to Mitiq! We will respond as soon as possible, and if you have any questions in the meantime, you can ask us on the [Unitary Fund Discord](http://discord.unitary.fund).'
issue-message: |
Hello @${{ github.actor }}, thank you for your interest in Mitiq!
If this is a bug report, please provide screenshots and/or **minimum viable code to reproduce your issue**, so we can do our best to help get it fixed. If you have any questions in the meantime, you can also ask us on the [Unitary Fund Discord](http://discord.unitary.fund).
4 changes: 2 additions & 2 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.12"
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
make install requirements
make install
pip install setuptools wheel twine
- name: Build and publish
env:
Expand Down
59 changes: 33 additions & 26 deletions .github/workflows/publish-testpypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ on:
- cron: "0 0 * * *"

jobs:
deploy:
build:
name: Build Mitiq
if: github.repository_owner == 'unitaryfund'
runs-on: ubuntu-latest
steps:
Expand All @@ -17,33 +18,39 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.12"
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
make install requirements
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.TESTPYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TESTPYPI_PASSWORD }}
pip install build
- name: change mitiq version
run: |
python setup.py sdist bdist_wheel
twine upload --repository testpypi dist/*
truncate -s -1 VERSION.txt
echo "$(date +"%Y%m%d")" >> VERSION.txt
- name: Build mitiq
run: python -m build
- name: Store build artifacts
uses: actions/upload-artifact@v4
with:
name: build
path: dist/*

# TODO: Need a way to get the version number from previous step
# download-test:
# runs-on: ubuntu-latest
# steps:
# - name: Check out mitiq
# uses: actions/checkout@v4
# - name: Set up Python
# uses: actions/setup-python@v5
# with:
# python-version: 3.8
# - name: Install Mitiq
# The ``--extra-index-url`` is necessary since otherwise ``TestPyPI`` would be
# looking for the required dependencies therein, but we want it to install them
# from the real PyPI channel.
# run: |
# pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.python.org/simple/ mitiq==x.y.z
test-publish:
name: Upload release to test PyPi
runs-on: ubuntu-latest
needs: build
environment:
name: testpypi
url: https://test.pypi.org/p/mitiq/
permissions:
id-token: write
steps:
- name: Fetch build artifacts
uses: actions/download-artifact@v4
with:
name: build
path: dist/
- name: Publish package distributions to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
.vscode
.python-version
.idea/
.coverage
*.dat
*.ipynb
*.hdf5
Expand All @@ -11,8 +10,13 @@
_build
__pycache__/
docs/build/
docs/source/tags/
mitiq.egg-info/
dist/
build/
coverage.xml
jupyter_execute/
.mypy_cache/
# Coverage reports
coverage.xml
.coverage
.coverage.*
4 changes: 3 additions & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: "3.11"
python: "3.12"
apt_packages:
- ocl-icd-opencl-dev

# Build documentation in the docs/ directory with Sphinx
sphinx:
Expand Down
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,4 @@ Yash Prabhat
Vladimir Kozhukalov
Francesc Sabater
Emiliano Godinez
Tommy Nguyen
Loading

0 comments on commit a9b5b56

Please sign in to comment.