Metadata-Version: 2.4
Name: eda-netlist-parser
Version: 0.1.2
Summary: A pure-Python parser for SPICE, Spectre, CDL, and DSPF netlist files — extracts subcircuit, port, device, and parasitic data for EDA automation and library characterization workflows
Author-email: Rohan Chadhury <rohaanshahid@gmail.com>
License: MIT License
        
        Copyright (c) 2025–2026 Rohan Chadhury
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/rohaansch/netlist-parser
Keywords: eda,spice,netlist,cdl,spectre,dspf,vlsi,semiconductor,simulation,characterization,lvs,parasitic,parser
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: color
Requires-Dist: termcolor>=1.1; extra == "color"
Provides-Extra: dev
Requires-Dist: pytest>=7; extra == "dev"
Requires-Dist: termcolor>=1.1; extra == "dev"
Dynamic: license-file

# eda-netlist-parser

A pure-Python parser for SPICE-family netlist files: `.spi`, `.cir`, `.cdl`, `.scs`, `.spf`, `.sp`, `.hsp`.

[![CI](https://github.com/rohaansch/netlist-parser/actions/workflows/ci.yml/badge.svg)](https://github.com/rohaansch/netlist-parser/actions/workflows/ci.yml)
[![Python](https://img.shields.io/badge/python-3.7%2B-blue)](https://pypi.org/project/eda-netlist-parser/)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)

## Installation

```bash
pip install eda-netlist-parser
# optional colored terminal output:
pip install eda-netlist-parser[color]
```

[![PyPI](https://img.shields.io/pypi/v/eda-sdf-parser)](https://pypi.org/project/eda-netlist-parser/)
[![Python](https://img.shields.io/pypi/pyversions/eda-sdf-parser)](https://pypi.org/project/eda-netlist-parser/)

## Quick start

```python
from netlist_parser import NetlistParser, NetlistError

parser = NetlistParser()

try:
    netlist = parser.parse("design.spi")
except NetlistError as e:
    print(f"Error: {e}")

for cell in netlist.cells:
    print(cell.name, cell.ports)
    for inst in cell.instances:
        print("  ", inst.name, inst.code, inst.device_name)
```

### Importing

```python
from netlist_parser import NetlistParser
from netlist_parser import NetlistParser, Netlist, NetlistCell, DeviceInstance
```

## API

### `NetlistParser(internal=False)`

| Method | Returns | Description |
|--------|---------|-------------|
| `parse(filename)` | `Netlist` | Parse a single file |
| `read(path, data=None)` | varies | Parse file or directory |

`read()` data modes:

| `data=` | Returns |
|---------|---------|
| `None` | `Netlist` |
| `'cells'` | `Set[str]` |
| `'ports'` | `Dict[str, List[str]]` |
| `'devices'` | `Dict[str, Set[str]]` |
| `'device-params'` | `Dict[str, Dict]` |
| `'resistors'` | `Dict[str, List]` |
| `'capacitors'` | `Dict[str, List]` |

### Classes

- `Netlist` — full file data: `.cells`, `.version`, `.resistance`, `.capacitance`, `.layer_map`
- `NetlistCell` — one subckt: `.name`, `.ports`, `.instances`, `.substitute`
- `DeviceInstance` — one line: `.name`, `.code`, `.nodes`, `.device_name`, `.number`, `.parameters`
- `NetlistError` — raised on file errors

## CLI

```
netlist-parser sample.spi                   # summary
netlist-parser sample.spi --cells           # list cell names
netlist-parser sample.spi --ports           # cell → ports
netlist-parser sample.spi --devices         # cell → device names
netlist-parser sample.spi --cell inv_x1     # one cell detail
netlist-parser --version
```

## License

[MIT](LICENSE)
