Metadata-Version: 2.3
Name: r2x-plexos
Version: 0.3.0
Summary: Plexos Models, Parser and Exporter
Keywords: PLEXOS
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Topic :: File Formats :: JSON
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Classifier: Topic :: Scientific/Engineering :: Interface Engine/Protocol Translator
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Dist: plexosdb>=1.6.0
Requires-Dist: r2x-core>=0.4.0,<1.0.0
Requires-Python: >=3.11, <3.14
Project-URL: Changelog, https://nrel.github.io/r2x-plexos/CHANGELOG.html
Project-URL: Documentation, https://nrel.github.io/r2x-plexos/
Project-URL: Homepage, https://github.com/NREL/r2x-plexos
Project-URL: Issues, https://github.com/NREL/r2x-plexos/issues
Project-URL: Repository, https://github.com/NREL/r2x-plexos
Description-Content-Type: text/markdown

# r2x-plexos

> R2X plug-in for translating to and from PLEXOS XML databases.
>
> [![image](https://img.shields.io/pypi/v/r2x.svg)](https://pypi.python.org/pypi/r2x-plexos)
> [![image](https://img.shields.io/pypi/l/r2x.svg)](https://pypi.python.org/pypi/r2x-plexos)
> [![image](https://img.shields.io/pypi/pyversions/r2x.svg)](https://pypi.python.org/pypi/r2x-plexos)
> [![CI](https://github.com/NREL/r2x/actions/workflows/CI.yaml/badge.svg)](https://github.com/NREL/r2x/actions/workflows/ci.yaml)
> [![codecov](https://codecov.io/gh/NREL/r2x-plexos/branch/main/graph/badge.svg)](https://codecov.io/gh/NREL/r2x-plexos)
> [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
> [![Documentation](https://github.com/NREL/r2x-plexos/actions/workflows/docs.yaml/badge.svg?branch=main)](https://nrel.github.io/r2x-plexos/)
> [![Docstring Coverage](https://nrel.github.io/r2x-plexos/_static/docstr_coverage_badge.svg)](https://nrel.github.io/r2x-plexos/)


R2X PLEXOS plugin for parsing and exporting PLEXOS power system models.

## Quick Start

### Installation

```bash
uv add r2x-plexos
```

### Parsing PLEXOS XML

```python
from pathlib import Path
from r2x_core import (
    DataFile,
    DataStore,
    PluginContext,
    Rule,
    System,
    apply_rules_to_context,
)
from r2x_plexos import PLEXOSParser, PLEXOSConfig

xml_path = /path/to/xml
db = PlexosDB.from_xml(xml_path)
model_names = db.list_objects_by_class(ClassEnum.Model)
model_name = model_names[1] if model_names else "Base"

plexos_config = PLEXOSConfig(
    model_name=model_name,
    horizon_year=2012,
    models=("r2x_plexos.models", "r2x_sienna.models"),)
data_file = DataFile(name="xml_file", fpath=xml_path)
store = DataStore(path=folder_path)
store.add_data([data_file])

context = PluginContext(
    config=plexos_config,
    store=store
)
parser = PLEXOSParser.from_context(context)
plexos_sys_result = parser.run()
plexos_sys = plexos_sys_result.system
context.source_system = plexos_sys
```

## Documentation Sections

- [Tutorials](https://nrel.github.io/r2x-plexos/tutorials/) - Step-by-step learning guides
- [How-To Guides](https://nrel.github.io/r2x-plexos/how-tos/) - Task-focused recipes
- [Explanations](https://nrel.github.io/r2x-plexos/explanations/) - Architecture and design
- [References](https://nrel.github.io/r2x-plexos/explanations/references/) - API and configuration reference

## Roadmap

If you're curious about what we're working on, check out the roadmap:

- [Active issues](https://github.com/NREL/r2x-core/issues?q=is%3Aopen+is%3Aissue+label%3A%22Working+on+it+%F0%9F%92%AA%22+sort%3Aupdated-asc): Issues that we are actively working on.
- [Prioritized backlog](https://github.com/NREL/r2x-core/issues?q=is%3Aopen+is%3Aissue+label%3ABacklog): Issues we'll be working on next.
- [Nice-to-have](https://github.com/NREL/r2x-core/labels/Optional): Nice to have features or Issues to fix. Anyone can start working on (please let us know before you do).
- [Ideas](https://github.com/NREL/r2x-core/issues?q=is%3Aopen+is%3Aissue+label%3AIdea): Future work or ideas for R2X Core.
