ecproc
A domain-specific language and toolchain for defining, validating, compiling, and executing electrochemical procedures.
Overview
ecproc provides a complete pipeline for electrochemical experiment specification:
- Author procedures in YAML (
.ecproc) or programmatically via the Python SDK - Parse into a typed Abstract Syntax Tree (AST) with source-location tracking
- Generate a validated Faraday Intermediate Representation (
.ir.json) with SI unit normalization - Validate across 4 layers: syntax, electrochemistry, safety, and hardware compatibility
- Compile to execution targets (Python runtime or human-readable manual)
- Execute against real or mock potentiostat hardware
- Record results as provenance-complete ECDL documents (
.ecdl.json)
Who it's for
- Electrochemists — write procedures in YAML with human-readable units (
50 mV/s,1 mA,60 s) - ML/Data Engineers — build procedures programmatically via the Python SDK for automated DOE campaigns
- Lab Managers — generate reproducible lab manuals in Markdown/PDF from the same procedure definition
Architecture
.ecproc (YAML) ──┐ ┌── Python Runtime
├─→ AST ─→ Faraday IR ─→ Validate ─┤
SDK (Python) ──┘ └── Manual (Markdown/PDF)
│
▼
ECDL Record
| Module | Purpose | Files |
|---|---|---|
parser |
YAML + Python SDK parsing → AST | 4 |
ir |
AST → Faraday IR with SI normalization | 4 |
validator |
4-layer validation engine | 6 |
sdk |
Programmatic procedure builder | 16 |
targets |
Compilation + execution backends | 12 |
ecdl |
Output record generation + validation | 5 |
protocols |
Standard protocol templates (DOE, JRC) | 6 |
hardware_profiles |
Potentiostat capability profiles | 7 |
cli |
8 CLI commands via Typer | 8 |
utils |
Units, time parsing, logging | 3 |
86 source files, ~6,600 lines of production code.
Installation
pip install ecproc
For development:
pip install -e ".[dev]"
Quick Start
YAML (.ecproc)
metadata:
protocol: Simple CV
version: "1.0"
system:
electrodes: 3
reference: RHE
procedure:
- name: Conditioning
steps:
- cv:
between: 0.05 V and 1.2 V
rate: 50 mV/s
cycles: 20
Python SDK
from ecproc import Procedure
proc = Procedure("Simple CV", version="1.0")
proc.system(electrodes=3, reference="RHE")
with proc.phase("Conditioning") as p:
p.cv(between="0.05 V and 1.2 V", rate="50 mV/s", cycles=20)
result = proc.validate()
CLI
ecproc parse my_procedure.ecproc # Parse and display AST
ecproc validate my_procedure.ecproc # Validate (L1-L4)
ecproc compile my_procedure.ecproc # Compile to Python target
ecproc run my_procedure.ecproc # Parse → validate → execute
ecproc execute my_procedure.ecproc # Execute pre-compiled IR
ecproc manual my_procedure.ecproc # Generate lab manual (Markdown)
ecproc convert my_procedure.ecproc # Convert between formats
ecproc version # Show version
Validation Levels
| Level | Name | Rules | Checks |
|---|---|---|---|
| L1 | Syntax | SYN001–SYN005 | Required fields, valid techniques, type correctness |
| L2 | Electrochemistry | PV001–PV013, DR001–DR011 | Parameter bounds, domain rules, electrochemical constraints |
| L3 | Safety | SF001–SF007 | Voltage/current/temperature limits, thermal runaway detection, reference electrode monitoring |
| L4 | Hardware | HW001–HW003 | Potentiostat capability matching, technique support, range verification |
Validation stops early on L1 errors (structural problems) before running L2+ checks.
Supported Techniques
| Technique | YAML Key | SDK Method | Description |
|---|---|---|---|
| Cyclic Voltammetry | cv |
p.cv() |
Potential sweep between vertices |
| Linear Sweep | lsv |
p.lsv() |
Single-direction potential sweep |
| Open Circuit Potential | ocp |
p.ocp() |
Monitor OCP over time |
| Chronoamperometry | ca / hold |
p.hold() |
Potentiostatic hold |
| Chronopotentiometry | cp / galvanostatic |
p.galvanostatic() |
Galvanostatic hold |
| EIS | eis |
p.eis() |
Electrochemical impedance spectroscopy |
| Differential Pulse | dpv |
p.dpv() |
Differential pulse voltammetry |
| Square Wave | swv |
p.swv() |
Square wave voltammetry |
| Galvanostatic Cycling | gcd |
p.gcd() |
Charge/discharge cycling |
| Constant Current | cc |
p.cc() |
Constant current hold |
| Stripping | stripping |
p.stripping() |
Stripping voltammetry |
| Purge | purge |
p.purge() |
Gas purge step |
Unit Convention
| Layer | Units | Example |
|---|---|---|
| YAML / Display | Human-friendly | 50 mV/s, 1 mA, 10 cm², 0.1 M, 100 kHz |
| Faraday IR | SI base | 0.05 V/s, 0.001 A, 0.001 m², 100 mol/m³, 100000 Hz |
| Temperature | °C in both | Electrochemistry convention |
The IR generator handles all unit conversions automatically.
Hardware Profiles
Built-in profiles for common potentiostats:
- Gamry Interface 1010E / 1010B
- BioLogic SP-300
- PalmSens4
- Pine WaveDrive
- Mock (for testing/dry-run)
Profiles define supported techniques, voltage/current ranges, and frequency limits for L4 validation.
Standard Protocols
Pre-built protocol templates following published standards:
- DOE — ORR catalyst, OER catalyst, catalyst support durability
- JRC — PEM electrolysis, alkaline electrolysis
Quality
| Metric | Value |
|---|---|
| Tests | 1,196 |
| Coverage | 100% |
| Type checking | mypy --strict, 0 errors |
| Linting | ruff, 0 violations |
Development
# Install in development mode
pip install -e ".[dev]"
# Run all quality gates
make all # lint + typecheck + test
# Individual commands
make test # pytest with coverage
make lint # ruff check + format check
make typecheck # mypy --strict
make fmt # auto-fix lint + format
make clean # remove caches
Project Structure
ecproc/
├── src/ecproc/
│ ├── cli/ # 8 CLI commands (Typer)
│ ├── ecdl/ # ECDL record generation + validation
│ ├── hardware_profiles/ # Potentiostat JSON profiles
│ ├── ir/ # Faraday IR schema, generator, serializer
│ ├── parser/ # YAML + Python SDK parsers → AST
│ ├── protocols/ # DOE + JRC standard protocol templates
│ ├── sdk/ # Programmatic procedure builder + techniques
│ ├── targets/ # Python runtime + manual (Markdown/PDF)
│ ├── utils/ # Units, time, logging
│ └── validator/ # 4-layer validation engine
├── tests/ # 1,196 tests across 57 test files
├── schemas/ # JSON schemas (ECDL, Faraday IR, ecproc, hardware)
├── examples/ # Example .ecproc, .py, and .ecdl.json files
├── docs/ # MkDocs documentation
└── .github/workflows/ # CI: test, lint, docs, release
License
Apache 2.0
Metadata
Release files for ecproc 0.1.0
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 |
|---|---|---|---|---|
| ecproc-0.1.0.tar.gz | 181.9 kB | Without provenance | Details for ecproc-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ecproc-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for ecproc-0.1.0-py3-none-any.whl |
Total release size: 279.5 kB
Release files / ecproc-0.1.0.tar.gz
| Download URL | ecproc-0.1.0.tar.gz |
|---|---|
| Size | 181.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f362aea6eedd4513c77a29d6880d7ef7a4eecefb1ec5f7f51aa9242597c1a1ff
|
|
BLAKE2b-256 checksum How to use checksums |
6a759de53ddec5bb33130c7cc99ad5f25bab9ba0f50cc5ae32ff045ba1e610d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / ecproc-0.1.0-py3-none-any.whl
| Download URL | ecproc-0.1.0-py3-none-any.whl |
|---|---|
| Size | 97.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e6d5511b0cb844bdb4be6879532e43bdd4d8367594262d0316068a710fdc648e
|
|
BLAKE2b-256 checksum How to use checksums |
3d049232d767279a34945ebb838edc3c8c96c972ee0203c05d4b239492fd5b71
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Security for ecproc 0.1.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.