Skip to content

Commit 722104c

Browse files
authored
Hotfix/main ibm api url (ProjectQ-Framework#5)
Updated the IBM API URL to the main URL, fixed issue with Python2 raw_input, added coverage and Travis CI badges to readme, and fixed some small bugs in docs.
1 parent 0c55553 commit 722104c

9 files changed

Lines changed: 43 additions & 18 deletions

File tree

.coveralls.yml

Whitespace-only changes.

.travis.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,15 @@ matrix:
3131
packages: ['gcc-4.9', 'g++-4.9']
3232
env: CC=gcc-4.9 CXX=g++-4.9 PYTHON=3.5
3333

34-
# command to install dependencies
3534
install:
3635
- if [ "${PYTHON:0:1}" = "3" ]; then export PY=3; fi
3736
- pip$PY install -r requirements.txt
38-
- pip$PY install .
37+
- pip$PY install pytest-cov
38+
- pip$PY install coveralls
39+
- pip$PY install -e .
3940

4041
# command to run tests
41-
script: pytest --pyargs projectq
42+
script: pytest projectq --cov projectq
43+
44+
after_success:
45+
- coveralls

README.rst

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
ProjectQ - An open source software framework for quantum computing
22
==================================================================
33

4+
.. image:: https://travis-ci.org/ProjectQ-Framework/ProjectQ.svg?branch=master
5+
:target: https://travis-ci.org/ProjectQ-Framework/ProjectQ
6+
7+
.. image:: https://coveralls.io/repos/github/ProjectQ-Framework/ProjectQ/badge.svg
8+
:target: https://coveralls.io/github/ProjectQ-Framework/ProjectQ
9+
10+
411
ProjectQ is an open source effort for quantum computing.
512

613
The first version (v0.1) features a compilation framework capable of
@@ -31,7 +38,7 @@ Alternatively, you can clone or download this repository and run
3138

3239
.. code:: bash
3340
34-
python setup.py install
41+
python setup.py install --user
3542
3643
or
3744

@@ -46,13 +53,13 @@ all requirements are now installed), i.e.,
4653

4754
.. code:: bash
4855
49-
python setup.py --without-cppsimulator install
56+
python setup.py --without-cppsimulator install --user
5057
5158
If you are using pip, then this parameter can be supplied as follows
5259

5360
.. code:: bash
5461
55-
python -m pip install --global-option=--without-cppsimulator .
62+
python -m pip install --global-option=--without-cppsimulator --user .
5663
5764
Then, please visit the `ProjectQ website <http://www.projectq.ch>`__,
5865
where you will find

docs/conf.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,13 @@
6262
# built documents.
6363
#
6464
# The short X.Y version.
65-
version = '0.1'
65+
66+
# This reads the __version__ variable from projectq/_version.py
67+
exec(open('../projectq/_version.py').read())
68+
69+
version = __version__
6670
# The full version, including alpha/beta/rc tags.
67-
release = '0.1.1'
71+
release = __version__
6872

6973
# The language for content autogenerated by Sphinx. Refer to documentation
7074
# for a list of supported languages.

docs/examples.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
Examples
44
========
55

6+
All example codes can be found on `GitHub <https://github.com/ProjectQ-Framework/ProjectQ/tree/master/examples/>`_.
7+
68
.. toctree::
79
:maxdepth: 2
810

@@ -36,7 +38,7 @@ These values are obtained by simulating this quantum algorithm classically. By c
3638
3739
All you need to do is:
3840

39-
* Create an account for `IBM's Quantum Experience <https://qcwi-staging.mybluemix.net/>`_
41+
* Create an account for `IBM's Quantum Experience <https://quantumexperience.ng.bluemix.net/>`_
4042
* And perform these minor changes:
4143

4244
.. literalinclude:: ../examples/quantum_random_numbers_ibm.py
@@ -162,7 +164,7 @@ As a third example, consider Shor's algorithm for factoring, which for a given (
162164
.. literalinclude:: ../examples/shor.py
163165
:lineno-start: 87
164166
:lines: 87-98
165-
:emphasize-lines: 6
167+
:emphasize-lines: 9
166168
:linenos:
167169
:tab-width: 2
168170

