Skip to main content

SQLite API for plexos XMLs

Project description

plexosdb

SQLite-backed Python API for reading, building, and writing PLEXOS XML models

image image image CI codecov Ruff Documentation

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

plexosdb-1.4.0.tar.gz (53.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

plexosdb-1.4.0-py3-none-any.whl (57.7 kB view details)

Uploaded Python 3

File details

Details for the file plexosdb-1.4.0.tar.gz.

File metadata

  • Download URL: plexosdb-1.4.0.tar.gz
  • Upload date:
  • Size: 53.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for plexosdb-1.4.0.tar.gz
Algorithm Hash digest
SHA256 5e17a6ea359933cf0e33d8e55b370cc55f673c1a3fc7d0f7d9bb46376aee1501
MD5 bc13c42e0194e32b63e98a6253f4eae2
BLAKE2b-256 adfdcb1fe2cabb7de8e1ca0768e894333e2757b97f1b7b7a66e310acfc3e1ca1

See more details on using hashes here.

Provenance

The following attestation bundles were made for plexosdb-1.4.0.tar.gz:

Publisher: release.yaml on NatLabRockies/plexosdb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file plexosdb-1.4.0-py3-none-any.whl.

File metadata

  • Download URL: plexosdb-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 57.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for plexosdb-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3529816b4bec77618f17cb77f7be4d1e7aeb0b5a33b83ba06b47eb9c6247d949
MD5 4167530bc6d2b8fa97c06aa5630a1cd1
BLAKE2b-256 373c4c15b6a34b1626dfe23581d4df0eaeca80ac6c79a7af162394f258be1c30

See more details on using hashes here.

Provenance

The following attestation bundles were made for plexosdb-1.4.0-py3-none-any.whl:

Publisher: release.yaml on NatLabRockies/plexosdb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page