Skip to content

Commit

Permalink
Merge 39b2243 into 01c8b59
Browse files Browse the repository at this point in the history
  • Loading branch information
frankharkins authored Feb 27, 2024
2 parents 01c8b59 + 39b2243 commit b74927e
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 6 deletions.
16 changes: 14 additions & 2 deletions .github/workflows/notebook-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,23 @@ jobs:
- name: Check lint
shell: python
run: |
import subprocess
import subprocess, sys
files = """${{ steps.all-changed-files.outputs.all_changed_files }}"""
args = ["tox", "-e", "lint", "--"] + files.split("\n")
subprocess.run(args, check=True)
try:
subprocess.run(args, check=True)
except:
print(
"To fix, install `tox` and run `tox -e fix` or download the fixed "
"notebook from this run by clicking \"Summary\" on the upper-left "
"of this page, and downloading the \"Executed notebooks\" artifact."
"\n\n"
"For more information, see https://github.com/Qiskit/documentation/blob/main/README.md#lint-notebooks"
)
sys.exit(1)
- name: Execute notebooks
if: "!cancelled()"
shell: python
run: |
import subprocess
Expand All @@ -91,6 +102,7 @@ jobs:
subprocess.run(args, check=True)
- name: Upload executed notebooks
if: "!cancelled()"
uses: actions/upload-artifact@v4
with:
name: Executed notebooks
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,13 @@ page, click "Summary", then download "Executed notebooks".
## Lint notebooks

We use [`squeaky`](https://github.com/frankharkins/squeaky) to lint our
notebooks. To check if a notebook needs linting:
notebooks. First install `tox` using [pipx](https://pipx.pypa.io/stable/).

```sh
pipx install tox
```

To check if a notebook needs linting:

```sh
# Check all notebooks in ./docs
Expand Down
2 changes: 1 addition & 1 deletion docs/build/circuit-library.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"id": "6f257ff9-15c4-48d8-9503-7f0ab16a91b2",
"metadata": {},
"source": [
"Qiskit® includes a library of popular circuits to use as building blocks in your own programs. Using pre-defined circuits saves time researching, writing code, and debugging. The library includes popular circuits in quantum computing, circuits that are difficult to simulate classically, and circuits useful for quantum hardware benchmarking.\n",
"Qiskit® includes a library of popular circuits to use as building blocks in your own programs. Using pre-defined circuits saves time researching, writing code, and debugging. The library includes popular circuits in quantum computing, circuits that are difficult to simulate classically, and circuits useful for quantum hardware benchmarking. \n",
"\n",
"This page lists the different circuit categories the library provides. For a full list of circuits, see the [circuit library API documentation](/api/qiskit/circuit_library)."
]
Expand Down
2 changes: 1 addition & 1 deletion scripts/nb-tester/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ ipykernel~=6.29.2
qiskit[all]~=1.0
qiskit-aer~=0.13.1
qiskit-ibm-runtime~=0.19.1
squeaky==0.5.0
squeaky==0.6.0
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ setenv = PYDEVD_DISABLE_FILE_VALIDATION=1
commands = python scripts/nb-tester/test-notebook.py {posargs}

[testenv:lint]
commands = squeaky --check {posargs}
commands = squeaky --check --no-advice {posargs}

[testenv:fix]
commands = squeaky {posargs}

0 comments on commit b74927e

Please sign in to comment.