Skip to content

Commit bb0f70c

Browse files
authored
🔧 Modernize DX and configuration (#527)
1 parent da89199 commit bb0f70c

File tree

4 files changed

+143
-65
lines changed

4 files changed

+143
-65
lines changed

.pre-commit-config.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@ repos:
1919
rev: v6.0.0
2020
hooks:
2121
- id: check-added-large-files
22+
args: ["--maxkb=2048"]
2223
- id: check-case-conflict
23-
- id: check-docstring-first
24+
- id: check-vcs-permalinks
2425
- id: check-merge-conflict
26+
- id: check-symlinks
27+
- id: check-json
2528
- id: check-toml
2629
- id: check-yaml
2730
- id: debug-statements
@@ -55,12 +58,17 @@ repos:
5558
- id: rst-directive-colons
5659
- id: rst-inline-touching-normal
5760

61+
# Ensure uv lock file is up-to-date
62+
- repo: https://github.com/astral-sh/uv-pre-commit
63+
rev: 0.9.11
64+
hooks:
65+
- id: uv-lock
66+
5867
# Python linting and formatting using ruff
5968
- repo: https://github.com/astral-sh/ruff-pre-commit
6069
rev: v0.14.6
6170
hooks:
6271
- id: ruff-check
63-
args: ["--fix", "--show-fixes"]
6472
- id: ruff-format
6573

6674
# Also run Black on examples in the documentation

noxfile.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ def preserve_lockfile() -> Generator[None]:
5454
@nox.session(reuse_venv=True, default=True)
5555
def lint(session: nox.Session) -> None:
5656
"""Run the linter."""
57-
if shutil.which("pre-commit") is None:
58-
session.install("pre-commit")
57+
if shutil.which("prek") is None:
58+
session.install("prek")
5959

60-
session.run("pre-commit", "run", "--all-files", *session.posargs, external=True)
60+
session.run("prek", "run", "--all-files", *session.posargs, external=True)
6161

6262

6363
def _run_tests(

pyproject.toml

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -50,42 +50,42 @@ dependencies = [
5050
classifiers = [
5151
"Development Status :: 4 - Beta",
5252
"Intended Audience :: Developers",
53-
"Operating System :: Microsoft :: Windows",
53+
"Intended Audience :: Science/Research",
54+
"Natural Language :: English",
5455
"Operating System :: MacOS",
56+
"Operating System :: Microsoft :: Windows",
5557
"Operating System :: POSIX :: Linux",
58+
"Programming Language :: Python",
5659
"Programming Language :: Python :: 3 :: Only",
5760
"Programming Language :: Python :: 3.10",
5861
"Programming Language :: Python :: 3.11",
5962
"Programming Language :: Python :: 3.12",
6063
"Programming Language :: Python :: 3.13",
61-
"Programming Language :: Python :: 3.14",
62-
"Intended Audience :: Science/Research",
63-
"Natural Language :: English",
6464
"Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)",
65+
"Typing :: Typed",
6566
]
6667

6768
[dependency-groups]
6869
test = [
69-
"pytest>=8.4.1",
70-
"pytest-cov>=6.2.1",
70+
"pytest>=9.0.1",
71+
"pytest-cov>=7.0.0",
7172
]
7273
docs = [
73-
"furo>=2024.8.6",
74-
"myst-nb>=1.2.0",
75-
"setuptools-scm>=8.3.1",
76-
"sphinx-design>=0.6.1",
74+
"furo>=2025.09.25",
75+
"myst-nb>=1.3.0",
76+
"setuptools-scm>=9.2.2",
77+
"sphinx>=8.1.3",
78+
"sphinx>=8.2.3; python_version >= '3.11'",
7779
"sphinx-autoapi>=3.6.0",
7880
"sphinx-copybutton>=0.5.2",
81+
"sphinx-design>=0.6.1",
7982
"sphinxcontrib-bibtex>=2.6.5",
8083
"sphinxcontrib-svg2pdfconverter>=1.3.0",
81-
"sphinxext-opengraph>=0.10.0",
82-
"sphinx>=7.4.7",
83-
"sphinx>=8.1.3; python_version >= '3.10'",
84-
"sphinx>=8.2.3; python_version >= '3.11'",
84+
"sphinxext-opengraph>=0.13.0",
8585
]
8686
dev = [
87-
{include-group = "test"},
88-
{include-group = "docs"},
87+
{include-group = "test"},
88+
"nox>=2025.11.12",
8989
]
9090

9191
[project.urls]
@@ -104,17 +104,15 @@ source = "vcs"
104104
version-file = "src/mqt/predictor/_version.py"
105105

106106

107-
[tool.pytest.ini_options]
108-
minversion = "7.2"
109-
testpaths = ["tests/"]
107+
[tool.pytest]
108+
minversion = "9.0"
109+
testpaths = ["tests"]
110+
strict = true
110111
addopts = [
111112
"-ra",
112-
"--strict-markers",
113-
"--strict-config",
114113
"--showlocals",
115114
]
116115
log_level = "INFO"
117-
xfail_strict = true
118116
filterwarnings = [
119117
'error',
120118
'ignore:.*pytorch.*:UserWarning:',
@@ -128,6 +126,7 @@ filterwarnings = [
128126
'ignore:.*The property ``qiskit.circuit.instruction.Instruction.*`` is deprecated as of qiskit 1.3.0.*:DeprecationWarning:',
129127
]
130128

129+
131130
[tool.coverage]
132131
run.source = ["mqt.predictor"]
133132
report.exclude_also = [
@@ -139,11 +138,11 @@ report.exclude_also = [
139138
run.disable_warnings = [
140139
"no-sysmon",
141140
]
142-
143141
show_missing = true
144142
skip_empty = true
145143
precision = 1
146144

145+
147146
[tool.mypy]
148147
mypy_path = "$MYPY_CONFIG_FILE_DIR/src"
149148
files = ["src", "tests"]
@@ -166,19 +165,25 @@ implicit_reexport = true
166165
module = ["qiskit.*", "joblib.*", "sklearn.*", "matplotlib.*", "gymnasium.*", "mqt.bench.*", "sb3_contrib.*", "bqskit.*", "qiskit_ibm_runtime.*", "networkx.*", "stable_baselines3.*"]
167166
ignore_missing_imports = true
168167

168+
169169
[tool.ruff]
170170
line-length = 120
171-
extend-include = ["*.ipynb"]
171+
namespace-packages = ["mqt"]
172172
preview = true
173+
fix = true
173174
unsafe-fixes = true
175+
show-fixes = true
176+
177+
[tool.ruff.format]
178+
docstring-code-format = true
174179

175180
[tool.ruff.lint]
176181
extend-select = [
177182
"A", # flake8-builtins
178183
"ANN", # flake8-annotations
179184
"ARG", # flake8-unused-arguments
180185
"ASYNC", # flake8-async
181-
"B", "B904", # flake8-bugbear
186+
"B", # flake8-bugbear
182187
"C4", # flake8-comprehensions
183188
"D", # pydocstyle
184189
"EM", # flake8-errmsg
@@ -213,9 +218,8 @@ extend-select = [
213218
"YTT", # flake8-2020
214219
]
215220
ignore = [
216-
"ISC001", # Conflicts with formatter
217221
"E501", # Line too long (Black is enough)
218-
"PLR", # Design related pylint codes
222+
"PLR", # Design-related pylint codes
219223
"S101", # Use of assert detected
220224
]
221225
flake8-unused-arguments.ignore-variadic-names = true
@@ -242,12 +246,14 @@ default.extend-ignore-re = [
242246
"(?Rm)^.*(#|//)\\s*spellchecker:disable-line$", # ignore line
243247
"(?s)(#|//)\\s*spellchecker:off.*?\\n\\s*(#|//)\\s*spellchecker:on" # ignore block
244248
]
249+
245250
[tool.typos.default.extend-words]
246251
wille = "wille"
247252
anc = "anc"
248253
aer = "aer"
249254
fom = "fom"
250255

256+
251257
[tool.repo-review]
252258
ignore = [
253259
"GH200",

0 commit comments

Comments
 (0)