PowerContract
PowerContract checks waveform CSV files against electrical requirements defined in YAML.
You map capture columns to named signals, choose threshold events, and define voltage or timing limits. Events can require a stable interval; voltage limits can apply to the whole capture or between two events. Rise and fall times, measurement uncertainty and requirement references are also defined in the contract.
The same contract can be run against later captures with the same signal mapping. Each requirement returns PASS, FAIL, or INDETERMINATE, with its measured value, limit and margin. Missing events and uncertainty intervals that cross a limit remain indeterminate.
PowerContract is deliberately small. Oscilloscopes and commercial power-analysis suites already provide broad measurement workflows; this tool focuses on checking recorded signals against requirements you can keep in version control and run again. It doesn't control instruments, estimate uncertainty or interpret datasheets.
Project overview · Engineering note: why I wrote it
Install
python -m pip install powercontract
powercontract --version
If you cloned the repository, you can also run the bundled example:
powercontract check examples/boot.csv examples/boot.yaml
For your own capture, inspect the CSV first and use its actual column names in the contract. The getting-started guide walks through the full process.
Example contract
version: 1
capture:
time_column: Time
signals:
vdd:
column: VDD_3V3
nominal: 3.3
en:
column: EN
nominal: 3.3
events:
vdd_valid:
signal: vdd
direction: above
threshold: 3.0
en_release:
signal: en
direction: above
threshold: 2.0
requirements:
- id: PWR-001
type: delay
from: vdd_valid
to: en_release
min: 50us
source: "Board power specification, section 3.2"
- id: PWR-002
type: max_value
signal: vdd
value: 3.6
uncertainty: 0.03
Run it with:
powercontract check capture.csv power.yaml
Write a JSON report with:
powercontract check capture.csv power.yaml --json report.json
Requirements supported in v0.1
Contract version 1 uses seconds for time and volts for signal values.
- delay between named threshold events;
- minimum and maximum voltage;
- event-bounded voltage windows;
- rise time and fall time;
- threshold stability windows;
- explicit measurement uncertainty;
- optional requirement source;
- terminal and JSON output.
If the capture does not contain enough evidence to evaluate a requirement, the result is INDETERMINATE.
Capture formats
| Input | Support |
|---|---|
| Normal table CSV with one time column and named signal columns | Supported |
| Siglent SDS800X HD per-channel CSV | Tested with hardware from this series |
Older Siglent / WaveAce-style Source + units CSV |
Parser tested against documented/public examples |
Rigol sequence CSV with Start / Increment |
Parser tested against public format examples |
| Rigol paired XY CSV | Parser tested against public format examples |
| Tektronix five-column CSV | Parser tested against the Tektronix-documented layout |
| Keysight InfiniiVision multi-channel CSV | Supported through the normal table CSV loader when the file contains named columns |
| CSV from Python, pandas, MATLAB, LabVIEW, or custom acquisition code | Supported through the normal table CSV loader |
Only the SDS800X HD per-channel parser has been tested with physical hardware in this project. Other vendor-specific formats have parser tests, not instrument-by-instrument hardware coverage.
See Input formats and Oscilloscope vendor notes for details.
Documentation
Exit codes
| Code | Meaning |
|---|---|
0 |
all requirements passed |
1 |
at least one requirement failed or was indeterminate |
2 |
invalid capture, contract, or output request |
Scope
PowerContract answers one question: did the measured signals satisfy the declared electrical requirements?
It is not a waveform viewer, protocol decoder, SCPI control framework, automatic datasheet parser, or golden-waveform comparison tool.
Development
git clone https://github.com/sidelobe-labs/powercontract.git
cd powercontract
python -m pip install -e '.[dev]'
pytest
CI runs the test suite on Python 3.11 and 3.12, builds the package, runs twine check, and installs the built wheel in a clean virtual environment.
Contributing
See CONTRIBUTING.md. Security issues should follow SECURITY.md.
License
MIT. See LICENSE.
Release history is in CHANGELOG.md.
Metadata
Release files for powercontract 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| powercontract-0.1.2.tar.gz | 26.4 kB | With provenance | Details for powercontract-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| powercontract-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for powercontract-0.1.2-py3-none-any.whl |
Total release size: 45.0 kB
Release files / powercontract-0.1.2.tar.gz
| Download URL | powercontract-0.1.2.tar.gz |
|---|---|
| Size | 26.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5afabd725391243d72d1bf04ba884fa18c039dd5a4fbe335b66fe75adf7dc728
|
|
BLAKE2b-256 checksum How to use checksums |
f5780d172a0883647c2b5a1d9beebce50df40d162e5aec63b036661935282725
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.
Transparency logRelease files / powercontract-0.1.2-py3-none-any.whl
| Download URL | powercontract-0.1.2-py3-none-any.whl |
|---|---|
| Size | 18.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
323a1f6a6b2840292d3b4c63bbc4a1e7cf6e97170c932f5aec8df9f6d328d8bf
|
|
BLAKE2b-256 checksum How to use checksums |
b7c29563d084adf11d85b6fd157bf34ff72710028a61979253a1b92e78011967
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.
Transparency logSecurity for powercontract 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for powercontract-0.1.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.