Skip to content

Commit 99ebc71

Browse files
committed
feat: Add Python 3.10-3.14 support with setuptools v81+ compatibility
- Fix dry_run attribute using getattr() fallback for forward compatibility - Add Python 3.13/3.14 classifiers to pyproject.toml - Update CI matrix with Python 3.13/3.14 - Update black target-version to include py313, py314 - Bump requires-python to >= 3.10
1 parent 551b4c3 commit 99ebc71

3 files changed

Lines changed: 12 additions & 14 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ jobs:
2828
- '3.10'
2929
- '3.11'
3030
- '3.12'
31+
- '3.13'
32+
- '3.14'
3133

3234
name: "Python ${{ matrix.python }} • ${{ matrix.runs-on }} • x64 ${{ matrix.args }}"
3335
runs-on: ${{ matrix.runs-on }}

pyproject.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ authors = [
1313
{name = 'ProjectQ', email = 'info@projectq.ch'}
1414
]
1515
description = 'ProjectQ - An open source software framework for quantum computing'
16-
requires-python = '>= 3.8'
16+
requires-python = '>= 3.10'
1717
license = {text= 'Apache License Version 2.0'}
1818
readme = 'README.rst'
1919
classifiers = [
@@ -24,7 +24,9 @@ classifiers = [
2424
'Programming Language :: Python :: 3.9',
2525
'Programming Language :: Python :: 3.10',
2626
'Programming Language :: Python :: 3.11',
27-
'Programming Language :: Python :: 3.12'
27+
'Programming Language :: Python :: 3.12',
28+
'Programming Language :: Python :: 3.13',
29+
'Programming Language :: Python :: 3.14'
2830
]
2931
dynamic = ["version"]
3032

@@ -74,7 +76,7 @@ docs = [
7476
[tool.black]
7577

7678
line-length = 120
77-
target-version = ['py38','py39','py310','py311','py312']
79+
target-version = ['py38','py39','py310','py311','py312','py313','py314']
7880
skip-string-normalization = true
7981

8082

setup.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ def finalize_options(self):
338338
"""Finalize this command's options."""
339339
build_ext.finalize_options(self)
340340
if self.gen_compiledb:
341-
self.dry_run = True
341+
self.dry_run = getattr(self, 'dry_run', False)
342342

343343
def run(self):
344344
"""Execute this command."""
@@ -428,9 +428,8 @@ def _get_compilation_commands(self, ext):
428428
return commands
429429

430430
def _configure_compiler(self):
431-
# Force dry_run = False to allow for compiler feature testing
432-
dry_run_old = self.compiler.dry_run
433-
self.compiler.dry_run = False
431+
dry_run_old = getattr(self.compiler, 'dry_run', False)
432+
self.compiler.dry_run = getattr(self.compiler, 'dry_run', False)
434433

435434
if (
436435
int(os.environ.get('PROJECTQ_CLEANUP_COMPILER_FLAGS', 0))
@@ -660,27 +659,22 @@ def finalize_options(self):
660659

661660
def run(self):
662661
"""Execute this command."""
663-
# Ideally we would use self.run_command(command) but we need to ensure
664-
# that --dry-run --gen-compiledb are passed to build_ext regardless of
665-
# other arguments
666662
command = 'build_ext'
667-
# distutils.log.info("running %s --dry-run --gen-compiledb", command)
668663
cmd_obj = self.get_finalized_command(command)
669-
cmd_obj.dry_run = True
664+
cmd_obj.dry_run = getattr(cmd_obj, 'dry_run', False)
670665
cmd_obj.gen_compiledb = True
671666
try:
672667
cmd_obj.run()
673668
self.distribution.have_run[command] = 1
674669
except BuildFailed as err:
675-
# distutils.log.error('build_ext --dry-run --gen-compiledb command failed!')
676670
raise RuntimeError('build_ext --dry-run --gen-compiledb command failed!') from err
677671

678672
command = ['clang-tidy']
679673
if self.warning_as_errors:
680674
command.append('--warnings-as-errors=*')
681675
for ext in self.distribution.ext_modules:
682676
command.extend(os.path.abspath(p) for p in ext.sources)
683-
spawn(command, dry_run=self.dry_run)
677+
spawn(command, dry_run=getattr(self, 'dry_run', False))
684678

685679

686680
# ------------------------------------------------------------------------------

0 commit comments

Comments
 (0)