Skip to content

Commit

Permalink
Merge pull request #161 from CQCL/release/0.18.0
Browse files Browse the repository at this point in the history
Release/0.18.0
  • Loading branch information
cqc-alec authored Jan 5, 2022
2 parents c31c664 + 03e00aa commit 4354d32
Show file tree
Hide file tree
Showing 210 changed files with 2,596 additions and 2,400 deletions.
36 changes: 26 additions & 10 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,13 @@ jobs:
conan_cmd=/home/runner/.local/bin/conan
${conan_cmd} profile new tket --detect
${conan_cmd} profile update settings.compiler.libcxx=libstdc++11 tket
${conan_cmd} config set general.revisions_enabled=1
echo "CONAN_CMD=${conan_cmd}" >> $GITHUB_ENV
- name: Install ninja and ccache
run: sudo apt-get install ninja-build ccache
- name: Build symengine
run: ${CONAN_CMD} create --profile=tket recipes/symengine
- name: Build tket
run: ${CONAN_CMD} create --profile=tket --build=missing recipes/tket
run: ${CONAN_CMD} create --profile=tket recipes/tket
- name: Install runtime test requirements
run: |
sudo apt-get install texlive texlive-latex-extra latexmk
Expand All @@ -67,6 +68,8 @@ jobs:
run: ${CONAN_CMD} create --profile=tket recipes/tket-tests
- name: Build and run tket proptests
run: ${CONAN_CMD} create --profile=tket recipes/tket-proptests
- name: Install pybind11
run: ${CONAN_CMD} create --profile=tket recipes/pybind11
- name: Set up Python 3.7
if: github.event_name == 'push'
uses: actions/setup-python@v2
Expand Down Expand Up @@ -171,15 +174,22 @@ jobs:
run: |
pip install conan
conan profile new tket --detect --force
conan config set general.revisions_enabled=1
export CC=`which conan`
echo "CONAN_CMD=${CC}" >> $GITHUB_ENV
- name: Install boost
run: conan install --profile=tket boost/1.77.0@ --build=missing
- name: Build symengine
run: conan create --profile=tket recipes/symengine
- name: Build tket
run: conan create --profile=tket --build=missing recipes/tket
run: conan create --profile=tket recipes/tket
- name: Build and run tket tests
run: conan create --profile=tket recipes/tket-tests
- name: Build and run tket proptests
run: conan create --profile=tket --build=missing recipes/tket-proptests
run: |
conan install --profile=tket rapidcheck/cci.20210702@ --build=missing
conan create --profile=tket recipes/tket-proptests
- name: Install pybind11
run: conan create --profile=tket recipes/pybind11
- name: Set up Python 3.7
if: github.event_name == 'push'
uses: actions/setup-python@v2
Expand Down Expand Up @@ -256,17 +266,20 @@ jobs:
id: conan
run: |
conan profile new tket --detect --force
conan config set general.revisions_enabled=1
export CC=`which conan`
echo "CONAN_CMD=${CC}" >> $GITHUB_ENV
- name: Install boost
run: conan install --profile=tket boost/1.77.0@ --build=missing -o boost:without_fiber=True -o boost:without_json=True -o boost:without_nowide=True
- name: Build symengine
run: conan create --profile=tket recipes/symengine -o boost:without_fiber=True -o boost:without_json=True -o boost:without_nowide=True
- name: Build tket
run: conan create --profile=tket recipes/tket --build=missing -o boost:without_fiber=True -o boost:without_json=True -o boost:without_nowide=True
run: conan create --profile=tket recipes/tket -o boost:without_fiber=True -o boost:without_json=True -o boost:without_nowide=True
- name: Build and run tket tests
run: conan create --profile=tket recipes/tket-tests -o boost:without_fiber=True -o boost:without_json=True -o boost:without_nowide=True
- name: Build and run tket proptests
run: conan create --profile=tket recipes/tket-proptests --build=missing -o boost:without_fiber=True -o boost:without_json=True -o boost:without_nowide=True
run: conan create --profile=tket recipes/tket-proptests -o boost:without_fiber=True -o boost:without_json=True -o boost:without_nowide=True
- name: Install pybind11
run: conan create --profile=tket recipes/pybind11
- name: Build pytket (3.8)
if: github.event_name == 'pull_request' || github.event_name == 'push'
run: |
Expand Down Expand Up @@ -333,22 +346,25 @@ jobs:
run: |
pip install conan
conan profile new tket --detect
conan config set general.revisions_enabled=1
$conan_cmd = (gcm conan).Path
echo "CONAN_CMD=${conan_cmd}" >> $GITHUB_ENV
- name: Cache tket build
id: cache-tket
uses: actions/cache@v2
with:
path: C:\Users\runneradmin\.conan\data\tket
key: ${{ runner.os }}-tket-tket-${{ steps.hash_tket_source.outputs.tket_hash }}-11
key: ${{ runner.os }}-tket-tket-${{ steps.hash_tket_source.outputs.tket_hash }}-13
- name: Build symengine
run: conan create --profile=tket recipes/symengine
- name: Build tket
if: steps.cache-tket.outputs.cache-hit != 'true'
run: conan create --profile=tket recipes/tket
- name: Build and run tket tests
run: conan create --profile=tket recipes/tket-tests
- name: Build and run tket proptests
run: conan create --profile=tket recipes/tket-proptests
- name: Install pybind11
run: conan create --profile=tket recipes/pybind11
- name: Set up Python 3.7
if: github.event_name == 'push'
uses: actions/setup-python@v2
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install ninja-build ccache
- name: Build symengine
run:
${CONAN_CMD} create --profile=tket recipes/symengine
- name: Build tket
run: |
${CONAN_CMD} install recipes/tket --install-folder=build/tket --profile=tket -o tket:profile_coverage=True
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/linuxbuildwheel
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ export CONAN_CMD=${PYBIN}/conan
cd /tket

