From 0dc6e451a2358e8ab1c9a26b290afd8cdbf4635b Mon Sep 17 00:00:00 2001 From: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> Date: Tue, 7 May 2024 20:01:07 -0700 Subject: [PATCH 1/6] Create python-package.yml --- .github/workflows/python-package.yml | 37 ++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/python-package.yml diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml new file mode 100644 index 0000000..07c97b7 --- /dev/null +++ b/.github/workflows/python-package.yml @@ -0,0 +1,37 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: Python package + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.9", "3.10", "3.11"] + + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install black pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Format with black + run: | + black -l 100 ionizer/*.py tests/*.py + - name: Test with pytest + run: | + pytest tests/test_*.py From 850e23f606f4d2b19b724d698ed7dfe180b5af53 Mon Sep 17 00:00:00 2001 From: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> Date: Tue, 7 May 2024 20:05:11 -0700 Subject: [PATCH 2/6] Update python-package.yml --- .github/workflows/python-package.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 07c97b7..9e24235 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -29,6 +29,7 @@ jobs: python -m pip install --upgrade pip python -m pip install black pytest if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + python -m pip install . - name: Format with black run: | black -l 100 ionizer/*.py tests/*.py From 7e6112be5b0edf2c285208e408ac6acf3e06813a Mon Sep 17 00:00:00 2001 From: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> Date: Tue, 7 May 2024 20:10:30 -0700 Subject: [PATCH 3/6] Update python-package.yml --- .github/workflows/python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 9e24235..4b1cbfe 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -7,7 +7,7 @@ on: push: branches: [ "main" ] pull_request: - branches: [ "main" ] + branches: [ "main", "update-tests" ] jobs: build: From 45555fae2a30f932927d6af4be58dd6406f7af50 Mon Sep 17 00:00:00 2001 From: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> Date: Tue, 7 May 2024 20:30:15 -0700 Subject: [PATCH 4/6] Update python-package.yml --- .github/workflows/python-package.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 4b1cbfe..38938b6 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -33,6 +33,11 @@ jobs: - name: Format with black run: | black -l 100 ionizer/*.py tests/*.py + - name: Add & Commit + uses: EndBug/add-and-commit@v9.1.4 + with: + add: "ionizer/*.py tests/*.py" + message: "Auto-format with black" - name: Test with pytest run: | pytest tests/test_*.py From ef54795e1e6a9e83e5a584443ba82774f1264fa6 Mon Sep 17 00:00:00 2001 From: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> Date: Tue, 7 May 2024 20:33:39 -0700 Subject: [PATCH 5/6] Update python-package.yml --- .github/workflows/python-package.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 38938b6..17231f7 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -20,6 +20,9 @@ jobs: steps: - uses: actions/checkout@v4 + with: + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.event.pull_request.head.ref }} - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v3 with: From 7d94c9c559842ca0420d991b48b233d380b0ef4f Mon Sep 17 00:00:00 2001 From: glassnotes Date: Wed, 8 May 2024 03:34:10 +0000 Subject: [PATCH 6/6] Auto-format with black --- ionizer/identity_hunter.py | 1 + ionizer/ops.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/ionizer/identity_hunter.py b/ionizer/identity_hunter.py index 1684c11..ca4d4d2 100644 --- a/ionizer/identity_hunter.py +++ b/ionizer/identity_hunter.py @@ -2,6 +2,7 @@ Submodule to generate and store a database of circuit identities involving up to 3 GPI/GPI2 gates. """ + from importlib.resources import files from itertools import product diff --git a/ionizer/ops.py b/ionizer/ops.py index 8429afe..24a1eab 100644 --- a/ionizer/ops.py +++ b/ionizer/ops.py @@ -39,6 +39,7 @@ class GPI(Operation): immediately pushed into the Operator queue (optional) id (str or None): String representing the operation (optional) """ + num_wires = 1 num_params = 1 ndim_params = (0,) @@ -138,6 +139,7 @@ class MS(Operation): immediately pushed into the Operator queue (optional) id (str or None): String representing the operation (optional) """ + num_wires = 2 num_params = 0