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

Fh/squeaky advice #2

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
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}
Loading