${CONAN_CMD} profile new tket --detect
${CONAN_CMD} config set general.revisions_enabled=1
${CONAN_CMD} create --profile=tket recipes/symengine
${CONAN_CMD} create --profile=tket --test-folder=None recipes/tket
${CONAN_CMD} create --profile=tket --test-folder=None recipes/pybind11

cd /tket/pytket
mkdir wheelhouse
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/pytket_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,12 @@ jobs:
pip install conan
conan profile new tket --detect
conan profile update settings.compiler.libcxx=libstdc++11 tket
conan config set general.revisions_enabled=1
- name: Build symengine
run: conan create --profile=tket recipes/symengine
- name: Build tket
run: conan create --profile=tket recipes/tket
- name: Install pybind11
run: conan create --profile=tket recipes/pybind11
- name: Build pytket
run: |
cd pytket
Expand Down
22 changes: 14 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,11 @@ jobs:
run: |
pip install conan
conan profile new tket --detect --force
conan config set general.revisions_enabled=1
conan create --profile=tket --build=missing recipes/tket
conan install --profile=tket boost/1.77.0@ --build=missing
conan create --profile=tket recipes/symengine
conan create --profile=tket recipes/tket
- name: Install pybind11
run: conan create --profile=tket recipes/pybind11
- name: Build wheel (3.7)
run: .github/workflows/build_macos_wheel
- name: Set up Python 3.8
Expand Down Expand Up @@ -101,9 +104,10 @@ jobs:
eval "$(pyenv init -)"
pyenv shell tket-3.8
conan profile new tket --detect --force
conan config set general.revisions_enabled=1
conan install --profile=tket boost/1.77.0@ --build=missing -o boost:without_fiber=True -o boost:without_json=True -o boost:without_nowide=True
conan create --profile=tket recipes/tket --build=missing -o boost:without_fiber=True -o boost:without_json=True -o boost:without_nowide=True
conan create --profile=tket recipes/symengine -o boost:without_fiber=True -o boost:without_json=True -o boost:without_nowide=True
conan create --profile=tket recipes/tket -o boost:without_fiber=True -o boost:without_json=True -o boost:without_nowide=True
conan create --profile=tket recipes/pybind11
.github/workflows/build_macos_m1_wheel
pyenv shell tket-3.9
.github/workflows/build_macos_m1_wheel
Expand Down Expand Up @@ -143,19 +147,21 @@ jobs:
run: |
pip install conan
conan profile new tket --detect
conan config set general.revisions_enabled=1
$conan_cmd = (gcm conan).Path
echo "CONAN_CMD=${conan_cmd}" >> $GITHUB_ENV
- name: Cache tket build
id: cache-tket
uses: actions/cache@v2
with:
path: C:\Users\runneradmin\.conan\data\tket
key: ${{ runner.os }}-tket-tket-${{ steps.hash_tket_source.outputs.tket_hash }}-5
key: ${{ runner.os }}-tket-tket-${{ steps.hash_tket_source.outputs.tket_hash }}-7
- name: Build symengine
run: conan create --profile=tket recipes/symengine
- name: Build tket
if: steps.cache-tket.outputs.cache-hit != 'true'
run: |
conan create --profile=tket recipes/tket
run: conan create --profile=tket recipes/tket
- name: Install pybind11
run: conan create --profile=tket recipes/pybind11
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ build
depgraph.png
dist
doc
pytket/pytket/_version.py
pytket/tests/qasm_test_files/testout.qasm
pytket/tests/qasm_test_files/testout2.qasm
pytket/tests/qasm_test_files/testout3.qasm
Expand Down
41 changes: 31 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,6 @@ If you wish you can set your profile to Debug mode:
conan profile update settings.build_type=Debug tket
```

#### Enable revisions

In order to pick up the proper revision of the `pybind11` package, it is
currently necessary to do the following (or equivalent):

```shell
conan config set general.revisions_enabled=1
```

#### Test dependencies

A few of the tket tests require a working LaTeX installation, including
Expand All @@ -115,6 +106,30 @@ The Python tests require a few more packages. These can be installed with:
```shell
pip install -r pytket/tests/requirements.txt
```

### Adding local `pybind11`

There is a known [issue](https://github.com/conan-io/conan-center-index/issues/6605) with using `pybind11`
from the `conan-center` that can lead to a Python crash when importing `pytket`. To remedy this,
`pybind11` must be installed from the local recipe:

```shell
conan remove -f pybind11/*
conan create --profile=tket recipes/pybind11
```

where the first line serves to remove any version already installed.

### Building symengine

The `symengine` dependency is built from a local conan recipe. Run:

```shell
conan create --profile=tket recipes/symengine
```

to build it.

### Building tket

#### Method 1
Expand Down Expand Up @@ -150,7 +165,13 @@ with:
conan create --profile=tket recipes/tket-proptests
```

Now to build pytket:
Now to build pytket, first install the `pybind11` headers:

```shell
conan create --profile=tket recipes/pybind11
```

Then build the pytket module:

```shell
cd pytket
Expand Down
5 changes: 4 additions & 1 deletion pytket/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ find_file(CONANBUILDINFO_FILE conanbuildinfo.cmake HINTS ${CMAKE_BINARY_DIR})
include(${CONANBUILDINFO_FILE})
conan_basic_setup(NO_OUTPUT_DIRS)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_BINARY_DIR}")
find_package(pybind11 REQUIRED)

set(Boost_NO_BOOST_CMAKE ON)

if (WIN32)
Expand All @@ -37,7 +40,7 @@ else()
endif()

function(build_module module)
pybind11_add_module(${module} NO_EXTRAS ${ARGN})
pybind11_add_module(${module} ${ARGN})
target_include_directories(${module} PRIVATE binders/include)
target_link_libraries(${module} PRIVATE ${CONAN_LIBS})
endfunction(build_module)
Expand Down
4 changes: 1 addition & 3 deletions pytket/binders/include/UnitRegister.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef _TKET_UnitRegister_H_
#define _TKET_UnitRegister_H_
#pragma once

#include "Utils/UnitID.hpp"

Expand Down Expand Up @@ -62,4 +61,3 @@ class UnitRegister {
typedef UnitRegister<Bit> BitRegister;
typedef UnitRegister<Qubit> QubitRegister;
} // namespace tket
#endif //_TKET_UnitRegister_H_
5 changes: 1 addition & 4 deletions pytket/binders/include/binder_json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef _TKET_BINDER_JSON_H_
#define _TKET_BINDER_JSON_H_
#pragma once

#if defined(__clang__)
#pragma GCC diagnostic push
Expand All @@ -26,5 +25,3 @@
#if defined(__clang__)
#pragma GCC diagnostic pop
#endif

#endif
5 changes: 1 addition & 4 deletions pytket/binders/include/binder_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef _TKET_BINDER_UTILS_H_
#define _TKET_BINDER_UTILS_H_
#pragma once

/** Narrow No-Break Space (U+202F, UTF-8 encoding) */
#define NNBSP "\xE2\x80\xAF"

/** Pluralize a reference to a class object in a docstring */
#define CLSOBJS(a) ":py:class:`" #a "`" NNBSP "s"

#endif
5 changes: 1 addition & 4 deletions pytket/binders/include/typecast.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef _TKET__typecast_H_
#define _TKET__typecast_H_
#pragma once

#include <pybind11/detail/typeid.h>
#include <pybind11/functional.h>
Expand Down Expand Up @@ -327,5 +326,3 @@ struct type_caster<SymEngine::RCP<const SymEngine::Symbol>> {
};
} // namespace detail
} // namespace pybind11

#endif
5 changes: 1 addition & 4 deletions pytket/binders/include/unit_downcast.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef _TKET__unit_downcast_H_
#define _TKET__unit_downcast_H_
#pragma once
#include <pybind11/pybind11.h>

#include "Utils/UnitID.hpp"
Expand All @@ -39,5 +38,3 @@ struct polymorphic_type_hook<tket::UnitID> {
}
};
} // namespace pybind11

#endif //_TKET__unit_downcast_H_
Loading

0 comments on commit 4354d32

Please sign in to comment.