Skip to main content

pyspicey

Tests Publish PyPI

pyspicey

A command-line reference and code generator for SPICE netlist syntax. Look up a device or statement, see exactly what parameters it takes, and generate a correct line of SPICE code without having to remember argument order.

Install

pip install pyspicey

Usage

List every available command, grouped by category:

$ pyspicey --list
Available SPICE commands (run `pyspicey <name> --help` for details):

Analysis Statements:
  ac     Small-signal AC sweep analysis (.AC)
  dc     DC sweep analysis (.DC)
  op     DC operating point analysis (.OP)
  tran   Transient analysis (.TRAN)

Controlled Sources:
  e      Voltage-controlled voltage source (VCVS)
  f      Current-controlled current source (CCCS)
  g      Voltage-controlled current source (VCCS)
  h      Current-controlled voltage source (CCVS)

Independent Sources:
  i      Independent DC/AC current source
  v      Independent DC/AC voltage source

Passive Elements:
  c      Capacitor
  l      Inductor
  r      Resistor

Semiconductor Devices:
  d      Diode
  m      MOSFET
  q      Bipolar junction transistor (BJT)

Source Functions:
  exp    Exponential waveform source function
  pulse  Pulse waveform source function
  pwl    Piecewise linear waveform source function
  sffm   Single-frequency FM waveform source function
  sin    Sinusoidal waveform source function

Subcircuits:
  x      Subcircuit instantiation

See the full parameter reference for a command:

$ pyspicey pwl --help
usage: pyspicey pwl [-h] [--current] [--r REPEAT] [--td TD]
                     name n_plus n_minus points [points ...]

Generates a waveform that linearly interpolates between explicit (time,
value) points, holding at the final value after the last point. Embed this
in a V or I source line.

positional arguments:
  name        Element name (V prefix added automatically, unless --current
              is given)
  n_plus      Positive node
  n_minus     Negative node
  points      Time/value pairs: t1 v1 t2 v2 ...

options:
  -h, --help  show this help message and exit
  --current   Emit an I (current) source instead of a V (voltage) source
  --r REPEAT  Repeat (loop) time
  --td TD     Time delay before the waveform starts

examples:
  pyspicey pwl VS in 0 0 0 1m 5 2m 0 3m 0

Generate the actual line of SPICE code:

$ pyspicey pwl VS in 0 0 0 1m 5 2m 0
VS in 0 PWL(0 0 1m 5 2m 0)

$ pyspicey r 1 in out 10k
R1 in out 10k

$ pyspicey tran 1u 10m --uic
.TRAN 1u 10m UIC

Append generated lines straight into a netlist file with -o/--output instead of printing them:

$ pyspicey -o circuit.spice r 1 in out 10k
$ pyspicey -o circuit.spice c 1 out 0 1u --ic 0
$ cat circuit.spice
R1 in out 10k
C1 out 0 1u IC=0

What's covered

  • Passive elements: r, c, l
  • Independent sources: v, i
  • Source functions (embedded in a V/I line): pulse, sin, pwl, exp, sffm
  • Semiconductor devices: d (diode), q (BJT), m (MOSFET)
  • Controlled sources: e (VCVS), g (VCCS), f (CCCS), h (CCVS)
  • Subcircuits: x
  • Analysis statements: dc, ac, tran, op

Syntax follows the common Berkeley SPICE3 / ngspice conventions. Some simulators (LTspice, HSPICE, PSpice) may diverge slightly — check your simulator's docs for anything unusual.

License

Apache License 2.0 — see LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyspicey-0.1.2.tar.gz (916.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyspicey-0.1.2-py3-none-any.whl (22.7 kB view details)

Uploaded Python 3

File details

Details for the file pyspicey-0.1.2.tar.gz.

File metadata

  • Download URL: pyspicey-0.1.2.tar.gz
  • Upload date:
  • Size: 916.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for pyspicey-0.1.2.tar.gz
Algorithm Hash digest
SHA256 8357915a0d92a0afce5347be2ec007898d0db8c2a4b92b330ff3de378aa5bdd7
MD5 2b16137f546cc4bf7315480e57c76dad
BLAKE2b-256 789365d11be657bcb01c407009b792fc6c5dcfa41096ae4ffe20636afe2a0db8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyspicey-0.1.2.tar.gz:

Publisher: publish.yml on ethnchiu/pyspicey

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyspicey-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: pyspicey-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 22.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for pyspicey-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f6ab2f36756fa77893962969aa415887d60d33726ea4ff9fa6d3a8f6907686ae
MD5 720467e636c3e8766c442f2fe4c5e31c
BLAKE2b-256 dafe52b58e6cfe3e357d218de70c92de5f79e882f5dfcb093c3e38bf40432949

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyspicey-0.1.2-py3-none-any.whl:

Publisher: publish.yml on ethnchiu/pyspicey

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page