r2x-sienna
Translate Sienna PSY JSON models to and from the R2X ecosystem.
r2x-sienna is an R2X Core
plugin for reading Sienna/PowerSystems JSON data into typed
infrasys.System objects and writing those systems back to PSY-compatible JSON.
It supports Python workflows and repeatable r2x CLI pipelines.
What it does
- Parse Sienna models: Read PSY JSON components, references, supplemental attributes, and time-series metadata.
- Export R2X systems: Write PSY-compatible JSON with supplemental attributes and optional HDF5 time-series storage.
- Upgrade legacy data: Apply ordered schema transformations and migrate legacy HDF5 metadata before parsing.
- Round-trip models: Parse, inspect or transform a system, then export it again in Sienna-compatible form.
- Provide typed models: Expose topology, branch, generation, load, service, cost, attribute, enum, and unit definitions.
- Compose pipelines: Connect the Sienna parser and exporter with other R2X plugins through YAML pipelines.
Installation
Using uv:
uv add r2x-sienna
Or using pip:
python -m pip install r2x-sienna
The package supports Python 3.11, 3.12, and 3.13. To verify installation and plugin discovery:
python -c "import r2x_sienna; print(r2x_sienna.__version__)"
r2x list
The CLI executable is r2x. Its discovered plugin names include
sienna-parser and sienna-exporter.
Python quick start
Parse a Sienna JSON system
The parser is initialized with an R2X Core PluginContext. The parser runs
registered Sienna upgrades when json_path is provided.
from pathlib import Path
from r2x_core import DataStore, PluginContext
from r2x_sienna import SiennaConfig, SiennaParser
json_path = Path("input/system.json")
config = SiennaConfig(
json_path=str(json_path),
model_year=2029,
system_name="PJM-5",
)
context = PluginContext(config=config, store=DataStore(path=json_path.parent))
result_context = SiennaParser.from_context(context).run()
system = result_context.system
if system is None:
raise RuntimeError("No system returned")
print(system.name)
Export a system to Sienna PSY JSON
Pass the parsed or transformed system to the exporter through a context. HDF5 time-series storage is exported alongside the JSON by default.
from pathlib import Path
from r2x_core import DataStore, PluginContext
from r2x_sienna import SiennaExporter, SiennaExporterConfig
output_path = Path("output/system.json")
config = SiennaExporterConfig(output_path=str(output_path))
context = PluginContext(
config=config,
system=system,
store=DataStore(path=output_path.parent),
)
SiennaExporter.from_context(context).run()
Set exporter.should_export_time_series = False before run() when only JSON
output is needed.
Upgrade a system independently
Use SiennaUpgrader when data must be upgraded before building a parser context:
from pathlib import Path
from r2x_core import UpgradeType
from r2x_sienna import SiennaUpgrader
result = SiennaUpgrader(Path("input/system.json")).upgrade(
upgrade_type=UpgradeType.SYSTEM,
)
if result.is_err():
raise RuntimeError(result.err())
R2X CLI pipelines
Use a pipeline when parsing, transformations, and exporting should run as one reproducible workflow. Create a starter file with:
r2x init sienna-pipeline.yaml
The following example parses a Sienna system and exports it again:
variables:
input_json: /data/input/system.json
output_json: /data/output/system.json
system_name: PJM-5
model_year: 2029
pipelines:
round_trip:
- r2x-sienna.sienna-parser
- r2x-sienna.sienna-exporter
config:
r2x-sienna.sienna-parser:
json_path: ${input_json}
system_name: ${system_name}
model_year: ${model_year}
r2x-sienna.sienna-exporter:
output_path: ${output_json}
output_folder: /data/output
Inspect and run the pipeline with:
r2x list
r2x run sienna-pipeline.yaml round_trip --print
r2x run sienna-pipeline.yaml round_trip --dry-run
r2x run sienna-pipeline.yaml round_trip
Transformations from other R2X plugins can be inserted between the parser and
exporter. Use r2x list to find installed plugin references.
For direct plugin usage and schema-generated options:
r2x run plugin sienna-parser --show-help
r2x run plugin sienna-exporter --show-help
Documentation
The complete documentation includes tutorials, task-focused recipes, architecture explanations, API details, model catalogs, upgrader behavior, and pipeline examples:
Development
Install development dependencies from source:
git clone https://github.com/NatLabRockies/r2x-sienna.git
cd r2x-sienna
uv sync --all-groups
Run the same checks used in CI:
uv run prek run --all-files --hook-stage pre-push
Targeted commands:
uv run pytest -q -m "not slow" --maxfail=1 --disable-warnings
uv run ty check ./src/r2x_sienna/
Contributing
License
This project is distributed under the BSD 3-Clause License.
Metadata
Release files for r2x-sienna 0.5.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 | |
|---|---|---|---|
| r2x_sienna-0.5.0.tar.gz | 64.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| r2x_sienna-0.5.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 138.8 kB
Release files / r2x_sienna-0.5.0.tar.gz
| Download URL | r2x_sienna-0.5.0.tar.gz |
|---|---|
| Size | 64.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2af80421aef56b36741f84f68781473bb669140d03afa201ed18beeeb8b2190f
|
|
BLAKE2b-256 checksum How to use checksums |
b04cde43ef6bf8e310fedfa3bbd0d742d3255a972be889c1ce1b9ce1c93ab0d2
|
| 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 Sep 15, 2026.
Transparency logRelease files / r2x_sienna-0.5.0-py3-none-any.whl
| Download URL | r2x_sienna-0.5.0-py3-none-any.whl |
|---|---|
| Size | 74.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
86319226dc2ab68fe7b220572e3e683b77d8e8ea2adbd10e95d2643c47990717
|
|
BLAKE2b-256 checksum How to use checksums |
b45e878ab321ced43feec22dee9a27313aef669b4cd0d1038b4663f79f274c77
|
| 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 Sep 15, 2026.
Transparency log