Skip to content

Commit

Permalink
Update installation instructions, add cmake as sdist dependency, add …
Browse files Browse the repository at this point in the history
…docs to manifest
  • Loading branch information
oscarhiggott committed Jan 22, 2021
1 parent a9dbcc9 commit b79a4f2
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 10 deletions.
5 changes: 3 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
include LICENSE
include MANIFEST.in
include README.in
include README.md
include CMakeLists.txt
recursive-include src *.txt *.py *.cpp *.h
graft lib
graft lib
graft docs
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,22 @@

PyMatching is a fast Python/C++ library for decoding quantum error correcting codes (QECC) using the Minimum Weight Perfect Matching (MWPM) decoder. PyMatching can decode codes for which each error generates a pair of syndrome defects (or only a single defect at a boundary). Codes that satisfy these properties include two-dimensional topological codes such as the [toric code](https://en.wikipedia.org/wiki/Toric_code), the [surface code](https://arxiv.org/abs/quant-ph/0110143) and [2D hyperbolic codes](https://arxiv.org/abs/1506.04029). PyMatching can handle boundaries, measurement errors and weighted edges in the matching graph. Since the core algorithms are written in C++, PyMatching is much faster than a pure Python NetworkX implementation.

Documentation for PyMatching can be found at: [pymatching.readthedocs.io](https://pymatching.readthedocs.io/)

## Installation

Documentation for PyMatching can be found at: [pymatching.readthedocs.io](https://pymatching.readthedocs.io/)
PyMatching can be downloaded and installed from [PyPI](https://pypi.org/project/PyMatching/) with the command:
```
pip install pymatching
```
This is the recommended way to install PyMatching, since it does not require you to build the C++ extension. Note that PyMatching requires Python 3.6 or later.

Clone the repository (using the `--recursive` flag to include the lib/pybind11 submodule), and then use `pip` to install:
If instead you would like to install PyMatching from source, clone the repository (using the `--recursive` flag to include the lib/pybind11 submodule), and then use `pip` to install:
```
git clone --recursive https://github.com/oscarhiggott/PyMatching.git
pip install -e ./PyMatching
```

Note that PyMatching requires Python 3.6 or later. The installation may take a few minutes since the C++ extension has to be compiled. If you'd also like to run the tests, first install [pytest](https://docs.pytest.org/en/stable/), and then run:
The installation may take a few minutes since the C++ extension has to be compiled. If you'd also like to run the tests, first install [pytest](https://docs.pytest.org/en/stable/), and then run:
```
pytest ./PyMatching/tests
```
Expand Down
15 changes: 11 additions & 4 deletions docs/installation.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
Installation
===============

PyMatching requires Python 3.6.0 or later. To install PyMatching,
first clone the repository (you must use the ``--recursive`` flag)::
PyMatching can be downloaded and installed from `PyPI <https://pypi.org/project/PyMatching/>`_ with the command::

git clone --recursive https://github.com/oscarhiggott/PyMatching.git
pip install pymatching

This is the recommended way to install PyMatching, since it does not require you to build the C++ extension.
Note that PyMatching requires Python 3.6 or later.

and then install using ``pip``::
If instead you would like to install PyMatching from source, clone the repository (using the `--recursive` flag to include the lib/pybind11 submodule), and then use `pip` to install::

git clone --recursive https://github.com/oscarhiggott/PyMatching.git
pip install -e ./PyMatching

The installation may take a few minutes since the C++ extension has to be compiled. If you'd also like to run the tests, first install `pytest <https://docs.pytest.org/en/stable/>`_, and then run::

pytest ./PyMatching/tests
6 changes: 6 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
from distutils.version import LooseVersion


def pip_install(package):
return subprocess.check_call([sys.executable, '-m', 'pip', 'install', package])

# CMake is needed only if built from source (not for wheels)
pip_install("cmake")

root_dir = os.path.dirname(os.path.realpath(__file__))
lib_dir = os.path.join(root_dir, "lib")

Expand Down

0 comments on commit b79a4f2

Please sign in to comment.