Liberty Parser
This library provides functions to parse, manipulate and format 'Liberty' files. The liberty format is a common standard to describe certain aspects of standard-cell libraries such as timing, power, cell pin types, etc.
Example
from liberty.parser import parse_liberty
# Read and parse a library.
library = parse_liberty(open(liberty_file).read())
# Format the library.
print(str(library))
# Loop through all cells.
for cell_group in library.get_groups('cell'):
cell_name = cell_group.args[0]
print(cell_name)
# Loop through all pins of the cell.
for pin_group in cell_group.get_groups('pin'):
pin_name = pin_group.args[0]
print(pin_name)
# Access a pin attribute.
some_attribute = pin_group['some_attribute']
Library structure.
The liberty library is made of Group objects.
The library itself is a Group object. A Group contains
other nested Groups, has a name, a list of arguments and
attributes.
group_name(args) {
simple_attribute: 1.23;
other_group_name(args) {
other_simple_attribute: 2.34;
complex_attribute (1.23, 2.34);
}
}
Reading arrays and timing tables.
Timing tables are stored in the liberty format as attributes which holds a string with comma-separated values.
This string can be converted into a Numpy array with get_array:
some_group.get_array('attribute_name')
More examples
Example scripts can be found under ./examples.
Install for development
Run the following command to install the liberty parser using symlinks. This allows to edit the parser with immediate effect on the installed package.
pip install --upgrade --editable .
Metadata
Release files for liberty-parser 0.0.29
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| liberty_parser-0.0.29.tar.gz | 18.6 kB | Without provenance | Details |
Release files / liberty_parser-0.0.29.tar.gz
| Download URL | liberty_parser-0.0.29.tar.gz |
|---|---|
| Size | 18.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fe841322c3ff766a2f7629b30a75f65b669b045c398bc599fe36c2e56cd0d2fb
|
|
BLAKE2b-256 checksum How to use checksums |
8a3c1b5a749a833696d83b12530bb79af3adba7c97d745553af277f40999a7e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Security for liberty-parser 0.0.29
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.