Skip to content

Commit

Permalink
Hotfix/main ibm api url (#5)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
thomashaener authored Jan 3, 2017
1 parent 0c55553 commit 722104c
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 18 deletions.
Empty file added .coveralls.yml
Empty file.
10 changes: 7 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,15 @@ matrix:
packages: ['gcc-4.9', 'g++-4.9']
env: CC=gcc-4.9 CXX=g++-4.9 PYTHON=3.5

# command to install dependencies
install:
- if [ "${PYTHON:0:1}" = "3" ]; then export PY=3; fi
- pip$PY install -r requirements.txt
- pip$PY install .
- pip$PY install pytest-cov
- pip$PY install coveralls
- pip$PY install -e .

# command to run tests
script: pytest --pyargs projectq
script: pytest projectq --cov projectq

after_success:
- coveralls
13 changes: 10 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
ProjectQ - An open source software framework for quantum computing
==================================================================

.. image:: https://travis-ci.org/ProjectQ-Framework/ProjectQ.svg?branch=master
:target: https://travis-ci.org/ProjectQ-Framework/ProjectQ

.. image:: https://coveralls.io/repos/github/ProjectQ-Framework/ProjectQ/badge.svg
:target: https://coveralls.io/github/ProjectQ-Framework/ProjectQ


ProjectQ is an open source effort for quantum computing.

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

.. code:: bash
python setup.py install
python setup.py install --user
or

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

.. code:: bash
python setup.py --without-cppsimulator install
python setup.py --without-cppsimulator install --user
If you are using pip, then this parameter can be supplied as follows

.. code:: bash
python -m pip install --global-option=--without-cppsimulator .
python -m pip install --global-option=--without-cppsimulator --user .
Then, please visit the `ProjectQ website <http://www.projectq.ch>`__,
where you will find
Expand Down
8 changes: 6 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,13 @@
# built documents.
#
# The short X.Y version.
version = '0.1'

# This reads the __version__ variable from projectq/_version.py
exec(open('../projectq/_version.py').read())

version = __version__
# The full version, including alpha/beta/rc tags.
release = '0.1.1'
release = __version__

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
10 changes: 6 additions & 4 deletions docs/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
Examples
========

All example codes can be found on `GitHub <https://github.com/ProjectQ-Framework/ProjectQ/tree/master/examples/>`_.

.. toctree::
:maxdepth: 2

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

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

.. literalinclude:: ../examples/quantum_random_numbers_ibm.py
Expand Down Expand Up @@ -162,7 +164,7 @@ As a third example, consider Shor's algorithm for factoring, which for a given (
.. literalinclude:: ../examples/shor.py
:lineno-start: 87
:lines: 87-98
:emphasize-lines: 6
:emphasize-lines: 9
:linenos:
:tab-width: 2

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

.. literalinclude:: ../examples/shor.py
:lines: 50-68
:lineno-start: 50
:lines: 52-70
:lineno-start: 52
:linenos:
:dedent: 1
:tab-width: 2
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Detailed instructions and OS-specific hints

.. code-block:: bash
sudo pip3 install projectq
sudo pip3 install --user projectq
all dependencies (such as numpy and pybind11) should be installed automatically.

Expand Down
2 changes: 1 addition & 1 deletion projectq/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
# limitations under the License.

"""Define version number here and read it from setup.py automatically"""
__version__ = "0.1.1"
__version__ = "0.1.2"
8 changes: 6 additions & 2 deletions projectq/backends/_ibm/_ibm_http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from requests.compat import urljoin


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

class DeviceOfflineError(Exception):
Expand Down Expand Up @@ -92,7 +92,11 @@ def _authenticate(email=None, password=None):
:return:
"""
if email is None:
email = input('IBM QE user (e-mail) > ')
try:
input_fun = raw_input
except NameError:
input_fun = input
email = input_fun('IBM QE user (e-mail) > ')
if password is None:
password = getpass.getpass(prompt='IBM QE password > ')

Expand Down
8 changes: 6 additions & 2 deletions projectq/backends/_ibm/_ibm_http_client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def no_requests(monkeypatch):
monkeypatch.delattr("requests.sessions.Session.request")


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


Expand Down Expand Up @@ -135,6 +135,7 @@ def raise_for_status(self):
password = 12345
email = "test@projectq.ch"
monkeypatch.setitem(__builtins__, "input", lambda x: email)
monkeypatch.setitem(__builtins__, "raw_input", lambda x: email)
def user_password_input(prompt):
if prompt == "IBM QE password > ":
return password
Expand Down Expand Up @@ -197,6 +198,7 @@ def mocked_requests_post(*args, **kwargs):
password = 12345
email = "test@projectq.ch"
monkeypatch.setitem(__builtins__, "input", lambda x: email)
monkeypatch.setitem(__builtins__, "raw_input", lambda x: email)
def user_password_input(prompt):
if prompt == "IBM QE password > ":
return password
Expand Down Expand Up @@ -233,6 +235,7 @@ def mocked_requests_post(*args, **kwargs):
password = 12345
email = "test@projectq.ch"
monkeypatch.setitem(__builtins__, "input", lambda x: email)
monkeypatch.setitem(__builtins__, "raw_input", lambda x: email)
def user_password_input(prompt):
if prompt == "IBM QE password > ":
return password
Expand Down Expand Up @@ -269,6 +272,7 @@ def mocked_requests_post(*args, **kwargs):
password = 12345
email = "test@projectq.ch"
monkeypatch.setitem(__builtins__, "input", lambda x: email)
monkeypatch.setitem(__builtins__, "raw_input", lambda x: email)
def user_password_input(prompt):
if prompt == "IBM QE password > ":
return password
Expand All @@ -279,4 +283,4 @@ def user_password_input(prompt):
_ibm_http_client.send(json_qasm, name=name,
device="real",
user=None, password=None,
shots=shots, verbose=True)
shots=shots, verbose=True)

0 comments on commit 722104c

Please sign in to comment.