--- id: pyspice version: "1.5" license: GPLv3 license_treatment: copyleft maintenance: dormant --- # PySpice — Simulate electronic circuit using Python and the Ngspice / Xyce simulators License: copyleft · Maintenance: dormant · Downloads: 125.5K/mo ## What it is and what it does PySpice is a Python module that bridges your code to the Ngspice and Xyce circuit simulators, letting you define electronic circuits using an object-oriented API instead of writing SPICE netlists by hand. It handles unit conversions, exports simulation results to NumPy arrays, and integrates with Matplotlib for plotting. The package includes a partial SPICE netlist parser, support for KiCad schematic integration, and bindings to Ngspice's shared library via CFFI. You use PySpice when you want to automate circuit simulation, sweep parameters programmatically, or integrate circuit analysis into a larger Python workflow. It's aimed at engineers and students who prefer scripting over GUI-based simulators. The main dependencies are scientific libraries (NumPy, SciPy, Matplotlib) plus PyYAML and PLY for parsing. Use it for: - Automate parametric sweeps and optimization loops for circuit designs without manual netlist editing. - Generate circuit netlists from KiCad schematics and run simulations directly from Python. - Integrate circuit simulation into a data analysis or machine-learning pipeline using NumPy and SciPy. - Teach circuit analysis and simulation in an educational setting with interactive Python notebooks. - Parse and programmatically modify existing SPICE netlists for batch processing or design exploration. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. PySpice provides a Python interface to Ngspice and Xyce circuit simulators, allowing you to define, simulate, and analyze electronic circuits programmatically with support for netlist parsing, unit handling, and visualization. Yes, if you need to automate SPICE simulation in Python and can install Ngspice or Xyce separately. The package is stable and production-ready, but maintenance is dormant (last release 2021); it remains suitable for established workflows but may not receive fixes for new simulator versions or Python features. No known security vulnerabilities. GPLv3 copyleft applies—verify compatibility with your project's licensing. ## Install pip install pyspice uv add pyspice poetry add pyspice ## Installing PySpice Before you install: Low friction install with a pure-Python wheel. Maintenance is dormant—last release was in 2021 and no commits since August 2024—but the package remains stable and archived repository is not flagged as abandoned. License in practice: Licensed under GPLv3 (copyleft). Any derivative work or modification must also be released under GPLv3; proprietary or closed-source projects cannot incorporate this package without releasing their own source code. Quickstart: pip install PySpice from PySpice.Spice.Netlist import Circuit from PySpice.Unit import * circuit = Circuit('Simple RC') circuit.V('input', 1, circuit.gnd, 1@u_V) circuit.R(1, 1, 2, 1@u_kΩ) circuit.C(1, 2, circuit.gnd, 1@u_uF) Requires Ngspice or Xyce simulator installed separately on your system; PySpice is a Python binding only and does not bundle the simulator itself. Verify before relying: - Whether Ngspice/Xyce installation is straightforward on all supported platforms (Windows, Linux, macOS). - Current compatibility with modern Ngspice/Xyce versions beyond those tested in 2021. - Whether the dormant maintenance status affects real-world usability for new circuit designs. ## Package facts - License: GPLv3 (copyleft) - Python support: supports_current - Install friction: low - Maintenance: dormant - Downloads: 125.5K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags circuit simulation python, ngspice python interface, spice simulator wrapper, electronic circuit analysis, circuit netlist parser, spice simulation library, xyce python binding, circuit-simulation, spice-binding, eda-automation [View on SkillFed](https://skillfed.io/packages/pyspice) · [View on PyPI](https://pypi.org/project/pyspice/)