Skip to content

Commit f3d551f

Browse files
authored
📝 update upgrading guide for new stub generation flow (#289)
Revised the `UPGRADING.md` to reflect changes in the stub generation process. Added new commands and steps for improved clarity and streamlined execution. Signed-off-by: burgholzer <[email protected]>
1 parent 2acb397 commit f3d551f

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

UPGRADING.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,19 @@ def stubs(session: nox.Session) -> None:
2323
session.run(
2424
"uv",
2525
"sync",
26+
"--no-dev",
27+
"--group",
28+
"build",
2629
env=env,
2730
)
2831

29-
from nanobind.stubgen import main as nanobind_main # type: ignore[import-not-found]
30-
3132
package_root = Path(__file__).parent / "python" / "mqt" / "core"
3233
pattern_file = Path(__file__).parent / "bindings" / "core_patterns.txt"
3334

34-
args = [
35+
session.run(
36+
"python",
37+
"-m",
38+
"nanobind.stubgen",
3539
"--recursive",
3640
"--include-private",
3741
"--output-dir",
@@ -46,19 +50,20 @@ def stubs(session: nox.Session) -> None:
4650
"mqt.core.fomac",
4751
"--module",
4852
"mqt.core.na",
49-
]
50-
51-
nanobind_main(args)
53+
)
5254

5355
pyi_files = list(package_root.glob("**/*.pyi"))
5456

5557
if shutil.which("prek") is None:
5658
session.install("prek")
5759

60+
# Allow both 0 (no issues) and 1 as success codes for fixing up stubs.
5861
success_codes = [0, 1]
5962
session.run("prek", "run", "license-tools", "--files", *pyi_files, external=True, success_codes=success_codes)
6063
session.run("prek", "run", "ruff-check", "--files", *pyi_files, external=True, success_codes=success_codes)
6164
session.run("prek", "run", "ruff-format", "--files", *pyi_files, external=True, success_codes=success_codes)
65+
66+
# Finally, run ruff-check again to ensure everything is clean.
6267
session.run("prek", "run", "ruff-check", "--files", *pyi_files, external=True)
6368
```
6469

0 commit comments

Comments
 (0)