Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#459)
Browse files Browse the repository at this point in the history
* [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>
  • Loading branch information
pre-commit-ci[bot] and Takishima committed Jan 7, 2024
1 parent c30dfec commit dad48c5
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 37 deletions.
37 changes: 19 additions & 18 deletions .github/workflows/ci.yml
Expand Up @@ -120,7 +120,6 @@ jobs:

steps:
- name: Install Git
if: matrix.clang == 10
run: |
apt-get update && apt-get install -y git --no-install-recommends
Expand All @@ -140,27 +139,27 @@ jobs:
run: >
apt-get update && apt-get install -y python3-dev python3-pip python3-setuptools python3-wheel
python3-numpy python3-scipy python3-matplotlib python3-requests python3-networkx
python3-pytest python3-pytest-cov python3-flaky
libomp-dev
python3-pytest python3-pytest-cov python3-flaky python3-venv
--no-install-recommends
- name: Prepare Python env
run: |
python3 -m pip install -U pip setuptools wheel
python3 setup.py gen_reqfile --include-extras=test,azure-quantum,braket
python3 -m venv venv
./venv/bin/python3 -m pip install -U pip setuptools wheel
./venv/bin/python3 setup.py gen_reqfile --include-extras=test,azure-quantum,braket
cat requirements.txt
python3 -m pip install -r requirements.txt --prefer-binary
./venv/bin/python3 -m pip install -r requirements.txt --prefer-binary
- name: Upgrade pybind11 and flaky
run: python3 -m pip install --upgrade pybind11 flaky --prefer-binary
run: ./venv/bin/python3 -m pip install --upgrade pybind11 flaky --prefer-binary

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

- name: Pytest
run: |
echo 'backend: Agg' > matplotlibrc
python3 -m pytest -p no:warnings
./venv/bin/python3 -m pytest -p no:warnings
gcc:
Expand Down Expand Up @@ -192,26 +191,27 @@ jobs:
run: >
apt-get update && apt-get install -y python3-dev python3-pip python3-setuptools python3-wheel
python3-numpy python3-scipy python3-matplotlib python3-requests python3-networkx
python3-pytest python3-pytest-cov python3-flaky
python3-pytest python3-pytest-cov python3-flaky python3-venv
--no-install-recommends
- name: Prepare Python env
run: |
python3 -m pip install -U pip setuptools wheel
python3 setup.py gen_reqfile --include-extras=test,azure-quantum,braket
python3 -m venv venv
./venv/bin/python3 -m pip install -U pip setuptools wheel
./venv/bin/python3 setup.py gen_reqfile --include-extras=test,azure-quantum,braket
cat requirements.txt
python3 -m pip install -r requirements.txt --prefer-binary
./venv/bin/python3 -m pip install -r requirements.txt --prefer-binary
- name: Upgrade pybind11 and flaky
run: python3 -m pip install --upgrade pybind11 flaky --prefer-binary
run: ./venv/bin/python3 -m pip install --upgrade pybind11 flaky --prefer-binary

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

- name: Pytest
run: |
echo 'backend: Agg' > matplotlibrc
python3 -m pytest -p no:warnings
./venv/bin/python3 -m pytest -p no:warnings
# Testing on CentOS (manylinux uses a centos base, and this is an easy way
Expand Down Expand Up @@ -338,5 +338,6 @@ jobs:
- name: Build docs
run: python3 -m sphinx -b html docs docs/.build

- name: Make SDist
run: python3 setup.py sdist
# NB: disabling until setup.py is updated to remove any mention of distutils
# - name: Make SDist
# run: python3 setup.py sdist
18 changes: 9 additions & 9 deletions .pre-commit-config.yaml
Expand Up @@ -23,7 +23,7 @@ repos:
- id: check-useless-excludes

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-added-large-files
- id: check-ast
Expand All @@ -40,7 +40,7 @@ repos:

# Changes tabs to spaces
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.4.2
rev: v1.5.4
hooks:
- id: remove-tabs

Expand All @@ -59,46 +59,46 @@ repos:
additional_dependencies: [tomli]

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

- repo: https://github.com/adrienverge/yamllint.git
rev: v1.29.0
rev: v1.33.0
hooks:
- id: yamllint
require_serial: false

- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
rev: v3.15.0
hooks:
- id: pyupgrade
args: [--py37-plus, --keep-mock]

- repo: https://github.com/PyCQA/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
name: isort (python)

- repo: https://github.com/psf/black
rev: 23.1.0
rev: 23.12.1
hooks:
- id: black
language_version: python3

- repo: https://github.com/asottile/blacken-docs
rev: 1.13.0
rev: 1.16.0
hooks:
- id: blacken-docs
args: [-S, -l, '120']
additional_dependencies: [black==22.10.0]

- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
rev: 6.1.0
hooks:
- id: flake8
name: flake8-strict
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Expand Up @@ -23,9 +23,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Introduce pre-commit CI
- Update to clang-tidy 14 in GitHub workflow
- Added new pre-commit hooks: `codespell`, `doc8`, `pydocstyle` and `yamllint`
- Update pre-commit hook versions
- Keep `flake8` hook to version 5.0.4 until plugins support Flake8 6.X
- Disable `no-member` warning for Pylint on pre-commit CI
- Update pre-commit hook versions


## [v0.8.0] - 2022-10-18
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials.rst
Expand Up @@ -239,7 +239,7 @@ Detailed instructions and OS-specific hints
sudo port install py37-pip
Next, we can install ProjectQ with the high performance simulator written in C++. First, we will need to install a
suitable compiler with support for **C++11**, OpenMP, and instrinsics. The best option is to install clang 9.0 also
suitable compiler with support for **C++11**, OpenMP, and intrinsics. The best option is to install clang 9.0 also
using macports (note: gcc installed via macports does not work).

.. code-block:: bash
Expand Down
3 changes: 2 additions & 1 deletion projectq/backends/_azure/_azure_quantum_test.py
Expand Up @@ -22,7 +22,8 @@
from projectq.ops import CX, All, Command, H, Measure
from projectq.types import WeakQubitRef

_has_azure_quantum = True
# NB: temporary workaround until Azure Quantum backend is fixed
_has_azure_quantum = False
try:
from azure.quantum import Workspace

Expand Down
2 changes: 1 addition & 1 deletion projectq/cengines/_linearmapper.py
Expand Up @@ -121,7 +121,7 @@ def return_new_mapping(num_qubits, cyclic, currently_allocated_ids, stored_comma
Build a mapping of qubits to a linear chain.
It goes through stored_commands and tries to find a mapping to apply these gates on a first come first served
basis. More compilicated scheme could try to optimize to apply as many gates as possible between the Swaps.
basis. More complicated scheme could try to optimize to apply as many gates as possible between the Swaps.
Args:
num_qubits(int): Total number of qubits in the linear chain
Expand Down
2 changes: 1 addition & 1 deletion projectq/cengines/_main_test.py
Expand Up @@ -67,7 +67,7 @@ def test_main_engine_init_defaults():

default_engines = projectq.setups.default.get_engine_list()
for engine, expected in zip(eng_list, default_engines):
assert type(engine) == type(expected)
assert type(engine) is type(expected)


def test_main_engine_too_many_compiler_engines():
Expand Down
2 changes: 1 addition & 1 deletion projectq/meta/_control.py
Expand Up @@ -43,7 +43,7 @@ def canonical_ctrl_state(ctrl_state, num_qubits):
Note:
In case of integer values for `ctrl_state`, the least significant bit applies to the first qubit in the qubit
register, e.g. if ctrl_state == 2, its binary representation if '10' with the least significan bit being 0.
register, e.g. if ctrl_state == 2, its binary representation if '10' with the least significant bit being 0.
This means in particular that the following are equivalent:
Expand Down
2 changes: 1 addition & 1 deletion projectq/ops/_command_test.py
Expand Up @@ -45,7 +45,7 @@ def test_command_init(main_engine):
for cmd_qureg, expected_qureg in zip(cmd.qubits, expected_tuple):
assert cmd_qureg[0].id == expected_qureg[0].id
# Testing that Qubits are now WeakQubitRef objects
assert type(cmd_qureg[0]) == WeakQubitRef
assert type(cmd_qureg[0]) is WeakQubitRef
assert cmd._engine == main_engine
# Test that quregs are ordered if gate has interchangeable qubits:
symmetric_gate = BasicGate()
Expand Down
5 changes: 2 additions & 3 deletions setup.py
Expand Up @@ -39,7 +39,6 @@

# pylint: disable=deprecated-module

import distutils.log
import os
import platform
import subprocess
Expand Down Expand Up @@ -655,15 +654,15 @@ def run(self):
# that --dry-run --gen-compiledb are passed to build_ext regardless of
# other arguments
command = 'build_ext'
distutils.log.info("running %s --dry-run --gen-compiledb", command)
# distutils.log.info("running %s --dry-run --gen-compiledb", command)
cmd_obj = self.get_finalized_command(command)
cmd_obj.dry_run = True
cmd_obj.gen_compiledb = True
try:
cmd_obj.run()
self.distribution.have_run[command] = 1
except BuildFailed as err:
distutils.log.error('build_ext --dry-run --gen-compiledb command failed!')
# distutils.log.error('build_ext --dry-run --gen-compiledb command failed!')
raise RuntimeError('build_ext --dry-run --gen-compiledb command failed!') from err

command = ['clang-tidy']
Expand Down

0 comments on commit dad48c5

Please sign in to comment.