Skip to main content

pyspicey

Tests Publish PyPI

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.1.tar.gz (22.0 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.1-py3-none-any.whl (22.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyspicey-0.1.1.tar.gz
  • Upload date:
  • Size: 22.0 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.1.tar.gz
Algorithm Hash digest
SHA256 9c537033f1ec824b093cd7a56ac080d0e2603f8bfd682b2aefd6b2eb10d71dde
MD5 b77c3a3abff8c102304a39229574ee3d
BLAKE2b-256 e6054ce25d6ad4e48095e6648905d69bdb52b665ae4eb2cbf2f2fcc93716643d

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pyspicey-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 22.5 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5fa0a9af300b448c565e2e3777f23995a30e5c4a0d794e5855364d2c6eda06ea
MD5 77653969cdd9162704afe51931930a27
BLAKE2b-256 5b7d45deca5fef8eb5590a6c7fb39e31ce99dc43f820d398219cabd606fdc535

See more details on using hashes here.

Provenance

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