:py:mod:`piel.tools.openlane.utils`
===================================

.. py:module:: piel.tools.openlane.utils


Module Contents
---------------


Functions
~~~~~~~~~

.. autoapisummary::

   piel.tools.openlane.utils.extract_datetime_from_path
   piel.tools.openlane.utils.find_all_design_runs
   piel.tools.openlane.utils.find_latest_design_run
   piel.tools.openlane.utils.get_gds_path_from_design_run
   piel.tools.openlane.utils.get_design_run_version
   piel.tools.openlane.utils.sort_design_runs



.. py:function:: extract_datetime_from_path(run_path: pathlib.Path) -> str

   Extracts the datetime from a given `run_path` and returns it as a string.


.. py:function:: find_all_design_runs(design_directory: piel.config.piel_path_types, run_name: str | None = None) -> list[pathlib.Path]

   For a given `design_directory`, the `openlane` output can be found in the `runs` subdirectory. This function sorts the runs according to the default notations between both `openlane` and `openlane2` run formats.

   If a `run_name` is specified, then the function will return the exact run if it exists. Otherwise, it will return the latest run

   :param design_directory: The path to the design directory
   :type design_directory: piel_path_types
   :param run_name: The name of the run to return. Defaults to None.
   :type run_name: str, optional

   :raises ValueError: If the run_name is specified but not found in the design_directory

   :returns: A list of pathlib.Path objects corresponding to the runs
   :rtype: list[pathlib.Path]


.. py:function:: find_latest_design_run(design_directory: piel.config.piel_path_types, run_name: str | None = None, version: Literal[v1, v2] | None = None) -> (pathlib.Path, str)

   For a given `design_directory`, the `openlane` output can be found in the `runs` subdirectory. This function sorts the runs according to the default notations between both `openlane` and `openlane2` run formats.

   If a `run_name` is specified, then the function will return the exact run if it exists. Otherwise, it will return the latest run.

   :param design_directory: The path to the design directory
   :type design_directory: piel_path_types
   :param run_name: The name of the run to return. Defaults to None.
   :type run_name: str, optional
   :param version: The version of the run to return. Defaults to None.
   :type version: Literal["v1", "v2"], optional

   :raises ValueError: If the run_name is specified but not found in the design_directory

   :returns: A tuple of the latest run path and the version
   :rtype: (pathlib.Path, str)


.. py:function:: get_gds_path_from_design_run(design_directory: piel.config.piel_path_types, run_directory: piel.config.piel_path_types | None = None) -> pathlib.Path

   Returns the path to the final GDS generated by OpenLane.

   :param design_directory: The path to the design directory
   :type design_directory: piel_path_types
   :param run_directory: The path to the run directory. Defaults to None. Otherwise gets the latest run.
   :type run_directory: piel_path_types, optional

   :returns: The path to the final GDS
   :rtype: pathlib.Path


.. py:function:: get_design_run_version(run_directory: piel.config.piel_path_types) -> Literal[v1, v2]

   Returns the version of the design run.


.. py:function:: sort_design_runs(path_list: list[pathlib.Path]) -> dict[str, list[pathlib.Path]]

   For a given `design_directory`, the `openlane` output can be found in the `runs` subdirectory. This function sorts the runs according to the default notations between both `openlane` and `openlane2` run formats.

   :param path_list: A list of pathlib.Path objects corresponding to the runs
   :type path_list: list[pathlib.Path]

   :returns: A dictionary of sorted runs
   :rtype: dict[str, list[pathlib.Path]]
