quantcore_circuits.kqc_files ============================ .. py:module:: quantcore_circuits.kqc_files .. autoapi-nested-parse:: 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). :func:`ensure_kqc_scripts` (before an export) and :func:`ensure_kqc_data` (when the KQC libraries load) point KQC at the first one found, and change nothing when KQC has its own. Attributes ---------- .. autoapisummary:: quantcore_circuits.kqc_files.ENV_CACHE quantcore_circuits.kqc_files.ENV_SCRIPTS quantcore_circuits.kqc_files.FONT quantcore_circuits.kqc_files.NEEDED quantcore_circuits.kqc_files.PY_IN_REPO quantcore_circuits.kqc_files.REPO Functions --------- .. autoapisummary:: quantcore_circuits.kqc_files.cache_root quantcore_circuits.kqc_files.cached_root quantcore_circuits.kqc_files.ensure_kqc_data quantcore_circuits.kqc_files.ensure_kqc_scripts quantcore_circuits.kqc_files.fetch_kqc_files quantcore_circuits.kqc_files.find_kqc_scripts quantcore_circuits.kqc_files.kqc_version quantcore_circuits.kqc_files.missing_message Module Contents --------------- .. py:function:: cache_root() -> pathlib.Path The quantcore-circuits user cache (``QCC_CACHE_DIR``, else the platform's user cache folder). .. py:function:: 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. .. py:function:: 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). .. py:function:: 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``. .. py:function:: 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 ``/archive/refs/tags/v.zip``. Returns the cache folder of that version. .. py:function:: find_kqc_scripts() -> tuple[pathlib.Path | None, str] ``(scripts folder, where)``: the first complete KQCircuits ``scripts`` folder, or ``(None, "")``. .. py:function:: kqc_version() -> str The installed kqcircuits version (``0.0.1`` for a checkout without git tags). .. py:function:: missing_message() -> str .. py:data:: ENV_CACHE :value: 'QCC_CACHE_DIR' .. py:data:: ENV_SCRIPTS :value: 'QCC_KQC_SCRIPTS' .. py:data:: FONT :value: 'kqcircuits/util/font_polygons.oas' .. py:data:: NEEDED :value: ('simulations/ansys', 'simulations/post_process') .. py:data:: PY_IN_REPO :value: 'klayout_package/python' .. py:data:: REPO :value: 'https://github.com/iqm-finland/KQCircuits'