How to get the version number of the package of an associated active technology?

edited January 2022 in Python scripting

Hello guys,
Does anyone have any idea how to get the version number of the package of an associated active technology?

I tried something like this:

import pya
window = pya.Application.instance().main_window()
tech = pya.Technology.technology_by_name(window.initial_technology)

I could not find any reference to the version number of the package inside the tech object. Am I searching at a wrong place or is it impossible at the moment and I need to find another way?

Comments

  • I'm sorry, but there is no API for packages available in Python.

    You can basically scan the package files which are plain XML files.

    Look for files inside all folders listed in pya.Application.instance().klayout_path() and there in the "salt" subfolder. Look for files called "grain.xml" recursively.

    Technology packages are ones where there is a "tech" folder in the same directory than the "grain.xml" file. Inside that "grain.xml" you will find the version number in the "version" element.

    Matthias

  • @Matthias thanks for the hint. I used the default_base_path (*.lyt) of the technology object to go up to the grain.xml file. I read the version number out of the grain.xml as you suggested. It does exactly what I want. :)
Sign In or Register to comment.