@@ -171,8 +173,8 @@ As a third example, consider Shor's algorithm for factoring, which for a given (
171173
The most important part of the code is
172174

173175
.. literalinclude:: ../examples/shor.py
174-
:lines: 50-68
175-
:lineno-start: 50
176+
:lines: 52-70
177+
:lineno-start: 52
176178
:linenos:
177179
:dedent: 1
178180
:tab-width: 2

docs/tutorials.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Detailed instructions and OS-specific hints
6161

6262
.. code-block:: bash
6363
64-
sudo pip3 install projectq
64+
sudo pip3 install --user projectq
6565
6666
all dependencies (such as numpy and pybind11) should be installed automatically.
6767

projectq/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
# limitations under the License.
1212

1313
"""Define version number here and read it from setup.py automatically"""
14-
__version__ = "0.1.1"
14+
__version__ = "0.1.2"

projectq/backends/_ibm/_ibm_http_client.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from requests.compat import urljoin
2121

2222

23-
_api_url = 'https://qcwi-staging.mybluemix.net/api/'
23+
_api_url = 'https://quantumexperience.ng.bluemix.net/api/'
2424
_api_url_status = 'https://quantumexperience.ng.bluemix.net/api/'
2525

2626
class DeviceOfflineError(Exception):
@@ -92,7 +92,11 @@ def _authenticate(email=None, password=None):
9292
:return:
9393
"""
9494
if email is None:
95-
email = input('IBM QE user (e-mail) > ')
95+
try:
96+
input_fun = raw_input
97+
except NameError:
98+
input_fun = input
99+
email = input_fun('IBM QE user (e-mail) > ')
96100
if password is None:
97101
password = getpass.getpass(prompt='IBM QE password > ')
98102

projectq/backends/_ibm/_ibm_http_client_test.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def no_requests(monkeypatch):
2525
monkeypatch.delattr("requests.sessions.Session.request")
2626

2727

28-
_api_url = 'https://qcwi-staging.mybluemix.net/api/'
28+
_api_url = 'https://quantumexperience.ng.bluemix.net/api/'
2929
_api_url_status = 'https://quantumexperience.ng.bluemix.net/api/'
3030

3131

@@ -135,6 +135,7 @@ def raise_for_status(self):
135135
password = 12345
136136
email = "test@projectq.ch"
137137
monkeypatch.setitem(__builtins__, "input", lambda x: email)
138+
monkeypatch.setitem(__builtins__, "raw_input", lambda x: email)
138139
def user_password_input(prompt):
139140
if prompt == "IBM QE password > ":
140141
return password
@@ -197,6 +198,7 @@ def mocked_requests_post(*args, **kwargs):
197198
password = 12345
198199
email = "test@projectq.ch"
199200
monkeypatch.setitem(__builtins__, "input", lambda x: email)
201+
monkeypatch.setitem(__builtins__, "raw_input", lambda x: email)
200202
def user_password_input(prompt):
201203
if prompt == "IBM QE password > ":
202204
return password
@@ -233,6 +235,7 @@ def mocked_requests_post(*args, **kwargs):
233235
password = 12345
234236
email = "test@projectq.ch"
235237
monkeypatch.setitem(__builtins__, "input", lambda x: email)
238+
monkeypatch.setitem(__builtins__, "raw_input", lambda x: email)
236239
def user_password_input(prompt):
237240
if prompt == "IBM QE password > ":
238241
return password
@@ -269,6 +272,7 @@ def mocked_requests_post(*args, **kwargs):
269272
password = 12345
270273
email = "test@projectq.ch"
271274
monkeypatch.setitem(__builtins__, "input", lambda x: email)
275+
monkeypatch.setitem(__builtins__, "raw_input", lambda x: email)
272276
def user_password_input(prompt):
273277
if prompt == "IBM QE password > ":
274278
return password
@@ -279,4 +283,4 @@ def user_password_input(prompt):
279283
_ibm_http_client.send(json_qasm, name=name,
280284
device="real",
281285
user=None, password=None,
282-
shots=shots, verbose=True)
286+
shots=shots, verbose=True)

0 commit comments

Comments
 (0)