Skip to content

Commit dad48c5

Browse files
[pre-commit.ci] pre-commit autoupdate (#459)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/pre-commit/pre-commit-hooks: v4.4.0 → v4.5.0](pre-commit/pre-commit-hooks@v4.4.0...v4.5.0) - [github.com/Lucas-C/pre-commit-hooks: v1.4.2 → v1.5.4](Lucas-C/pre-commit-hooks@v1.4.2...v1.5.4) - [github.com/codespell-project/codespell: v2.2.2 → v2.2.6](codespell-project/codespell@v2.2.2...v2.2.6) - [github.com/adrienverge/yamllint.git: v1.29.0 → v1.33.0](https://github.com/adrienverge/yamllint.git/compare/v1.29.0...v1.33.0) - [github.com/asottile/pyupgrade: v3.3.1 → v3.15.0](asottile/pyupgrade@v3.3.1...v3.15.0) - [github.com/PyCQA/isort: 5.12.0 → 5.13.2](PyCQA/isort@5.12.0...5.13.2) - [github.com/psf/black: 23.1.0 → 23.12.1](psf/black@23.1.0...23.12.1) - [github.com/asottile/blacken-docs: 1.13.0 → 1.16.0](adamchainz/blacken-docs@1.13.0...1.16.0) - [github.com/PyCQA/flake8: 5.0.4 → 6.1.0](PyCQA/flake8@5.0.4...6.1.0) * Temporary disable Azure Quantum backend * Fix CI issues * Fix CI issues with GCC build * Fix typos * Use virtualenv for GCC and Clang builds * Update CHANGELOG * Fix failing CI tests * Fix failing CI tests * Fix pre-commit issues + remove distutils.log * Temporary disable step in failing CI job --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Nguyen Damien <ngn.damien@gmail.com>
1 parent c30dfec commit dad48c5

File tree

10 files changed

+38
-37
lines changed

10 files changed

+38
-37
lines changed

.github/workflows/ci.yml

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ jobs:
120120

121121
steps:
122122
- name: Install Git
123-
if: matrix.clang == 10
124123
run: |
125124
apt-get update && apt-get install -y git --no-install-recommends
126125
@@ -140,27 +139,27 @@ jobs:
140139
run: >
141140
apt-get update && apt-get install -y python3-dev python3-pip python3-setuptools python3-wheel
142141
python3-numpy python3-scipy python3-matplotlib python3-requests python3-networkx
143-
python3-pytest python3-pytest-cov python3-flaky
144-
libomp-dev
142+
python3-pytest python3-pytest-cov python3-flaky python3-venv
145143
--no-install-recommends
146144
147145
- name: Prepare Python env
148146
run: |
149-
python3 -m pip install -U pip setuptools wheel
150-
python3 setup.py gen_reqfile --include-extras=test,azure-quantum,braket
147+
python3 -m venv venv
148+
./venv/bin/python3 -m pip install -U pip setuptools wheel
149+
./venv/bin/python3 setup.py gen_reqfile --include-extras=test,azure-quantum,braket
151150
cat requirements.txt
152-
python3 -m pip install -r requirements.txt --prefer-binary
151+
./venv/bin/python3 -m pip install -r requirements.txt --prefer-binary
153152
154153
- name: Upgrade pybind11 and flaky
155-
run: python3 -m pip install --upgrade pybind11 flaky --prefer-binary
154+
run: ./venv/bin/python3 -m pip install --upgrade pybind11 flaky --prefer-binary
156155

157156
- name: Build and install package
158-
run: python3 -m pip install -ve .[azure-quantum,braket,test]
157+
run: ./venv/bin/python3 -m pip install -ve .[azure-quantum,braket,test]
159158

160159
- name: Pytest
161160
run: |
162161
echo 'backend: Agg' > matplotlibrc
163-
python3 -m pytest -p no:warnings
162+
./venv/bin/python3 -m pytest -p no:warnings
164163
165164
166165
gcc:
@@ -192,26 +191,27 @@ jobs:
192191
run: >
193192
apt-get update && apt-get install -y python3-dev python3-pip python3-setuptools python3-wheel
194193
python3-numpy python3-scipy python3-matplotlib python3-requests python3-networkx
195-
python3-pytest python3-pytest-cov python3-flaky
194+
python3-pytest python3-pytest-cov python3-flaky python3-venv
196195
--no-install-recommends
197196
198197
- name: Prepare Python env
199198
run: |
200-
python3 -m pip install -U pip setuptools wheel
201-
python3 setup.py gen_reqfile --include-extras=test,azure-quantum,braket
199+
python3 -m venv venv
200+
./venv/bin/python3 -m pip install -U pip setuptools wheel
201+
./venv/bin/python3 setup.py gen_reqfile --include-extras=test,azure-quantum,braket
202202
cat requirements.txt
203-
python3 -m pip install -r requirements.txt --prefer-binary
203+
./venv/bin/python3 -m pip install -r requirements.txt --prefer-binary
204204
205205
- name: Upgrade pybind11 and flaky
206-
run: python3 -m pip install --upgrade pybind11 flaky --prefer-binary
206+
run: ./venv/bin/python3 -m pip install --upgrade pybind11 flaky --prefer-binary
207207

208208
- name: Build and install package
209-
run: python3 -m pip install -ve .[azure-quantum,braket,test]
209+
run: ./venv/bin/python3 -m pip install -ve .[azure-quantum,braket,test]
210210

211211
- name: Pytest
212212
run: |
213213
echo 'backend: Agg' > matplotlibrc
214-
python3 -m pytest -p no:warnings
214+
./venv/bin/python3 -m pytest -p no:warnings
215215
216216
217217
# Testing on CentOS (manylinux uses a centos base, and this is an easy way
@@ -338,5 +338,6 @@ jobs:
338338
- name: Build docs
339339
run: python3 -m sphinx -b html docs docs/.build
340340

341-
- name: Make SDist
342-
run: python3 setup.py sdist
341+
# NB: disabling until setup.py is updated to remove any mention of distutils
342+
# - name: Make SDist
343+
# run: python3 setup.py sdist

.pre-commit-config.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ repos:
2323
- id: check-useless-excludes
2424

2525
- repo: https://github.com/pre-commit/pre-commit-hooks
26-
rev: v4.4.0
26+
rev: v4.5.0
2727
hooks:
2828
- id: check-added-large-files
2929
- id: check-ast
@@ -40,7 +40,7 @@ repos:
4040

4141
# Changes tabs to spaces
4242
- repo: https://github.com/Lucas-C/pre-commit-hooks
43-
rev: v1.4.2
43+
rev: v1.5.4
4444
hooks:
4545
- id: remove-tabs
4646

@@ -59,46 +59,46 @@ repos:
5959
additional_dependencies: [tomli]
6060

6161
- repo: https://github.com/codespell-project/codespell
62-
rev: v2.2.2
62+
rev: v2.2.6
6363
hooks:
6464
- id: codespell
6565
require_serial: false
6666
files: .*\.(py|txt|cmake|md|rst|sh|ps1|hpp|tpp|cpp|cc)$
6767
args: [-S, '.git,third_party', -I, .codespell.allow]
6868

6969
- repo: https://github.com/adrienverge/yamllint.git
70-
rev: v1.29.0
70+
rev: v1.33.0
7171
hooks:
7272
- id: yamllint
7373
require_serial: false
7474

7575
- repo: https://github.com/asottile/pyupgrade
76-
rev: v3.3.1
76+
rev: v3.15.0
7777
hooks:
7878
- id: pyupgrade
7979
args: [--py37-plus, --keep-mock]
8080

8181
- repo: https://github.com/PyCQA/isort
82-
rev: 5.12.0
82+
rev: 5.13.2
8383
hooks:
8484
- id: isort
8585
name: isort (python)
8686

8787
- repo: https://github.com/psf/black
88-
rev: 23.1.0
88+
rev: 23.12.1
8989
hooks:
9090
- id: black
9191
language_version: python3
9292

9393
- repo: https://github.com/asottile/blacken-docs
94-
rev: 1.13.0
94+
rev: 1.16.0
9595
hooks:
9696
- id: blacken-docs
9797
args: [-S, -l, '120']
9898
additional_dependencies: [black==22.10.0]
9999

100100
- repo: https://github.com/PyCQA/flake8
101-
rev: 5.0.4
101+
rev: 6.1.0
102102
hooks:
103103
- id: flake8
104104
name: flake8-strict

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2323
- Introduce pre-commit CI
2424
- Update to clang-tidy 14 in GitHub workflow
2525
- Added new pre-commit hooks: `codespell`, `doc8`, `pydocstyle` and `yamllint`
26-
- Update pre-commit hook versions
2726
- Keep `flake8` hook to version 5.0.4 until plugins support Flake8 6.X
2827
- Disable `no-member` warning for Pylint on pre-commit CI
28+
- Update pre-commit hook versions
2929

3030

3131
## [v0.8.0] - 2022-10-18

docs/tutorials.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ Detailed instructions and OS-specific hints
239239
sudo port install py37-pip
240240
241241
Next, we can install ProjectQ with the high performance simulator written in C++. First, we will need to install a
242-
suitable compiler with support for **C++11**, OpenMP, and instrinsics. The best option is to install clang 9.0 also
242+
suitable compiler with support for **C++11**, OpenMP, and intrinsics. The best option is to install clang 9.0 also
243243
using macports (note: gcc installed via macports does not work).
244244

245245
.. code-block:: bash

projectq/backends/_azure/_azure_quantum_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
from projectq.ops import CX, All, Command, H, Measure
2323
from projectq.types import WeakQubitRef
2424

25-
_has_azure_quantum = True
25+
# NB: temporary workaround until Azure Quantum backend is fixed
26+
_has_azure_quantum = False
2627
try:
2728
from azure.quantum import Workspace
2829

projectq/cengines/_linearmapper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def return_new_mapping(num_qubits, cyclic, currently_allocated_ids, stored_comma
121121
Build a mapping of qubits to a linear chain.
122122
123123
It goes through stored_commands and tries to find a mapping to apply these gates on a first come first served
124-
basis. More compilicated scheme could try to optimize to apply as many gates as possible between the Swaps.
124+
basis. More complicated scheme could try to optimize to apply as many gates as possible between the Swaps.
125125
126126
Args:
127127
num_qubits(int): Total number of qubits in the linear chain

projectq/cengines/_main_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def test_main_engine_init_defaults():
6767

6868
default_engines = projectq.setups.default.get_engine_list()
6969
for engine, expected in zip(eng_list, default_engines):
70-
assert type(engine) == type(expected)
70+
assert type(engine) is type(expected)
7171

7272

7373
def test_main_engine_too_many_compiler_engines():

projectq/meta/_control.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def canonical_ctrl_state(ctrl_state, num_qubits):
4343
4444
Note:
4545
In case of integer values for `ctrl_state`, the least significant bit applies to the first qubit in the qubit
46-
register, e.g. if ctrl_state == 2, its binary representation if '10' with the least significan bit being 0.
46+
register, e.g. if ctrl_state == 2, its binary representation if '10' with the least significant bit being 0.
4747
4848
This means in particular that the following are equivalent:
4949

projectq/ops/_command_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def test_command_init(main_engine):
4545
for cmd_qureg, expected_qureg in zip(cmd.qubits, expected_tuple):
4646
assert cmd_qureg[0].id == expected_qureg[0].id
4747
# Testing that Qubits are now WeakQubitRef objects
48-
assert type(cmd_qureg[0]) == WeakQubitRef
48+
assert type(cmd_qureg[0]) is WeakQubitRef
4949
assert cmd._engine == main_engine
5050
# Test that quregs are ordered if gate has interchangeable qubits:
5151
symmetric_gate = BasicGate()

setup.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939

4040
# pylint: disable=deprecated-module
4141

42-
import distutils.log
4342
import os
4443
import platform
4544
import subprocess
@@ -655,15 +654,15 @@ def run(self):
655654
# that --dry-run --gen-compiledb are passed to build_ext regardless of
656655
# other arguments
657656
command = 'build_ext'
658-
distutils.log.info("running %s --dry-run --gen-compiledb", command)
657+
# distutils.log.info("running %s --dry-run --gen-compiledb", command)
659658
cmd_obj = self.get_finalized_command(command)
660659
cmd_obj.dry_run = True
661660
cmd_obj.gen_compiledb = True
662661
try:
663662
cmd_obj.run()
664663
self.distribution.have_run[command] = 1
665664
except BuildFailed as err:
666-
distutils.log.error('build_ext --dry-run --gen-compiledb command failed!')
665+
# distutils.log.error('build_ext --dry-run --gen-compiledb command failed!')
667666
raise RuntimeError('build_ext --dry-run --gen-compiledb command failed!') from err
668667

669668
command = ['clang-tidy']

0 commit comments

Comments
 (0)