quantcore_circuits.kqc_files

KQCircuits files that the kqcircuits wheel on PyPI does not ship, taken from KQCircuits itself.

  • The simulation scripts: KQC’s export_ansys / export_elmer copy the scripts in kqcircuits.defaults.ANSYS_SCRIPT_PATHS / ELMER_SCRIPT_PATHS (and SIM_SCRIPT_PATH / "elmer_modules") into each job folder. They live in the KQCircuits repository (klayout_package/python/scripts), outside the package.

  • kqcircuits/util/font_polygons.oas: the font of KQC’s polygon labels (ChipFrame and the chips built on it).

A KQCircuits git checkout (editable install) or KQC’s KLayout Salt package has them. quantcore-circuits copies none of KQCircuits’ code: it uses KQCircuits’ own files, found in this order:

  1. KQC’s own location (a checkout, an editable install, KQC_ROOT_PATH);

  2. QCC_KQC_SCRIPTS: the klayout_package/python/scripts folder of a KQCircuits checkout (the font is read from the checkout’s klayout_package/python/kqcircuits beside it);

  3. the user cache that qcc kqc-files fills from the KQCircuits release of the installed version on GitHub (QCC_CACHE_DIR moves the cache).

ensure_kqc_scripts() (before an export) and ensure_kqc_data() (when the KQC libraries load) point KQC at the first one found, and change nothing when KQC has its own.

Attributes

Functions

cache_root() → pathlib.Path

The quantcore-circuits user cache (QCC_CACHE_DIR, else the platform's user cache folder).

cached_root([version]) → pathlib.Path

The cache folder of one kqcircuits version: scripts/ and kqcircuits/util/font_polygons.oas, laid out

ensure_kqc_data() → pathlib.Path | None

Point KQC's polygon-label font at KQCircuits' own file from QCC_KQC_SCRIPTS or the cache when the installed

ensure_kqc_scripts() → pathlib.Path

Return the KQCircuits scripts folder the export uses; point KQC at it when it is not KQC's own.

fetch_kqc_files([version, source, force]) → pathlib.Path

Fill the cache with KQCircuits' scripts folder and label font for version (default: the installed one).

find_kqc_scripts() → tuple[pathlib.Path | None, str]

(scripts folder, where): the first complete KQCircuits scripts folder, or (None, "").

kqc_version() → str

The installed kqcircuits version (0.0.1 for a checkout without git tags).

missing_message() → str

Module Contents

quantcore_circuits.kqc_files.cache_root() → pathlib.Path

The quantcore-circuits user cache (QCC_CACHE_DIR, else the platform’s user cache folder).

quantcore_circuits.kqc_files.cached_root(version: str | None = None) → pathlib.Path

The cache folder of one kqcircuits version: scripts/ and kqcircuits/util/font_polygons.oas, laid out like klayout_package/python of a checkout.

quantcore_circuits.kqc_files.ensure_kqc_data() → pathlib.Path | None

Point KQC’s polygon-label font at KQCircuits’ own file from QCC_KQC_SCRIPTS or the cache when the installed kqcircuits lacks it. Returns the font file in use (None when there is none; KQC then fails on a label).

quantcore_circuits.kqc_files.ensure_kqc_scripts() → pathlib.Path

Return the KQCircuits scripts folder the export uses; point KQC at it when it is not KQC’s own.

The lists in kqcircuits.defaults are changed in place, so the names KQC’s export modules imported from it see the change; SIM_SCRIPT_PATH (a path imported by name) is also set in elmer_export.

quantcore_circuits.kqc_files.fetch_kqc_files(version: str | None = None, source: str | pathlib.Path | None = None, force: bool = False) → pathlib.Path

Fill the cache with KQCircuits’ scripts folder and label font for version (default: the installed one).

source: a KQCircuits checkout (or its klayout_package/python folder), or a source zip, instead of the download of <REPO>/archive/refs/tags/v<version>.zip. Returns the cache folder of that version.

quantcore_circuits.kqc_files.find_kqc_scripts() → tuple[pathlib.Path | None, str]

(scripts folder, where): the first complete KQCircuits scripts folder, or (None, "").

quantcore_circuits.kqc_files.kqc_version() → str

The installed kqcircuits version (0.0.1 for a checkout without git tags).

quantcore_circuits.kqc_files.missing_message() → str
quantcore_circuits.kqc_files.ENV_CACHE = 'QCC_CACHE_DIR'
quantcore_circuits.kqc_files.ENV_SCRIPTS = 'QCC_KQC_SCRIPTS'
quantcore_circuits.kqc_files.FONT = 'kqcircuits/util/font_polygons.oas'
quantcore_circuits.kqc_files.NEEDED = ('simulations/ansys', 'simulations/post_process')
quantcore_circuits.kqc_files.PY_IN_REPO = 'klayout_package/python'
quantcore_circuits.kqc_files.REPO = 'https://github.com/iqm-finland/KQCircuits'