44
55This is ** qpdk** , a Python-based superconducting microwave Process Design Kit (PDK) built on
66[ gdsfactory] ( https://gdsfactory.github.io/gdsfactory/ ) for designing quantum devices and circuits (transmons,
7- resonators, couplers, airbridges, SNSPDs, etc.). It targets Python 3.12–3.13, uses ` uv ` as the package manager, and
8- ` just ` as the task runner.
7+ resonators, couplers, airbridges, SNSPDs, fluxoniums, unimons, etc.). It targets Python 3.12–3.13, uses ` uv ` as the
8+ package manager, ` just ` as the task runner, and ` prek ` (a parallel pre-commit runner) for linting .
99
1010## Build, Test, and Lint Commands
1111
12- All commands use the ` justfile ` . Always prefer ` just ` commands over direct tool invocation.
13-
14- | Task | Command |
15- | ------------------------------------ | --------------------- |
16- | Install dependencies | ` just install ` |
17- | Run full test suite | ` just test ` |
18- | Run GDS regression tests only | ` just test-gds ` |
19- | Regenerate GDS reference files | ` just test-gds-force ` |
20- | Run pre-commit hooks (lint + format) | ` just run-pre ` |
21- | Build documentation (HTML + PDF) | ` just docs ` |
22- | Build package | ` just build ` |
12+ All commands use the ` justfile ` (with imports from ` tests/test.just ` and ` docs/docs.just ` ). Always prefer ` just `
13+ commands over direct tool invocation.
14+
15+ | Task | Command |
16+ | ---------------------------------------- | ------------------------- |
17+ | Install dependencies | ` just install ` |
18+ | Run full test suite | ` just test ` |
19+ | Run GDS regression tests only | ` just test-gds ` |
20+ | Run GDS tests, stop at first failure | ` just test-gds-fail-fast ` |
21+ | Regenerate GDS reference files | ` just test-gds-force ` |
22+ | Run model regression tests | ` just test-models ` |
23+ | Regenerate model reference files | ` just test-models-force ` |
24+ | Run HFSS simulation tests | ` just test-hfss ` |
25+ | Run GDSFactory+ tests | ` just test-gfp ` |
26+ | Run pre-commit hooks (lint + format) | ` just run-pre ` |
27+ | Build HTML documentation | ` just docs ` |
28+ | Build PDF documentation | ` just docs-pdf ` |
29+ | Build package | ` just build ` |
30+ | Show/preview a component interactively | ` just show ` |
31+ | Run everything (test, lint, build, docs) | ` just all ` |
2332
2433Pre-commit hooks ** must** pass before every commit. They include ` ruff ` (format + lint), ` pyrefly ` (type checking),
25- ` yamlfmt ` , ` codespell ` , ` interrogate ` (docstring coverage), ` markdownlint ` , ` actionlint ` , and more. Run with
26- ` just run-pre ` or ` uvx prek run --all-files ` .
34+ ` yamlfmt ` , ` yamllint ` , ` codespell ` , ` interrogate ` (docstring coverage), ` markdownlint ` , ` mdformat ` , ` actionlint ` ,
35+ ` zizmor ` (GitHub Actions security), ` hadolint ` (Dockerfile), ` checkmake ` (Makefile), ` bibtex-tidy ` , ` sphinx-lint ` ,
36+ ` lychee ` (link checking), ` uv-lock ` , ` pdk-ci-workflow ` structural checks, and more. Run with ` just run-pre ` or
37+ ` uvx prek run --all-files ` .
2738
2839## Project Layout
2940
3041``` text
3142qpdk/ Core Python package
43+ __init__.py PDK object, version, public API
3244 cells/ Component definitions (transmons, resonators, …)
3345 __init__.py Aggregates all cells via `from ... import *`
46+ derived/ Composite/derived cells (e.g., transmon_with_resonator_and_probeline)
3447 models/ S-parameter and circuit models
3548 constants.py Centralized physical constants (e, h, Φ_0, ε_0, …)
49+ math.py Mathematical utilities for models
50+ perturbation.py Perturbation theory models
51+ qubit.py Qubit Hamiltonian and frequency models
52+ simulation/ HFSS/Q3D simulation automation (aedt_base, hfss, q3d)
3653 klayout/ KLayout technology files
54+ config.py Path configuration (PATH dataclass)
55+ helper.py Helper utilities
56+ utils.py General utility functions
3757 tech.py Layer stack, cross sections, LAYER enum
3858 layers.yaml Layer definitions (must stay in sync with tech.py)
3959 logger.py Centralized loguru logger
40- samples/ Example layout and simulation scripts
60+ samples/ Example layout and simulation scripts (.py, .pic.yml, .scm.yml)
4161tests/ pytest test suite
4262 gds_ref/ GDS regression reference files
4363 models/ Model unit tests
64+ test_models_regression/ Model regression reference data
65+ helper/ Test helper utilities
4466 test_pdk.py Component regression + netlist round-trip tests
67+ test.just Test-related just recipes
4568docs/ Sphinx documentation source
46- notebooks/src/ Jupytext notebook sources (.py percent format)
69+ docs.just Documentation-related just recipes
70+ notebooks/src/ Jupytext notebook sources (.py percent format, .m for MATLAB)
4771pyproject.toml Project metadata, dependency specs, ruff/pyrefly/pytest config
48- justfile Task runner recipes
72+ justfile Task runner recipes (imports test.just and docs.just)
4973.pre-commit-config.yaml Pre-commit hook definitions
5074.github/workflows/ CI pipelines (test, docs, build, release)
75+ .changelog.d/ Towncrier changelog fragments
5176```
5277
5378## Review Checklist — What to Verify on Every PR
@@ -64,8 +89,9 @@ justfile Task runner recipes
6489 library code.
6590- Unicode math identifiers (Φ, ε, μ, π) are acceptable — the relevant ruff rules are suppressed.
6691- Type hints are expected. ` pyrefly ` runs in pre-commit. Verify new code is typed.
67- - Optional heavy dependencies (sax, scqubits, jaxellip, polars, etc.) must be ** lazily imported** — ruff's
68- ` require-lazy ` is configured for them in ` pyproject.toml ` .
92+ - Optional heavy dependencies (sax, scqubits, jaxellip, polars, netket, flax, pymablock, qutip-jax, qutip-qip, optax,
93+ optuna, sympy, pandas, trimesh, gplugins, pyaedt) must be ** lazily imported** — ruff's ` require-lazy ` is configured
94+ for them in ` pyproject.toml ` .
6995
7096### Component (Cell) Changes
7197
@@ -85,24 +111,31 @@ justfile Task runner recipes
85111- Physical constants ** must** come from ` qpdk/models/constants.py ` — verify no local redefinitions of ` e ` , ` h ` , ` Φ_0 ` ,
86112 ` ε_0 ` , etc.
87113- New models need unit tests in ` tests/models/ ` verifying behavior, passivity, and reciprocity.
114+ - HFSS/Q3D simulation automation lives in ` qpdk/simulation/ ` — changes there should be tested with ` just test-hfss ` when
115+ HFSS is available.
88116
89117### Testing
90118
91119- New components must have ** GDS regression tests** (settings + netlists). Reference files are generated with
92120 ` just test-gds-force ` and committed in ` tests/gds_ref/ ` .
121+ - New models must have ** model regression tests** . Reference files are generated with ` just test-models-force ` and
122+ committed in ` tests/test_models_regression/ ` .
93123- Prefer the ** hypothesis** library for property-based tests. When using it:
94124 - Do ** not** combine ` @given ` with ` @staticmethod ` (causes ` AttributeError ` during collection).
95125 - Add ` @settings(deadline=None) ` when testing JAX JIT-compiled code.
96126- The full test suite runs across Python 3.12–3.13 on Ubuntu, macOS, and Windows. Verify no platform-specific
97127 assumptions.
98128- If GDS reference files changed, verify the diff is intentional and corresponds to the code change.
129+ - Tests run in parallel using ` pytest-xdist ` (` -n auto ` ). Verify no test interdependencies.
99130
100131### Documentation
101132
102133- Docstrings should explain the underlying quantum physics and design parameters, with citations where appropriate.
103134- Bibliography entries in ` docs/bibliography.bib ` : if a ` doi ` field is present, do ** not** include ` url ` or ` urldate ` .
104- - Notebooks live in ` notebooks/src/ ` as jupytext ` .py ` (percent format) files. When adding or removing notebooks, update
105- ` docs/notebooks.rst ` .
135+ - Notebooks live in ` notebooks/src/ ` as jupytext ` .py ` (percent format) or ` .m ` (MATLAB) files. When adding or removing
136+ notebooks, update ` docs/notebooks.rst ` .
137+ - Notebooks requiring external tools (HFSS, MATLAB) should be listed in ` nb_execution_excludepatterns ` in ` docs/conf.py `
138+ and committed as pre-executed ` .ipynb ` files in ` notebooks/ ` .
106139- Documentation must build successfully (` just docs ` ) for a PR to be mergeable.
107140
108141### Git and CI
@@ -111,10 +144,13 @@ justfile Task runner recipes
111144 new binary or large data files are handled correctly.
112145- Commit messages use ** imperative mood** (e.g., "Add component", not "Added component").
113146- All CI checks must pass: pre-commit hooks, the full pytest suite, and the documentation build.
147+ - ** Changelog** : Use [ towncrier] ( https://towncrier.readthedocs.io/ ) fragments in ` .changelog.d/ ` for user-facing
148+ changes. Fragment filenames follow the pattern ` <issue_or_pr>.<type>.md ` .
114149
115150### Security and Supply Chain
116151
117152- No private keys or sensitive fabrication parameters committed (the ` detect-private-key ` pre-commit hook helps, but
118153 reviewers should also verify).
119154- New dependencies should be justified. Check for known vulnerabilities and verify they are pinned appropriately in
120155 ` pyproject.toml ` .
156+ - GitHub Actions workflows are checked by ` actionlint ` and ` zizmor ` for security best practices.
0 commit comments