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

Fix CI collection #161

Merged
merged 2 commits into from
Oct 14, 2024
Merged
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
10 changes: 3 additions & 7 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ jobs:
run: pip install .
- name: Check package import works
run: python -c 'import lambeq'
- name: Install downgraded Qiskit (for compatibility reasons)
# This should be removed once the following PR is merged:
# https://github.com/PennyLaneAI/pennylane-qiskit/pull/493
run: pip install 'qiskit<1' pytket-qiskit qiskit-ibm-runtime
- name: Install extra dependencies and tester
run: pip install .[extras] .[test]
- name: Locate bobcat pre-trained model cache
Expand All @@ -77,10 +73,10 @@ jobs:
- name: Test with pytest
run: >
coverage run --source=${{ env.SRC_DIR }}
--module pytest ${{ env.SRC_DIR }} ${{ env.TEST_DIR }}
--doctest-modules
--module pytest ${{ env.TEST_DIR }}
--durations=50
--ignore=${{ env.TEST_DIR }}/text2diagram/test_depccg_parser.py
--ignore=${{ env.TEST_DIR }}/training/test_torchquantum_model.py
- name: Coverage report
run: coverage report -m
type_check:
Expand All @@ -97,7 +93,7 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies with type hints
run: python -m pip install numpy pytket spacy torch types-PyYAML types-Pillow ipython
run: python -m pip install "numpy<2.0" "matplotlib>=3.8" pytket spacy torch types-PyYAML types-Pillow ipython
- name: Install type checker
run: python -m pip install mypy
- name: Type check with mypy
Expand Down
2 changes: 1 addition & 1 deletion lambeq/backend/converters/tk.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ def box_and_offset_from_tk(tk_gate) -> tuple[Diagram, int]:
left = circuit.cod[:offset]
right = circuit.cod[offset + len(box.dom):]
circuit = circuit >> left @ box @ right
circuit = circuit >> Id().tensor(*( # type: ignore[arg-type]
circuit = circuit >> Id().tensor(*(
Bra(bras[i]) if i in bras
else Discard() if x == qubit else Id(bit)
for i, x in enumerate(circuit.cod)))
Expand Down
6 changes: 3 additions & 3 deletions lambeq/backend/drawing/mat_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

from __future__ import annotations

from matplotlib.patches import PathPatch # type: ignore[import-not-found]
from matplotlib.path import Path # type: ignore[import-not-found]
import matplotlib.pyplot as plt # type: ignore[import-not-found]
from matplotlib.patches import PathPatch
from matplotlib.path import Path
import matplotlib.pyplot as plt

from lambeq.backend.drawing.drawable import DrawableDiagram
from lambeq.backend.drawing.drawing_backend import (COLORS, DEFAULT_MARGINS,
Expand Down
4 changes: 3 additions & 1 deletion lambeq/backend/grammar.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,9 @@ def rotate(self, z: int) -> Self:
return replace(self, z=self.z + z)
else:
objects = reversed(self.objects) if z % 2 == 1 else self.objects
return type(self)(objects=[ob.rotate(z) for ob in objects])
return type(self)(
objects=[ob.rotate(z)
for ob in objects]) # type: ignore[union-attr]

def unwind(self) -> Self:
return self.rotate(-self.z)
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,4 @@ strict_optional = false

[tool.setuptools_scm]
write_to = "lambeq/version.py"

2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ packages =
lambeq.tokeniser
lambeq.training
install_requires =
matplotlib >= 3.1.2
matplotlib >= 3.8
packaging
pillow >= 6.2.1
pytket >= 1.31.0
Expand Down
2 changes: 1 addition & 1 deletion tests/training/test_pennylane_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def test_backends():
>> Cup(N, N.r) @ Id(S)))
diagrams = [diagram]

from qiskit.providers.aer.noise import NoiseModel
from qiskit_aer.noise import NoiseModel

noise_model = NoiseModel()
backend_config = {'backend': 'qiskit.aer',
Expand Down
Loading