Skip to content

Commit

Permalink
Remove Python 3.7 + add Python 3.11 + 3.12 (#471)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
Takishima and pre-commit-ci[bot] authored Apr 23, 2024
1 parent f26198a commit f2a2c21
Show file tree
Hide file tree
Showing 9 changed files with 92 additions and 70 deletions.
17 changes: 12 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,22 @@ on:
- develop
- v*

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
standard:
strategy:
fail-fast: false
matrix:
runs-on: [ubuntu-latest, windows-latest, macos-latest]
python:
- 3.7
- 3.8
- 3.9
- '3.10'
- '3.11'
- '3.12'

name: "Python ${{ matrix.python }} • ${{ matrix.runs-on }} • x64 ${{ matrix.args }}"
runs-on: ${{ matrix.runs-on }}
Expand All @@ -46,6 +51,10 @@ jobs:
setup.cfg
pyproject.toml
- name: Prepare env
run: |
python -m pip install -U "setuptools>=61.0.0"
- name: Generate requirement file (Unix)
if: runner.os != 'Windows'
run: |
Expand Down Expand Up @@ -106,9 +115,7 @@ jobs:
fail-fast: false
matrix:
clang:
- 3.5 # version for full C++14 support (3.4 fails because of -fstack-protector-strong)
- 5 # earliest version for reasonable C++17 support
- 10 # version for full C++17 support (with patches)
- 11
- latest
env:
CC: clang
Expand Down Expand Up @@ -168,7 +175,7 @@ jobs:
fail-fast: false
matrix:
gcc:
- 7 # C++17 earliest version
- 9
- latest

name: "Python 3 • GCC ${{ matrix.gcc }} • x64"
Expand Down
20 changes: 14 additions & 6 deletions .github/workflows/draft_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

name: "Draft new release"

on:
on: # yamllint disable-line rule:truthy
workflow_dispatch:
inputs:
tag:
Expand All @@ -18,6 +18,13 @@ jobs:

- uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v3
with:
python-version: '3.11'
cache: 'pip'
cache-dependency-path: '**/setup.cfg'

- name: Configure git-flow
run: |
git fetch --tags --depth=1 origin master develop
Expand All @@ -26,16 +33,17 @@ jobs:
- name: Create release branch
run: git flow release start ${{ github.event.inputs.tag }}

- name: Update changelog
uses: thomaseizinger/keep-a-changelog-new-release@1.3.0
with:
version: ${{ github.event.inputs.tag }}

- name: Initialize mandatory git config
run: |
git config user.name "GitHub actions"
git config user.email noreply@github.com
- name: Update CHANGELOG
run: |
python3 -m pip install mdformat-gfm 'git+https://github.com/Takishima/keepachangelog@v1.0.1'
python3 -m keepachangelog release "${{ github.event.inputs.tag }}"
python3 -m mdformat CHANGELOG.md
- name: Commit changelog and manifest files
id: make-commit
run: |
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ on:
- stable
- "v*"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true


jobs:
clang-tidy:
name: Clang-Tidy
Expand All @@ -29,8 +34,8 @@ jobs:
apt-get update && apt-get install -y python3-dev python3-pip python3-setuptools python3-wheel
--no-install-recommends
- name: Upgrade pybind11
run: python3 -m pip install --upgrade pybind11 --prefer-binary
- name: Upgrade pybind11 and setuptools
run: python3 -m pip install --upgrade pybind11 "setuptools>=61.0.0" --prefer-binary

- name: Run clang-tidy
run: python3 setup.py clang_tidy --warning-as-errors
20 changes: 8 additions & 12 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,9 @@ jobs:
&& startsWith(github.event.pull_request.head.ref, 'release/')
&& runner.os != 'Windows'
run: |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
VERSION=${BRANCH_NAME#release/}
echo "VERSION = ${VERSION}"
git tag ${VERSION} master
TAG_NAME="${GITHUB_REF/refs\/tags\//}"
VERSION=${TAG_NAME#v}
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
- name: Extract version from branch name (for hotfix branches) (Unix)
if: >
Expand All @@ -71,9 +70,8 @@ jobs:
&& runner.os != 'Windows'
run: |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
VERSION=${BRANCH_NAME#hotfix/}
echo "VERSION = ${VERSION}"
git tag ${VERSION} master
VERSION=${BRANCH_NAME#release/v}
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
# ------------------------------------------------------------------------

Expand All @@ -84,9 +82,8 @@ jobs:
&& runner.os == 'Windows'
run: |
$BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
$VERSION = $BRANCH_NAME -replace "release/",""
Write-Output "VERSION = ${VERSION}"
git tag ${VERSION} master
$VERSION = $BRANCH_NAME -replace "release/v",""
Write-Output "VERSION = ${VERSION}" >> $Env:GITHUB_ENV
- name: Extract version from branch name (for hotfix branches) (Windows)
if: >
Expand All @@ -96,8 +93,7 @@ jobs:
run: |
$BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
$VERSION = $BRANCH_NAME -replace "hotfix/",""
Write-Output "VERSION = ${VERSION}"
git tag ${VERSION} master
Write-Output "VERSION = ${VERSION}" >> $Env:GITHUB_ENV
# ========================================================================

Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- Fixed some typos (thanks to @eltociear, @Darkdragon84)
- Fixed support for Python 3.12

### Removed

- Support for Python 3.7

### Repository

Expand Down
12 changes: 6 additions & 6 deletions docs/tutorials.rst
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ Detailed instructions and OS-specific hints
**Windows**:

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

Then, use macports to install Python 3.7 by entering the following command
Then, use macports to install Python 3.8 by entering the following command

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

.. code-block:: bash
sudo port install py37-gnureadline
sudo port install py38-gnureadline
Install pip by

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

.. code-block:: bash
env CC=clang-mp-9.0 env CXX=clang++-mp-9.0 /opt/local/bin/python3.7 -m pip install --user projectq
env CC=clang-mp-9.0 env CXX=clang++-mp-9.0 /opt/local/bin/python3.8 -m pip install --user projectq
The ProjectQ syntax
Expand Down
2 changes: 1 addition & 1 deletion projectq/backends/_sim/_pysim.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import numpy as _np

_USE_REFCHECK = True
if 'TRAVIS' in os.environ: # pragma: no cover
if 'CI' in os.environ: # pragma: no cover
_USE_REFCHECK = False


Expand Down
34 changes: 13 additions & 21 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
[build-system]
requires = [
'setuptools>=61;python_version>="3.7"',
'setuptools>=59;python_version<"3.7"',
'setuptools>=61',
'wheel',
'pybind11>=2',
'setuptools_scm[toml]>6;python_version>="3.7"'
'setuptools_scm[toml]>6'
]
build-backend = "setuptools.build_meta"

Expand All @@ -14,26 +13,27 @@ authors = [
{name = 'ProjectQ', email = 'info@projectq.ch'}
]
description = 'ProjectQ - An open source software framework for quantum computing'
requires-python = '>= 3.7'
requires-python = '>= 3.8'
license = {text= 'Apache License Version 2.0'}
readme = 'README.rst'
classifiers = [
'License :: OSI Approved :: Apache Software License',
'Topic :: Software Development :: Libraries :: Python Modules',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10'
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12'
]
dynamic = ["version"]

dependencies = [
'matplotlib >= 2.2.3',
'networkx >= 2',
'numpy',
'requests',
'scipy'
'networkx >= 2.4',
'numpy>=1.21.5',
'requests>=2.25.1',
'scipy>=1.8.0'
]

[project.urls]
Expand All @@ -57,15 +57,15 @@ revkit = [
]

test = [
'flaky',
'flaky>=3.7.0',
'mock',
'pytest >= 6.0',
'pytest-cov',
'pytest-mock'
]

docs = [
'sphinx',
'sphinx>=4.3.2',
'sphinx_rtd_theme'
]

Expand All @@ -74,7 +74,7 @@ docs = [
[tool.black]

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


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

# Normal options, etc.
manylinux-x86_64-image = 'manylinux2014'

[[tool.cibuildwheel.overrides]]
select = 'cp36-*'
manylinux-x86_64-image = 'manylinux1'

[[tool.cibuildwheel.overrides]]
select = 'cp3{7,8,9}-*'
manylinux-x86_64-image = 'manylinux2010'
Loading

0 comments on commit f2a2c21

Please sign in to comment.