piel.tools.openlane.utils
=========================

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


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


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

.. py:function:: extract_datetime_from_path(run_path: piel.types.PathTypes) -> str

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


.. py:function:: find_all_design_runs(design_directory: piel.types.PathTypes, run_name: str | None = None) -> list[piel.types.PathTypes]

   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: PathTypes
   :param run_name: The name of the run to return. Defaults to None.
   :type run_name: str, optional
   :param version: The version of OpenLane to use. 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 list of pathlib.Path objects corresponding to the runs
   :rtype: list[pathlib.Path]


.. py:function:: find_latest_design_run(design_directory: piel.types.PathTypes, run_name: str | None = None, version: Literal['v1', 'v2'] | None = None) -> piel.types.DigitalRunID

   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: PathTypes
   :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.types.PathTypes, run_directory: piel.types.PathTypes | None = None) -> piel.types.PathTypes

   Returns the path to the final GDS generated by OpenLane.

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

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


.. py:function:: get_design_run_version(run_directory: piel.types.PathTypes) -> Literal['v1', 'v2']

   Returns the version of the design run.


.. py:function:: sort_design_runs(path_list: list[piel.types.PathTypes]) -> dict[str, list[piel.types.PathTypes]]

   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]]


