Skip to content

Commit

Permalink
Merge pull request #147 from Blueqat/networkx-lazy-import
Browse files Browse the repository at this point in the history
Remove qgate-backend and fix CI
  • Loading branch information
gyu-don authored Apr 17, 2022
2 parents b492ed4 + f454c55 commit 0185577
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 499 deletions.
44 changes: 14 additions & 30 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ executors:
type: string
working_directory: ~/miniconda3-<< parameters.tag >>
docker:
- image: continuumio/miniconda3:4.9.2
- image: continuumio/miniconda3:4.10.3


commands:
Expand Down Expand Up @@ -50,10 +50,6 @@ commands:
tag:
type: string

qgate_url:
type: string
default: ""

steps:
- checkout

Expand All @@ -72,17 +68,6 @@ commands:
pip install --progress-bar off -r requirements.txt
pip install --progress-bar off -r optional-requirements.txt
- when:
condition: << parameters.qgate_url >>
steps:
- run:
name: Install qgate
command: |
conda init bash
. ~/.bashrc
conda activate py<<parameters.tag>>
pip install << parameters.qgate_url >>
- save_cache:
paths:
- /opt/conda/envs/py<<parameters.tag>>
Expand All @@ -102,7 +87,10 @@ jobs:
name: twine check
command: |
. venv/bin/activate
rm -rf dist
mkdir dist
python setup.py build sdist bdist_wheel
twine check dist/*
test_main:
parameters:
Expand All @@ -111,11 +99,7 @@ jobs:

test_option:
type: string
default: "--add-backend qgate --add-backend numba"

qgate_url:
type: string
default: ""
default: "--add-backend numba"

executor:
name: miniconda
Expand All @@ -124,7 +108,6 @@ jobs:
steps:
- install:
tag: <<parameters.tag>>
qgate_url: <<parameters.qgate_url>>

- run:
name: create a result directory
Expand All @@ -151,16 +134,17 @@ workflows:
jobs:
- doccheck
- test_main:
name: py3.7-qgate-0.2.2
tag: "3.7.9"
qgate_url: https://github.com/shinmorino/qgate/raw/gh-pages/packages/0.2/qgate-0.2.2-cp37-cp37m-manylinux1_x86_64.whl
name: py3.7
tag: "3.7.13"

- test_main:
name: py3.8-qgate-0.2.2
tag: "3.8.8"
qgate_url: https://github.com/shinmorino/qgate/raw/gh-pages/packages/0.2/qgate-0.2.2-cp38-cp38-manylinux1_x86_64.whl
name: py3.8
tag: "3.8.13"

- test_main:
name: py3.9
tag: "3.9.0"
test_option: "--add-backend numba"
tag: "3.9.7"

- test_main:
name: py3.10
tag: "3.10.4"
11 changes: 8 additions & 3 deletions blueqat/backends/draw_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,20 @@
from ..circuit import Circuit
from ..gate import *

import networkx as nx
import matplotlib.pyplot as plt
# To avoid ImportError, don't import this here.
# import networkx as nx
# import matplotlib.pyplot as plt
import numpy as np
import math

class DrawCircuit(Backend):
"""Backend for draw output."""

def _preprocess_run(self, gates, n_qubits, args, kwargs):
# Lazy import to avoid unneeded ImportError.
import networkx as nx
import matplotlib.pyplot as plt

qlist = {}
flg = 0
time = 0
Expand Down Expand Up @@ -254,4 +259,4 @@ def _three_qubit_gate_noargs(self, gate, ctx):
def gate_measure(self, gate, ctx):
return ctx

gate_reset = _one_qubit_gate_noargs
gate_reset = _one_qubit_gate_noargs
Loading

0 comments on commit 0185577

Please sign in to comment.