Skip to content

Commit f2a2c21

Browse files
Remove Python 3.7 + add Python 3.11 + 3.12 (#471)
* Remove Python 3.7 + add Python 3.11 + 3.12 * Update cibuildwheel config * Update black config * Update minimum GCC and Clang version on CI * Fix refcheck=False when in CI * Update minimum package versions for 3rd-party dependencies * Update CHANGELOG * Fix compatibility with Python 3.12 * Fix linter warnings * Update GitHub release workflows * Fix setup.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix setup.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Automatically cancel redundant GitHub workflows * Fix clang-tidy workflow * Fix setuptools installation for CI runs * Fix setup.py * Test with naked except clause * Fix exception handling when testing for compiler flags * Fix linter warnings * Fix typo --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent f26198a commit f2a2c21

File tree

9 files changed

+92
-70
lines changed

9 files changed

+92
-70
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,22 @@ on:
1212
- develop
1313
- v*
1414

15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: true
18+
1519
jobs:
1620
standard:
1721
strategy:
1822
fail-fast: false
1923
matrix:
2024
runs-on: [ubuntu-latest, windows-latest, macos-latest]
2125
python:
22-
- 3.7
2326
- 3.8
2427
- 3.9
2528
- '3.10'
29+
- '3.11'
30+
- '3.12'
2631

2732
name: "Python ${{ matrix.python }} • ${{ matrix.runs-on }} • x64 ${{ matrix.args }}"
2833
runs-on: ${{ matrix.runs-on }}
@@ -46,6 +51,10 @@ jobs:
4651
setup.cfg
4752
pyproject.toml
4853
54+
- name: Prepare env
55+
run: |
56+
python -m pip install -U "setuptools>=61.0.0"
57+
4958
- name: Generate requirement file (Unix)
5059
if: runner.os != 'Windows'
5160
run: |
@@ -106,9 +115,7 @@ jobs:
106115
fail-fast: false
107116
matrix:
108117
clang:
109-
- 3.5 # version for full C++14 support (3.4 fails because of -fstack-protector-strong)
110-
- 5 # earliest version for reasonable C++17 support
111-
- 10 # version for full C++17 support (with patches)
118+
- 11
112119
- latest
113120
env:
114121
CC: clang
@@ -168,7 +175,7 @@ jobs:
168175
fail-fast: false
169176
matrix:
170177
gcc:
171-
- 7 # C++17 earliest version
178+
- 9
172179
- latest
173180

174181
name: "Python 3 • GCC ${{ matrix.gcc }} • x64"

.github/workflows/draft_release.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
name: "Draft new release"
44

5-
on:
5+
on: # yamllint disable-line rule:truthy
66
workflow_dispatch:
77
inputs:
88
tag:
@@ -18,6 +18,13 @@ jobs:
1818

1919
- uses: actions/checkout@v3
2020

21+
- name: Setup Python
22+
uses: actions/setup-python@v3
23+
with:
24+
python-version: '3.11'
25+
cache: 'pip'
26+
cache-dependency-path: '**/setup.cfg'
27+
2128
- name: Configure git-flow
2229
run: |
2330
git fetch --tags --depth=1 origin master develop
@@ -26,16 +33,17 @@ jobs:
2633
- name: Create release branch
2734
run: git flow release start ${{ github.event.inputs.tag }}
2835

29-
- name: Update changelog
30-
uses: thomaseizinger/[email protected]
31-
with:
32-
version: ${{ github.event.inputs.tag }}
33-
3436
- name: Initialize mandatory git config
3537
run: |
3638
git config user.name "GitHub actions"
3739
git config user.email [email protected]
3840
41+
- name: Update CHANGELOG
42+
run: |
43+
python3 -m pip install mdformat-gfm 'git+https://github.com/Takishima/[email protected]'
44+
python3 -m keepachangelog release "${{ github.event.inputs.tag }}"
45+
python3 -m mdformat CHANGELOG.md
46+
3947
- name: Commit changelog and manifest files
4048
id: make-commit
4149
run: |

.github/workflows/format.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ on:
1212
- stable
1313
- "v*"
1414

15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: true
18+
19+
1520
jobs:
1621
clang-tidy:
1722
name: Clang-Tidy
@@ -29,8 +34,8 @@ jobs:
2934
apt-get update && apt-get install -y python3-dev python3-pip python3-setuptools python3-wheel
3035
--no-install-recommends
3136
32-
- name: Upgrade pybind11
33-
run: python3 -m pip install --upgrade pybind11 --prefer-binary
37+
- name: Upgrade pybind11 and setuptools
38+
run: python3 -m pip install --upgrade pybind11 "setuptools>=61.0.0" --prefer-binary
3439

3540
- name: Run clang-tidy
3641
run: python3 setup.py clang_tidy --warning-as-errors

.github/workflows/publish_release.yml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,9 @@ jobs:
5959
&& startsWith(github.event.pull_request.head.ref, 'release/')
6060
&& runner.os != 'Windows'
6161
run: |
62-
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
63-
VERSION=${BRANCH_NAME#release/}
64-
echo "VERSION = ${VERSION}"
65-
git tag ${VERSION} master
62+
TAG_NAME="${GITHUB_REF/refs\/tags\//}"
63+
VERSION=${TAG_NAME#v}
64+
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
6665
6766
- name: Extract version from branch name (for hotfix branches) (Unix)
6867
if: >
@@ -71,9 +70,8 @@ jobs:
7170
&& runner.os != 'Windows'
7271
run: |
7372
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
74-
VERSION=${BRANCH_NAME#hotfix/}
75-
echo "VERSION = ${VERSION}"
76-
git tag ${VERSION} master
73+
VERSION=${BRANCH_NAME#release/v}
74+
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
7775
7876
# ------------------------------------------------------------------------
7977

@@ -84,9 +82,8 @@ jobs:
8482
&& runner.os == 'Windows'
8583
run: |
8684
$BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
87-
$VERSION = $BRANCH_NAME -replace "release/",""
88-
Write-Output "VERSION = ${VERSION}"
89-
git tag ${VERSION} master
85+
$VERSION = $BRANCH_NAME -replace "release/v",""
86+
Write-Output "VERSION = ${VERSION}" >> $Env:GITHUB_ENV
9087
9188
- name: Extract version from branch name (for hotfix branches) (Windows)
9289
if: >
@@ -96,8 +93,7 @@ jobs:
9693
run: |
9794
$BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
9895
$VERSION = $BRANCH_NAME -replace "hotfix/",""
99-
Write-Output "VERSION = ${VERSION}"
100-
git tag ${VERSION} master
96+
Write-Output "VERSION = ${VERSION}" >> $Env:GITHUB_ENV
10197
10298
# ========================================================================
10399

CHANGELOG.md

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

1616
- Fixed some typos (thanks to @eltociear, @Darkdragon84)
17+
- Fixed support for Python 3.12
18+
19+
### Removed
20+
21+
- Support for Python 3.7
1722

1823
### Repository
1924

docs/tutorials.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ Detailed instructions and OS-specific hints
132132
**Windows**:
133133

134134
It is easiest to install a pre-compiled version of Python, including numpy and many more useful packages. One way to
135-
do so is using, e.g., the Python 3.7 installers from `python.org <https://www.python.org/downloads>`_ or `ANACONDA
135+
do so is using, e.g., the Python 3.8 installers from `python.org <https://www.python.org/downloads>`_ or `ANACONDA
136136
<https://www.continuum.io/downloads>`_. Installing ProjectQ right away will succeed for the (slow) Python
137137
simulator. For a compiled version of the simulator, install the Visual C++ Build Tools and the Microsoft Windows SDK
138138
prior to doing a pip install. The built simulator will not support multi-threading due to the limited OpenMP support
@@ -220,23 +220,23 @@ Detailed instructions and OS-specific hints
220220
Visit `macports.org <https://www.macports.org/install.php>`_ and install the latest version that corresponds to your
221221
operating system's version. Afterwards, open a new terminal window.
222222

223-
Then, use macports to install Python 3.7 by entering the following command
223+
Then, use macports to install Python 3.8 by entering the following command
224224

225225
.. code-block:: bash
226226
227-
sudo port install python37
227+
sudo port install python38
228228
229229
It might show a warning that if you intend to use python from the terminal. In this case, you should also install
230230

231231
.. code-block:: bash
232232
233-
sudo port install py37-gnureadline
233+
sudo port install py38-gnureadline
234234
235235
Install pip by
236236

237237
.. code-block:: bash
238238
239-
sudo port install py37-pip
239+
sudo port install py38-pip
240240
241241
Next, we can install ProjectQ with the high performance simulator written in C++. First, we will need to install a
242242
suitable compiler with support for **C++11**, OpenMP, and intrinsics. The best option is to install clang 9.0 also
@@ -250,7 +250,7 @@ Detailed instructions and OS-specific hints
250250

251251
.. code-block:: bash
252252
253-
env CC=clang-mp-9.0 env CXX=clang++-mp-9.0 /opt/local/bin/python3.7 -m pip install --user projectq
253+
env CC=clang-mp-9.0 env CXX=clang++-mp-9.0 /opt/local/bin/python3.8 -m pip install --user projectq
254254
255255
256256
The ProjectQ syntax

projectq/backends/_sim/_pysim.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import numpy as _np
2525

2626
_USE_REFCHECK = True
27-
if 'TRAVIS' in os.environ: # pragma: no cover
27+
if 'CI' in os.environ: # pragma: no cover
2828
_USE_REFCHECK = False
2929

3030

pyproject.toml

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
[build-system]
22
requires = [
3-
'setuptools>=61;python_version>="3.7"',
4-
'setuptools>=59;python_version<"3.7"',
3+
'setuptools>=61',
54
'wheel',
65
'pybind11>=2',
7-
'setuptools_scm[toml]>6;python_version>="3.7"'
6+
'setuptools_scm[toml]>6'
87
]
98
build-backend = "setuptools.build_meta"
109

@@ -14,26 +13,27 @@ authors = [
1413
{name = 'ProjectQ', email = '[email protected]'}
1514
]
1615
description = 'ProjectQ - An open source software framework for quantum computing'
17-
requires-python = '>= 3.7'
16+
requires-python = '>= 3.8'
1817
license = {text= 'Apache License Version 2.0'}
1918
readme = 'README.rst'
2019
classifiers = [
2120
'License :: OSI Approved :: Apache Software License',
2221
'Topic :: Software Development :: Libraries :: Python Modules',
2322
'Programming Language :: Python :: 3 :: Only',
24-
'Programming Language :: Python :: 3.7',
2523
'Programming Language :: Python :: 3.8',
2624
'Programming Language :: Python :: 3.9',
27-
'Programming Language :: Python :: 3.10'
25+
'Programming Language :: Python :: 3.10',
26+
'Programming Language :: Python :: 3.11',
27+
'Programming Language :: Python :: 3.12'
2828
]
2929
dynamic = ["version"]
3030

3131
dependencies = [
3232
'matplotlib >= 2.2.3',
33-
'networkx >= 2',
34-
'numpy',
35-
'requests',
36-
'scipy'
33+
'networkx >= 2.4',
34+
'numpy>=1.21.5',
35+
'requests>=2.25.1',
36+
'scipy>=1.8.0'
3737
]
3838

3939
[project.urls]
@@ -57,15 +57,15 @@ revkit = [
5757
]
5858

5959
test = [
60-
'flaky',
60+
'flaky>=3.7.0',
6161
'mock',
6262
'pytest >= 6.0',
6363
'pytest-cov',
6464
'pytest-mock'
6565
]
6666

6767
docs = [
68-
'sphinx',
68+
'sphinx>=4.3.2',
6969
'sphinx_rtd_theme'
7070
]
7171

@@ -74,7 +74,7 @@ docs = [
7474
[tool.black]
7575

7676
line-length = 120
77-
target-version = ['py37','py38','py39','py310']
77+
target-version = ['py38','py39','py310','py311','py312']
7878
skip-string-normalization = true
7979

8080

@@ -205,11 +205,3 @@ test-command = 'python {package}/examples/grover.py'
205205

206206
# Normal options, etc.
207207
manylinux-x86_64-image = 'manylinux2014'
208-
209-
[[tool.cibuildwheel.overrides]]
210-
select = 'cp36-*'
211-
manylinux-x86_64-image = 'manylinux1'
212-
213-
[[tool.cibuildwheel.overrides]]
214-
select = 'cp3{7,8,9}-*'
215-
manylinux-x86_64-image = 'manylinux2010'

0 commit comments

Comments
 (0)