SQLite API for plexos XMLs
Project description
plexosdb
SQLite-backed Python API for reading, building, and writing PLEXOS XML models
plexosdb converts PLEXOS XML input files into an in-memory SQLite database, giving you a fast, typed Python API to query, create, and modify power system models programmatically, then write them back to XML.
Installation
pip install plexosdb
Or with uv:
uv add plexosdb
Python version support: 3.11, 3.12, 3.13, 3.14
Quick Start
from plexosdb import PlexosDB, ClassEnum, CollectionEnum
# Load a PLEXOS XML file into an in-memory SQLite database
db = PlexosDB.from_xml("model.xml")
# Query existing objects
generators = db.get_object_names(ClassEnum.Generator)
# Add new objects
db.add_object(ClassEnum.Generator, name="SolarPV_01", category="Renewables")
db.add_object(ClassEnum.Node, name="Bus_1")
# Create memberships between objects
db.add_membership(
CollectionEnum.GeneratorNodes,
parent_class=ClassEnum.Generator,
parent_name="SolarPV_01",
child_class=ClassEnum.Node,
child_name="Bus_1",
)
# Export the modified model back to XML
db.to_xml("modified_model.xml")
Documentation
Full documentation is available at natlabrockies.github.io/plexosdb.
Developer Setup
plexosdb uses uv for dependency management.
git clone https://github.com/NatLabRockies/plexosdb.git
cd plexosdb
uv sync --all-groups
Install the git hooks so your code is checked before making commits:
uv run prek install
Run the test suite:
uv run pytest
License
This software is released under a BSD-3-Clause License.
This software was developed under software record SWR-24-90 at the National Renewable Energy Laboratory (NREL).
Disclaimer
PLEXOS is a registered trademark of Energy Exemplar Pty Ltd. Energy Exemplar Pty Ltd. has no affiliation to or participation in this software. Reference herein to any specific commercial products, process, or service by trade name, trademark, manufacturer, or otherwise, does not necessarily constitute or imply its endorsement, recommendation, or favoring by the United States Government or Alliance for Sustainable Energy, LLC ("Alliance"). The views and opinions of authors expressed in the available or referenced documents do not necessarily state or reflect those of the United States Government or Alliance.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file plexosdb-1.3.4.tar.gz.
File metadata
- Download URL: plexosdb-1.3.4.tar.gz
- Upload date:
- Size: 51.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d2b1811558440ba5da38f6138cde1a995eed2353d347f1595bfbe77c6107328
|
|
| MD5 |
a26a68b64953f88bb1ee940107d4a681
|
|
| BLAKE2b-256 |
e6d028327bb8c46911fdb01675500fc21660255d58112c9b4b3396785961cc15
|
Provenance
The following attestation bundles were made for plexosdb-1.3.4.tar.gz:
Publisher:
release.yaml on NatLabRockies/plexosdb
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
plexosdb-1.3.4.tar.gz -
Subject digest:
0d2b1811558440ba5da38f6138cde1a995eed2353d347f1595bfbe77c6107328 - Sigstore transparency entry: 1187933490
- Sigstore integration time:
-
Permalink:
NatLabRockies/plexosdb@69aaf25157dc5e61b05a4c3631302342ad086f6e -
Branch / Tag:
refs/heads/main - Owner: https://github.com/NatLabRockies
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@69aaf25157dc5e61b05a4c3631302342ad086f6e -
Trigger Event:
push
-
Statement type:
File details
Details for the file plexosdb-1.3.4-py3-none-any.whl.
File metadata
- Download URL: plexosdb-1.3.4-py3-none-any.whl
- Upload date:
- Size: 55.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91074d43d20e34d9f6a43f4d0b0841a1bbb66ddde9c1c96822a123659e2bd857
|
|
| MD5 |
35195c46dd4a05be1692834bcff8f8cf
|
|
| BLAKE2b-256 |
c18279ca218dcdc1afd00efdd52c28c16dbb2ec6a7726cc7764a9f820f93ca69
|
Provenance
The following attestation bundles were made for plexosdb-1.3.4-py3-none-any.whl:
Publisher:
release.yaml on NatLabRockies/plexosdb
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
plexosdb-1.3.4-py3-none-any.whl -
Subject digest:
91074d43d20e34d9f6a43f4d0b0841a1bbb66ddde9c1c96822a123659e2bd857 - Sigstore transparency entry: 1187933495
- Sigstore integration time:
-
Permalink:
NatLabRockies/plexosdb@69aaf25157dc5e61b05a4c3631302342ad086f6e -
Branch / Tag:
refs/heads/main - Owner: https://github.com/NatLabRockies
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@69aaf25157dc5e61b05a4c3631302342ad086f6e -
Trigger Event:
push
-
Statement type: