Skip to content

Commit 989792a

Browse files
authored
Merge branch 'develop' into feature/openqasm
2 parents 94eb28d + a223425 commit 989792a

File tree

9 files changed

+159
-49
lines changed

9 files changed

+159
-49
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
- 3.7
2121
- 3.8
2222
- 3.9
23+
- '3.10'
2324

2425
name: "🐍 ${{ matrix.python }} • ${{ matrix.runs-on }} • x64 ${{ matrix.args }}"
2526
runs-on: ${{ matrix.runs-on }}
@@ -28,6 +29,7 @@ jobs:
2829
- uses: actions/checkout@v2
2930

3031
- name: Get history and tags for SCM versioning to work
32+
if: ${{ !env.ACT }}
3133
run: |
3234
git fetch --prune --unshallow
3335
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
@@ -127,6 +129,7 @@ jobs:
127129
- uses: actions/checkout@v2
128130

129131
- name: Get history and tags for SCM versioning to work
132+
if: ${{ !env.ACT }}
130133
run: |
131134
git fetch --prune --unshallow
132135
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
@@ -136,6 +139,7 @@ jobs:
136139
apt-get update && apt-get install -y python3-dev python3-pip python3-setuptools python3-wheel
137140
python3-numpy python3-scipy python3-matplotlib python3-requests python3-networkx
138141
python3-pytest python3-pytest-cov python3-flaky
142+
libomp-dev
139143
--no-install-recommends
140144
141145
- name: Fix environment variables for compilation with Clang
@@ -177,6 +181,7 @@ jobs:
177181
- uses: actions/checkout@v2
178182

179183
- name: Get history and tags for SCM versioning to work
184+
if: ${{ !env.ACT }}
180185
run: |
181186
git fetch --prune --unshallow
182187
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
@@ -244,6 +249,7 @@ jobs:
244249
- uses: actions/checkout@v2
245250

246251
- name: Get history and tags for SCM versioning to work
252+
if: ${{ !env.ACT }}
247253
run: |
248254
git fetch --prune --unshallow
249255
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
@@ -294,6 +300,7 @@ jobs:
294300
restore-keys: ${{ runner.os }}-doc-pip-
295301

296302
- name: Get history and tags for SCM versioning to work
303+
if: ${{ !env.ACT }}
297304
run: |
298305
git fetch --prune --unshallow
299306
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
@@ -328,6 +335,7 @@ jobs:
328335
- uses: actions/checkout@v2
329336

330337
- name: Get history and tags for SCM versioning to work
338+
if: ${{ !env.ACT }}
331339
run: |
332340
git fetch --prune --unshallow
333341
git fetch --depth=1 origin +refs/tags/*:refs/tags/*

.github/workflows/format.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,26 @@ jobs:
1616
steps:
1717
- uses: actions/checkout@v2
1818
- name: Get history and tags for SCM versioning to work
19+
if: ${{ !env.ACT }}
1920
run: |
2021
git fetch --prune --unshallow
2122
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
2223
- uses: actions/setup-python@v2
23-
- uses: pre-commit/action@v2.0.3
24+
25+
- name: Install pre-commit
26+
run: python3 -m pip install --upgrade pre-commit 'virtualenv!=20.11'
27+
28+
- name: Cache pre-commit hooks
29+
uses: actions/cache@v2
2430
with:
25-
# Slow hooks are marked with manual - slow is okay here, run them too
26-
extra_args: --hook-stage manual --all-files
31+
path: ~/.cache/pre-commit
32+
key: pre-commit-${{ hashFiles('**/.pre-commit-config.yaml') }}
33+
restore-keys: pre-commit-
34+
35+
- name: Run pre-commit
36+
run: |
37+
# Slow hooks are marked with manual - slow is okay here, run them too
38+
pre-commit run --hook-stage manual --all-files
2739
2840
clang-tidy:
2941
name: Clang-Tidy

.github/workflows/publish_release.yml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
ref: 'master'
3232

