powercontract 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- powercontract-0.1.0/LICENSE +21 -0
- powercontract-0.1.0/PKG-INFO +186 -0
- powercontract-0.1.0/README.md +155 -0
- powercontract-0.1.0/pyproject.toml +60 -0
- powercontract-0.1.0/setup.cfg +4 -0
- powercontract-0.1.0/src/powercontract/__init__.py +3 -0
- powercontract-0.1.0/src/powercontract/capture.py +498 -0
- powercontract-0.1.0/src/powercontract/cli.py +91 -0
- powercontract-0.1.0/src/powercontract/errors.py +10 -0
- powercontract-0.1.0/src/powercontract/evaluate.py +347 -0
- powercontract-0.1.0/src/powercontract/model.py +72 -0
- powercontract-0.1.0/src/powercontract/spec.py +170 -0
- powercontract-0.1.0/src/powercontract/units.py +49 -0
- powercontract-0.1.0/src/powercontract.egg-info/PKG-INFO +186 -0
- powercontract-0.1.0/src/powercontract.egg-info/SOURCES.txt +19 -0
- powercontract-0.1.0/src/powercontract.egg-info/dependency_links.txt +1 -0
- powercontract-0.1.0/src/powercontract.egg-info/entry_points.txt +2 -0
- powercontract-0.1.0/src/powercontract.egg-info/requires.txt +6 -0
- powercontract-0.1.0/src/powercontract.egg-info/top_level.txt +1 -0
- powercontract-0.1.0/tests/test_docs.py +34 -0
- powercontract-0.1.0/tests/test_powercontract.py +865 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sidelobe
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: powercontract
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Validate oscilloscope captures against executable electrical requirements.
|
|
5
|
+
Author: Sidelobe
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/sidelobe-labs/powercontract
|
|
8
|
+
Project-URL: Repository, https://github.com/sidelobe-labs/powercontract
|
|
9
|
+
Project-URL: Issues, https://github.com/sidelobe-labs/powercontract/issues
|
|
10
|
+
Keywords: oscilloscope,hardware-validation,power-sequencing,embedded,electronics,requirements-as-code
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)
|
|
21
|
+
Classifier: Topic :: Software Development :: Testing
|
|
22
|
+
Requires-Python: >=3.11
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: PyYAML<7,>=6.0
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: build<2,>=1.2; extra == "dev"
|
|
28
|
+
Requires-Dist: pytest<10,>=8; extra == "dev"
|
|
29
|
+
Requires-Dist: twine<7,>=6; extra == "dev"
|
|
30
|
+
Dynamic: license-file
|
|
31
|
+
|
|
32
|
+
# PowerContract
|
|
33
|
+
|
|
34
|
+
PowerContract evaluates oscilloscope waveform data against electrical requirements defined in YAML.
|
|
35
|
+
|
|
36
|
+
For each requirement it reports `PASS`, `FAIL`, or `INDETERMINATE`, together with the measured value, limit, margin, and optional uncertainty and source.
|
|
37
|
+
|
|
38
|
+
It does not control the oscilloscope or replace the vendor's waveform-analysis software. Acquisition and evaluation are separate.
|
|
39
|
+
|
|
40
|
+
## Try it
|
|
41
|
+
|
|
42
|
+
Install from a checkout:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
python -m pip install .
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Run the bundled example:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
powercontract check examples/boot.csv examples/boot.yaml
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Check the installed version:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
powercontract --version
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
For your own capture, inspect the CSV first and use its actual column names in the contract. The [getting-started guide](docs/getting-started.md) walks through the full process.
|
|
61
|
+
|
|
62
|
+
## Example contract
|
|
63
|
+
|
|
64
|
+
```yaml
|
|
65
|
+
version: 1
|
|
66
|
+
|
|
67
|
+
capture:
|
|
68
|
+
time_column: Time
|
|
69
|
+
|
|
70
|
+
signals:
|
|
71
|
+
vdd:
|
|
72
|
+
column: VDD_3V3
|
|
73
|
+
nominal: 3.3
|
|
74
|
+
|
|
75
|
+
en:
|
|
76
|
+
column: EN
|
|
77
|
+
nominal: 3.3
|
|
78
|
+
|
|
79
|
+
events:
|
|
80
|
+
vdd_valid:
|
|
81
|
+
signal: vdd
|
|
82
|
+
direction: above
|
|
83
|
+
threshold: 3.0
|
|
84
|
+
|
|
85
|
+
en_release:
|
|
86
|
+
signal: en
|
|
87
|
+
direction: above
|
|
88
|
+
threshold: 2.0
|
|
89
|
+
|
|
90
|
+
requirements:
|
|
91
|
+
- id: PWR-001
|
|
92
|
+
type: delay
|
|
93
|
+
from: vdd_valid
|
|
94
|
+
to: en_release
|
|
95
|
+
min: 50us
|
|
96
|
+
source: "Board power specification, section 3.2"
|
|
97
|
+
|
|
98
|
+
- id: PWR-002
|
|
99
|
+
type: max_value
|
|
100
|
+
signal: vdd
|
|
101
|
+
value: 3.6
|
|
102
|
+
uncertainty: 0.03
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Run it with:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
powercontract check capture.csv power.yaml
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Write a JSON report with:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
powercontract check capture.csv power.yaml --json report.json
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Requirements supported in v0.1
|
|
118
|
+
|
|
119
|
+
Contract version 1 uses seconds for time and volts for signal values.
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
- delay between named threshold events;
|
|
123
|
+
- minimum and maximum voltage;
|
|
124
|
+
- event-bounded voltage windows;
|
|
125
|
+
- rise time and fall time;
|
|
126
|
+
- threshold stability windows;
|
|
127
|
+
- explicit measurement uncertainty;
|
|
128
|
+
- optional requirement source;
|
|
129
|
+
- terminal and JSON output.
|
|
130
|
+
|
|
131
|
+
If the capture does not contain enough evidence to evaluate a requirement, the result is `INDETERMINATE`.
|
|
132
|
+
|
|
133
|
+
## Capture formats
|
|
134
|
+
|
|
135
|
+
| Input | Support |
|
|
136
|
+
| --- | --- |
|
|
137
|
+
| Normal table CSV with one time column and named signal columns | Supported |
|
|
138
|
+
| Siglent SDS800X HD per-channel CSV | Tested with a real SDS824X HD |
|
|
139
|
+
| Older Siglent / WaveAce-style `Source` + units CSV | Parser tested against documented/public examples |
|
|
140
|
+
| Rigol sequence CSV with `Start` / `Increment` | Parser tested against public format examples |
|
|
141
|
+
| Rigol paired XY CSV | Parser tested against public format examples |
|
|
142
|
+
| Tektronix five-column CSV | Parser tested against the Tektronix-documented layout |
|
|
143
|
+
| Keysight InfiniiVision multi-channel CSV | Supported through the normal table CSV loader when the file contains named columns |
|
|
144
|
+
| CSV from Python, pandas, MATLAB, LabVIEW, or custom acquisition code | Supported through the normal table CSV loader |
|
|
145
|
+
|
|
146
|
+
Only the Siglent SDS800X HD per-channel path is currently tested on physical hardware in this project. Other vendor-specific rows describe file-format support, not blanket support for every model from that vendor.
|
|
147
|
+
|
|
148
|
+
See [Input formats](docs/input-formats.md) and [Oscilloscope vendor notes](docs/vendors.md) for details.
|
|
149
|
+
|
|
150
|
+
## Documentation
|
|
151
|
+
|
|
152
|
+
- [Getting started](docs/getting-started.md)
|
|
153
|
+
- [Writing contracts](docs/contracts.md)
|
|
154
|
+
- [Input formats](docs/input-formats.md)
|
|
155
|
+
- [Oscilloscope vendor notes](docs/vendors.md)
|
|
156
|
+
- [CI usage](docs/ci.md)
|
|
157
|
+
- [Troubleshooting](docs/troubleshooting.md)
|
|
158
|
+
|
|
159
|
+
## Exit codes
|
|
160
|
+
|
|
161
|
+
| Code | Meaning |
|
|
162
|
+
| ---: | --- |
|
|
163
|
+
| `0` | all requirements passed |
|
|
164
|
+
| `1` | at least one requirement failed or was indeterminate |
|
|
165
|
+
| `2` | invalid capture, contract, or output request |
|
|
166
|
+
|
|
167
|
+
## Scope
|
|
168
|
+
|
|
169
|
+
PowerContract answers one question: did the measured signals satisfy the declared electrical requirements?
|
|
170
|
+
|
|
171
|
+
It is not a waveform viewer, protocol decoder, SCPI control framework, automatic datasheet parser, or golden-waveform comparison tool.
|
|
172
|
+
|
|
173
|
+
## Development
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
python -m pip install -e '.[dev]'
|
|
177
|
+
pytest
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
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.
|
|
181
|
+
|
|
182
|
+
## License
|
|
183
|
+
|
|
184
|
+
MIT. See [LICENSE](LICENSE).
|
|
185
|
+
|
|
186
|
+
Release history is in [CHANGELOG.md](CHANGELOG.md).
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
# PowerContract
|
|
2
|
+
|
|
3
|
+
PowerContract evaluates oscilloscope waveform data against electrical requirements defined in YAML.
|
|
4
|
+
|
|
5
|
+
For each requirement it reports `PASS`, `FAIL`, or `INDETERMINATE`, together with the measured value, limit, margin, and optional uncertainty and source.
|
|
6
|
+
|
|
7
|
+
It does not control the oscilloscope or replace the vendor's waveform-analysis software. Acquisition and evaluation are separate.
|
|
8
|
+
|
|
9
|
+
## Try it
|
|
10
|
+
|
|
11
|
+
Install from a checkout:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
python -m pip install .
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Run the bundled example:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
powercontract check examples/boot.csv examples/boot.yaml
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Check the installed version:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
powercontract --version
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
For your own capture, inspect the CSV first and use its actual column names in the contract. The [getting-started guide](docs/getting-started.md) walks through the full process.
|
|
30
|
+
|
|
31
|
+
## Example contract
|
|
32
|
+
|
|
33
|
+
```yaml
|
|
34
|
+
version: 1
|
|
35
|
+
|
|
36
|
+
capture:
|
|
37
|
+
time_column: Time
|
|
38
|
+
|
|
39
|
+
signals:
|
|
40
|
+
vdd:
|
|
41
|
+
column: VDD_3V3
|
|
42
|
+
nominal: 3.3
|
|
43
|
+
|
|
44
|
+
en:
|
|
45
|
+
column: EN
|
|
46
|
+
nominal: 3.3
|
|
47
|
+
|
|
48
|
+
events:
|
|
49
|
+
vdd_valid:
|
|
50
|
+
signal: vdd
|
|
51
|
+
direction: above
|
|
52
|
+
threshold: 3.0
|
|
53
|
+
|
|
54
|
+
en_release:
|
|
55
|
+
signal: en
|
|
56
|
+
direction: above
|
|
57
|
+
threshold: 2.0
|
|
58
|
+
|
|
59
|
+
requirements:
|
|
60
|
+
- id: PWR-001
|
|
61
|
+
type: delay
|
|
62
|
+
from: vdd_valid
|
|
63
|
+
to: en_release
|
|
64
|
+
min: 50us
|
|
65
|
+
source: "Board power specification, section 3.2"
|
|
66
|
+
|
|
67
|
+
- id: PWR-002
|
|
68
|
+
type: max_value
|
|
69
|
+
signal: vdd
|
|
70
|
+
value: 3.6
|
|
71
|
+
uncertainty: 0.03
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Run it with:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
powercontract check capture.csv power.yaml
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Write a JSON report with:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
powercontract check capture.csv power.yaml --json report.json
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Requirements supported in v0.1
|
|
87
|
+
|
|
88
|
+
Contract version 1 uses seconds for time and volts for signal values.
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
- delay between named threshold events;
|
|
92
|
+
- minimum and maximum voltage;
|
|
93
|
+
- event-bounded voltage windows;
|
|
94
|
+
- rise time and fall time;
|
|
95
|
+
- threshold stability windows;
|
|
96
|
+
- explicit measurement uncertainty;
|
|
97
|
+
- optional requirement source;
|
|
98
|
+
- terminal and JSON output.
|
|
99
|
+
|
|
100
|
+
If the capture does not contain enough evidence to evaluate a requirement, the result is `INDETERMINATE`.
|
|
101
|
+
|
|
102
|
+
## Capture formats
|
|
103
|
+
|
|
104
|
+
| Input | Support |
|
|
105
|
+
| --- | --- |
|
|
106
|
+
| Normal table CSV with one time column and named signal columns | Supported |
|
|
107
|
+
| Siglent SDS800X HD per-channel CSV | Tested with a real SDS824X HD |
|
|
108
|
+
| Older Siglent / WaveAce-style `Source` + units CSV | Parser tested against documented/public examples |
|
|
109
|
+
| Rigol sequence CSV with `Start` / `Increment` | Parser tested against public format examples |
|
|
110
|
+
| Rigol paired XY CSV | Parser tested against public format examples |
|
|
111
|
+
| Tektronix five-column CSV | Parser tested against the Tektronix-documented layout |
|
|
112
|
+
| Keysight InfiniiVision multi-channel CSV | Supported through the normal table CSV loader when the file contains named columns |
|
|
113
|
+
| CSV from Python, pandas, MATLAB, LabVIEW, or custom acquisition code | Supported through the normal table CSV loader |
|
|
114
|
+
|
|
115
|
+
Only the Siglent SDS800X HD per-channel path is currently tested on physical hardware in this project. Other vendor-specific rows describe file-format support, not blanket support for every model from that vendor.
|
|
116
|
+
|
|
117
|
+
See [Input formats](docs/input-formats.md) and [Oscilloscope vendor notes](docs/vendors.md) for details.
|
|
118
|
+
|
|
119
|
+
## Documentation
|
|
120
|
+
|
|
121
|
+
- [Getting started](docs/getting-started.md)
|
|
122
|
+
- [Writing contracts](docs/contracts.md)
|
|
123
|
+
- [Input formats](docs/input-formats.md)
|
|
124
|
+
- [Oscilloscope vendor notes](docs/vendors.md)
|
|
125
|
+
- [CI usage](docs/ci.md)
|
|
126
|
+
- [Troubleshooting](docs/troubleshooting.md)
|
|
127
|
+
|
|
128
|
+
## Exit codes
|
|
129
|
+
|
|
130
|
+
| Code | Meaning |
|
|
131
|
+
| ---: | --- |
|
|
132
|
+
| `0` | all requirements passed |
|
|
133
|
+
| `1` | at least one requirement failed or was indeterminate |
|
|
134
|
+
| `2` | invalid capture, contract, or output request |
|
|
135
|
+
|
|
136
|
+
## Scope
|
|
137
|
+
|
|
138
|
+
PowerContract answers one question: did the measured signals satisfy the declared electrical requirements?
|
|
139
|
+
|
|
140
|
+
It is not a waveform viewer, protocol decoder, SCPI control framework, automatic datasheet parser, or golden-waveform comparison tool.
|
|
141
|
+
|
|
142
|
+
## Development
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
python -m pip install -e '.[dev]'
|
|
146
|
+
pytest
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
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.
|
|
150
|
+
|
|
151
|
+
## License
|
|
152
|
+
|
|
153
|
+
MIT. See [LICENSE](LICENSE).
|
|
154
|
+
|
|
155
|
+
Release history is in [CHANGELOG.md](CHANGELOG.md).
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77.0.3"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "powercontract"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "Validate oscilloscope captures against executable electrical requirements."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [{ name = "Sidelobe" }]
|
|
14
|
+
keywords = [
|
|
15
|
+
"oscilloscope",
|
|
16
|
+
"hardware-validation",
|
|
17
|
+
"power-sequencing",
|
|
18
|
+
"embedded",
|
|
19
|
+
"electronics",
|
|
20
|
+
"requirements-as-code",
|
|
21
|
+
]
|
|
22
|
+
dependencies = ["PyYAML>=6.0,<7"]
|
|
23
|
+
classifiers = [
|
|
24
|
+
"Development Status :: 3 - Alpha",
|
|
25
|
+
"Environment :: Console",
|
|
26
|
+
"Intended Audience :: Developers",
|
|
27
|
+
"Intended Audience :: Science/Research",
|
|
28
|
+
"Operating System :: OS Independent",
|
|
29
|
+
"Programming Language :: Python :: 3",
|
|
30
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
31
|
+
"Programming Language :: Python :: 3.11",
|
|
32
|
+
"Programming Language :: Python :: 3.12",
|
|
33
|
+
"Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)",
|
|
34
|
+
"Topic :: Software Development :: Testing",
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
[project.urls]
|
|
38
|
+
Homepage = "https://github.com/sidelobe-labs/powercontract"
|
|
39
|
+
Repository = "https://github.com/sidelobe-labs/powercontract"
|
|
40
|
+
Issues = "https://github.com/sidelobe-labs/powercontract/issues"
|
|
41
|
+
|
|
42
|
+
[project.scripts]
|
|
43
|
+
powercontract = "powercontract.cli:main"
|
|
44
|
+
|
|
45
|
+
[project.optional-dependencies]
|
|
46
|
+
dev = [
|
|
47
|
+
"build>=1.2,<2",
|
|
48
|
+
"pytest>=8,<10",
|
|
49
|
+
"twine>=6,<7",
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
[tool.setuptools.dynamic]
|
|
53
|
+
version = { attr = "powercontract.__version__" }
|
|
54
|
+
|
|
55
|
+
[tool.setuptools.packages.find]
|
|
56
|
+
where = ["src"]
|
|
57
|
+
|
|
58
|
+
[tool.pytest.ini_options]
|
|
59
|
+
addopts = "-q"
|
|
60
|
+
testpaths = ["tests"]
|