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.3.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.3-py3-none-any.whl (22.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyspicey-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 b4ac5ee73043bb4aa471f1ff2805fbdb1a1edb047adbd927a758659d67b5c4cd
MD5 c7b5ed68d3729cfa591c6e5df1562823
BLAKE2b-256 4906b98934f058424f5e24b684681b2b98ba37d73ce891ab2f419a96050a617e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyspicey-0.1.3.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.3-py3-none-any.whl.

File metadata

  • Download URL: pyspicey-0.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0aafe0704cde6d51526c6cfbb61413d4fead2c6de167538f5bac80165b90a2d4
MD5 a1a0d613eae4072577f1fce81390beb2
BLAKE2b-256 38eead75419b65ee6c039b0695f52e7be2d950433e489d263bf197dcdd241e68

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyspicey-0.1.3-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