Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into abi3
Browse files Browse the repository at this point in the history
  • Loading branch information
mtreinish committed Jun 2, 2023
2 parents 7321041 + 332bd9f commit 5d1a856
Show file tree
Hide file tree
Showing 54 changed files with 913 additions and 211 deletions.
2 changes: 2 additions & 0 deletions .azure/lint-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ jobs:
- bash: |
set -e
source test-job/bin/activate
echo "Running ruff"
ruff qiskit test tools examples setup.py
echo "Running pylint"
pylint -rn qiskit test tools
echo "Running Cargo Clippy"
Expand Down
39 changes: 24 additions & 15 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -422,25 +422,34 @@ Note: If you have run `test/ipynb/mpl_tester.ipynb` locally it is possible some

## Style and lint

Qiskit Terra uses 2 tools for verify code formatting and lint checking. The
Qiskit Terra uses three tools for verify code formatting and lint checking. The
first tool is [black](https://github.com/psf/black) which is a code formatting
tool that will automatically update the code formatting to a consistent style.
The second tool is [pylint](https://www.pylint.org/) which is a code linter
which does a deeper analysis of the Python code to find both style issues and
potential bugs and other common issues in Python.

You can check that your local modifications conform to the style rules
by running `tox -elint` which will run `black` and `pylint` to check the local
code formatting and lint. If black returns a code formatting error you can
run `tox -eblack` to automatically update the code formatting to conform to
the style. However, if `pylint` returns any error you will have to fix these
issues by manually updating your code.

Because `pylint` analysis can be slow, there is also a `tox -elint-incr` target, which only applies
`pylint` to files which have changed from the source github. On rare occasions this will miss some
issues that would have been caught by checking the complete source tree, but makes up for this by
being much faster (and those rare oversights will still be caught by the CI after you open a pull
request).
potential bugs and other common issues in Python. The third tool is the linter
[ruff](https://github.com/charliermarsh/ruff), which has been recently
introduced into Qiskit Terra on an experimental basis. Only a very small number
of rules are enabled.

You can check that your local modifications conform to the style rules by
running `tox -elint` which will run `black`, `ruff`, and `pylint` to check the
local code formatting and lint. If black returns a code formatting error you can
run `tox -eblack` to automatically update the code formatting to conform to the
style. However, if `ruff` or `pylint` return any error you will have to fix
these issues by manually updating your code.

Because `pylint` analysis can be slow, there is also a `tox -elint-incr` target,
which runs `black` and `ruff` just as `tox -elint` does, but only applies
`pylint` to files which have changed from the source github. On rare occasions
this will miss some issues that would have been caught by checking the complete
source tree, but makes up for this by being much faster (and those rare
oversights will still be caught by the CI after you open a pull request).

Because they are so fast, it is sometimes convenient to run the tools `black` and `ruff` separately
rather than via `tox`. If you have installed the development packages in your python environment via
`pip install -r requirements-dev.txt`, then `ruff` and `black` will be available and can be run from
the command line. See [`tox.ini`](tox.ini) for how `tox` invokes them.

## Development Cycle

Expand Down
110 changes: 60 additions & 50 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

OS := $(shell uname -s)

.PHONY: default env lint lint-incr style black test test_randomized pytest pytest_randomized test_ci coverage coverage_erase clean
.PHONY: default ruff env lint lint-incr style black test test_randomized pytest pytest_randomized test_ci coverage coverage_erase clean

default: style lint-incr test ;
default: ruff style lint-incr test ;

# Dependencies need to be installed on the Anaconda virtual environment.
env:
Expand All @@ -41,6 +41,9 @@ lint-incr:
tools/verify_headers.py qiskit test tools examples
tools/find_optional_imports.py

ruff:
ruff qiskit test tools examples setup.py

style:
black --check qiskit test tools examples setup.py

Expand Down
4 changes: 2 additions & 2 deletions crates/accelerate/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ crate-type = ["cdylib"]

[dependencies]
rayon = "1.7"
numpy = "0.18.0"
numpy = "0.19.0"
rand = "0.8"
rand_pcg = "0.3"
rand_distr = "0.4.3"
Expand All @@ -25,7 +25,7 @@ rustworkx-core = "0.12"
# The base version of PyO3 and setting a minimum feature set (e.g. probably just 'extension-module')
# can be done in the workspace and inherited once we hit Rust 1.64.
[dependencies.pyo3]
version = "0.18.3"
version = "0.19.0"
features = ["extension-module", "hashbrown", "indexmap", "num-complex", "num-bigint", "abi3-py38"]

[dependencies.ndarray]
Expand Down
Loading

0 comments on commit 5d1a856

Please sign in to comment.