3333
- name: Get history and tags for SCM versioning to work
34+
if: ${{ !env.ACT }}
3435
run: |
3536
git fetch --prune --unshallow
3637
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
@@ -69,19 +70,24 @@ jobs:
6970
7071
# ========================================================================
7172

72-
- name: Build source distribution
73+
- uses: actions/setup-python@v2
74+
75+
- name: Install Python packages
76+
run: python3 -m pip install -U pip setuptools build wheel
77+
78+
- name: Build source distribution (Linux)
7379
if: runner.os == 'Linux'
74-
run: python3 setup.py sdist -d wheelhouse
80+
run: python3 -m build --sdist
7581

7682
- name: Check metadata
7783
run: |
7884
python3 -m pip install twine --prefer-binary
79-
python3 -m twine check wheelhouse/*
85+
python3 -m twine check dist/*
8086
8187
- uses: actions/upload-artifact@v2
8288
with:
83-
name: packages
84-
path: ./wheelhouse/*
89+
name: pypy_wheels
90+
path: ./dist/*
8591

8692

8793
release:
@@ -134,8 +140,10 @@ jobs:
134140
ref: 'master'
135141

136142
# ------------------------------------------------------------------------
137-
# Downloads all to directories matching the artifact names
143+
138144
- uses: actions/download-artifact@v2
145+
with:
146+
name: pypy_wheels
139147

140148
# Code below inspired from this action:
141149
# - uses: taiki-e/create-gh-release-action@v1
@@ -160,7 +168,7 @@ jobs:
160168
if [[ "${tag}" =~ ^v?[0-9\.]+-[a-zA-Z_0-9\.-]+(\+[a-zA-Z_0-9\.-]+)?$ ]]; then
161169
prerelease="--prerelease"
162170
fi
163-
gh release create "v${RELEASE_VERSION}" ${prerelease:-} --title "ProjectQ v${RELEASE_VERSION}" --notes "${notes:-}" packages/*
171+
gh release create "v${RELEASE_VERSION}" ${prerelease:-} --title "ProjectQ v${RELEASE_VERSION}" --notes "${notes:-}" pypy_wheels/*
164172
165173
166174
upload_to_pypi:
@@ -170,15 +178,16 @@ jobs:
170178
steps:
171179
- uses: actions/setup-python@v2
172180

173-
# Downloads all to directories matching the artifact names
174181
- uses: actions/download-artifact@v2
182+
with:
183+
name: pypy_wheels
175184

176185
- name: Publish standard package
177186
uses: pypa/gh-action-pypi-publish@release/v1
178187
with:
179188
user: __token__
180189
password: ${{ secrets.pypi_password }}
181-
packages_dir: packages/
190+
packages_dir: pypy_wheels/
182191

183192
master_to_develop_pr:
184193
name: Merge master back into develop

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ repos:
2323
- id: check-useless-excludes
2424

2525
- repo: https://github.com/pre-commit/pre-commit-hooks
26-
rev: v4.0.1
26+
rev: v4.1.0
2727
hooks:
2828
- id: check-added-large-files
2929
- id: check-case-conflict
@@ -44,21 +44,21 @@ repos:
4444
- id: remove-tabs
4545

4646
- repo: https://github.com/PyCQA/isort
47-
rev: 5.9.1
47+
rev: 5.10.1
4848
hooks:
4949
- id: isort
5050
name: isort (python)
5151

5252
- repo: https://github.com/psf/black
53-
rev: 21.5b1
53+
rev: 21.12b0
5454
hooks:
5555
- id: black
5656
language_version: python3
5757
# This is a slow hook, so only run this if --hook-stage manual is passed
5858
stages: [manual]
5959

6060
- repo: https://gitlab.com/PyCQA/flake8
61-
rev: 3.9.2
61+
rev: 4.0.1
6262
hooks:
6363
- id: flake8
6464
name: flake8-strict
@@ -82,7 +82,7 @@ repos:
8282
additional_dependencies: [pybind11>=2.6, numpy, requests, boto3, matplotlib, networkx, qiskit-terra, pyparsing]
8383

8484
- repo: https://github.com/mgedmin/check-manifest
85-
rev: '0.46'
85+
rev: '0.47'
8686
hooks:
8787
- id: check-manifest
8888
additional_dependencies: ['setuptools-scm', 'pybind11>=2.6']

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
- Added OpenQASMBackend to output QASM from ProjectQ circuits
1313
- Added projectq.libs.qasm to convert QASM to ProjectQ circuits
14+
- Added environment variable to avoid -march=native when building ProjectQ
15+
- Added environment variable to force build failure if extensions do not compile on CI
1416

1517
### Changed
1618
### Deprecated
1719
### Fixed
20+
21+
- Fix compiler flags cleanup function for use on CI
22+
- Fix workflow YAML to allow execution of GitHub Actions locally using `act`
23+
- GitHub action using deprecated and vulnerable `pre-commit` version
24+
- Fixed issue with `gen_reqfile` command if `--include-extras` is not provided
25+
1826
### Removed
1927
### Repository
2028

29+
- Add configuration for CIBuildWheel in `pyproject.toml`
2130
- Update `thomaseizinger/keep-a-changelog-new-release` GiHub action to v1.3.0
2231
- Update `thomaseizinger/create-pull-request` GiHub action to v1.2.2
32+
- Update pre-commit hook `pre-commit/pre-commit-hooks` to v4.1.0
33+
- Update pre-commit hook `PyCQA/isort` to v5.10.1
34+
- Update pre-commit hook `psf/black` to v21.12b0
35+
- Update pre-commit hook `PyCQA/flake8` to v4.0.1
36+
- Update pre-commit hook `mgedmin/check-manifest` to v0.47
2337

2438
## [0.7.0] - 2021-07-14
2539

docs/tutorials.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ ProjectQ comes with a high-performance quantum simulator written in C++. Please
2929
.. note::
3030
The setup will try to build a C++-Simulator, which is much faster than the Python implementation. If the C++ compilation were to fail, the setup will install a pure Python implementation of the simulator instead. The Python simulator should work fine for small examples (e.g., running Shor's algorithm for factoring 15 or 21).
3131

32-
If you want to skip the installation of the C++-Simulator altogether, you can define the ``DISABLE_PROJECTQ_CEXT`` environment variable to avoid any compilation steps.
32+
If you want to skip the installation of the C++-Simulator altogether, you can define the ``PROJECTQ_DISABLE_CEXT`` environment variable to avoid any compilation steps.
3333

3434
.. note::
3535
If building the C++-Simulator does not work out of the box, consider specifying a different compiler. For example:

pyproject.toml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,30 @@ local_scheme = 'no-local-version'
113113
[tool.yapf]
114114

115115
column_limit = 120
116+
117+
[tool.cibuildwheel]
118+
119+
archs = ['auto64']
120+
build-frontend = 'build'
121+
build-verbosity = 1
122+
skip = 'pp* *-musllinux*'
123+
environment = { PROJECTQ_DISABLE_ARCH_NATIVE='1', PROJECTQ_CI_BUILD='1' }
124+
125+
before-test = [
126+
'cd {package}',
127+
'python setup.py gen_reqfile',
128+
'python -m pip install -r requirements.txt --only-binary :all:',
129+
]
130+
131+
test-command = 'python3 {package}/examples/grover.py'
132+
133+
# Normal options, etc.
134+
manylinux-x86_64-image = 'manylinux2014'
135+
136+
[[tool.cibuildwheel.overrides]]
137+
select = 'cp36-*'
138+
manylinux-x86_64-image = 'manylinux1'
139+
140+
[[tool.cibuildwheel.overrides]]
141+
select = 'cp3{7,8,9}-*'
142+
manylinux-x86_64-image = 'manylinux2010'

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ classifier =
2424
Programming Language :: Python :: 3.7
2525
Programming Language :: Python :: 3.8
2626
Programming Language :: Python :: 3.9
27+
Programming Language :: Python :: 3.10
2728

2829
[options]
2930

0 commit comments

Comments
 (0)