Conversation
The proposed changes enable loading external plugins via standard python packages "pip install X". These changes affect the r2x package somewhat broadly and careful review is necessary. The PluginManager object is a Singleton Class that is responsible for hosting a variety of Class and function objects internal and external to R2X. These objects include the following: - Parsers (ReEDSParser, PlexosParser, ...) - Model Configurations - Exporters - Filter Functions [Callable or str] - DefaultFile objects The components above are put together in a PluginComponent object that external users can define. The plugin manager looks for entry_points of "r2x_plugin" and loads a function that should create a dictionary of name: PluginComponents to register. R2X contains many default files which are now captured in the DefaultFile class. This class automatically generates the full file path of a default json file so that R2X can find it in either an internal or external package. DefaultFiles also include field mappings. The PluginManager also registers several types of callable functions. Namely, CLI functions, "filter funcs", and "update_system" functions. The PluginManager does this through decorators and importing the functions upon initialization to register them. This allows external users to define their own functions, and, so long as they are included in the external modules entry point, they will automatically be registered. The PluginManger can be used in two different ways. First, you can simply import the PluginManager class to add decorators to functions that you wish to register. (For internal functions, this also requires updating the PluginManager intialization method to import the functions you want to register.). The second way is to create the singleton instance of the PluginManger to get plugin components (parser, exporters, configs, filter_funcs, cli_functions, and system_updates) Although pluggy has some nice features around hook specifications. It would still require making a plugin managment system to register those hooks. More importantly, given the coupling between parsers, configurations, exporters and default files, it seemed more straightforward to write a custom plugin management system. Even though pluggy could handle cli, filter and update functions, it was simple enough to add that same functionality into the PluginManager. --------- Co-authored-by: pesap <pesap@users.noreply.github.com>
- Fixed the plugin_manager to use a the current script path and relative navigation to load the sysmods in the /plugins directory. - Added pytest-xdist to the dev dependencies so you can run tests in parallel with `pytest -n auto`
Signed-off-by: pesap <pesap@users.noreply.github.com> Co-authored-by: pesap <pesap@users.noreply.github.com> Co-authored-by: Jarrad Wright <jwright2@nrel.gov> Co-authored-by: mcllerena <marckcode@gmail.com> Co-authored-by: Marck Llerena V <140716266+mcllerena@users.noreply.github.com>
Signed-off-by: pesap <pesap@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces v2.0.0 with a major architectural refactor that implements a centralized plugin management system to replace the previous distributed module-based approach.
- Introduces a new PluginManager system with singleton pattern for centralized plugin registration and discovery
- Refactors all plugins to use decorator-based registration instead of module imports
- Updates function signatures across plugins to standardize
parserparameter placement and typing
Reviewed Changes
Copilot reviewed 51 out of 52 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| user_dict.yaml | Adds example configuration file with various usage patterns for model configuration |
| src/r2x/plugin_manager/ | New plugin management system with centralized registration and discovery |
| src/r2x/plugins/*.py | Updates all plugins to use decorator-based registration with PluginManager |
| src/r2x/runner.py | Refactors to use PluginManager instead of direct module imports |
| tests/test_*.py | Updates test files to match new plugin architecture and API changes |
| src/r2x/models/getters.py | New getter functions with singledispatch for component property access |
Comments suppressed due to low confidence (1)
src/r2x/plugins/break_gens.py:213
- [nitpick] The parameter name
attris ambiguous. Consider renaming it toattributeorvalueto be more descriptive of its purpose.
def _apply_new_value(attr: Any, proportion: float):
…ity. (#209) Plexos test is broken and will be migrated to r2x-plexos eventually. --------- Signed-off-by: pesap <pesap@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This branch was created from Micah's v2.0.0 branch and has certain PlexosExporter specific changes to allow for the successful creation of the XML file. It also updates minimum dependency versions of PlexosDB to ensure it works with the r2x-plexos plugin. --------- Signed-off-by: pesap <pesap@users.noreply.github.com> Signed-off-by: Kinshuk Panda <kinshukpanda@gmail.com> Co-authored-by: Micah Webb <webbmp91@gmail.com> Co-authored-by: pesap <pesap@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: pesap <pesap@users.noreply.github.com> Co-authored-by: mcllerena <marckcode@gmail.com>
…es (#222) Signed-off-by: Marck Llerena V. <140716266+mcllerena@users.noreply.github.com> Co-authored-by: pesap <pesap@users.noreply.github.com>
Signed-off-by: Marck Llerena V. <140716266+mcllerena@users.noreply.github.com> Co-authored-by: pesap <pesap@users.noreply.github.com> Co-authored-by: Srihari Sundar <hari.sundar@nrel.gov>
- Adds entry point to pyproject.toml for plugin discovery. - Adds "run" method to PluginSpec.
This was referenced Apr 8, 2026
pesap
added a commit
that referenced
this pull request
Apr 8, 2026
BREAKING CHANGE: Replace monolithic parser/exporter with plugin architecture. - Introduce R2X Plugin Management System with discoverable plugin configs - Restructure into four independent packages under packages/: r2x-reeds-to-sienna, r2x-reeds-to-plexos, r2x-sienna-to-plexos, r2x-plexos-to-sienna - Extract parsing/exporting into separate model plugins, translations are now pure mapping logic - Overhaul CI/CD with per-package release-please, dependabot, auto-labeler, and commit linting - Add taplo (TOML linting), ty (type checking), and updated pre-commit hooks - Expand test coverage across all translation packages (getters, rules, utilities) - Fix min stable level zeroing, duplicated arcs, time series store, and template injection bugs - Fix smoke test to build all workspace packages locally for dependency resolution - Rewrite documentation to match new framework style and update README --------- Signed-off-by: pesap <pesap@users.noreply.github.com> Signed-off-by: Kinshuk Panda <kinshukpanda@gmail.com> Signed-off-by: Marck Llerena V. <140716266+mcllerena@users.noreply.github.com> Co-authored-by: Micah Webb <6476273+micahpw@users.noreply.github.com> Co-authored-by: Jarrad Wright <jarry7@gmail.com> Co-authored-by: Jarrad Wright <jwright2@nrel.gov> Co-authored-by: mcllerena <marckcode@gmail.com> Co-authored-by: Marck Llerena V <140716266+mcllerena@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Kinshuk Panda <kinshukpanda@gmail.com> Co-authored-by: Micah Webb <webbmp91@gmail.com> Co-authored-by: Srihari Sundar <hari.sundar@nrel.gov> Co-authored-by: mvelasqu <marck.velasquez@nrel.gov>
pesap
pushed a commit
that referenced
this pull request
Apr 8, 2026
🤖 I have created a release *beep* *boop* --- ## 0.1.0 (2026-04-08) ### ⚠ BREAKING CHANGES * Replace monolithic parser/exporter with plugin architecture. - Introduce R2X Plugin Management System with discoverable plugin configs - Restructure into four independent packages under packages/: r2x-reeds-to-sienna, r2x-reeds-to-plexos, r2x-sienna-to-plexos, r2x-plexos-to-sienna - Extract parsing/exporting into separate model plugins, translations are now pure mapping logic - Overhaul CI/CD with per-package release-please, dependabot, auto-labeler, and commit linting - Add taplo (TOML linting), ty (type checking), and updated pre-commit hooks - Expand test coverage across all translation packages (getters, rules, utilities) - Fix min stable level zeroing, duplicated arcs, time series store, and template injection bugs - Fix smoke test to build all workspace packages locally for dependency resolution - Rewrite documentation to match new framework style and update README ### Features * v2.0.0 ([#187](#187)) ([161bcc9](161bcc9)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
pesap
pushed a commit
that referenced
this pull request
Apr 8, 2026
🤖 I have created a release *beep* *boop* --- ## 0.1.0 (2026-04-08) ### ⚠ BREAKING CHANGES * Replace monolithic parser/exporter with plugin architecture. - Introduce R2X Plugin Management System with discoverable plugin configs - Restructure into four independent packages under packages/: r2x-reeds-to-sienna, r2x-reeds-to-plexos, r2x-sienna-to-plexos, r2x-plexos-to-sienna - Extract parsing/exporting into separate model plugins, translations are now pure mapping logic - Overhaul CI/CD with per-package release-please, dependabot, auto-labeler, and commit linting - Add taplo (TOML linting), ty (type checking), and updated pre-commit hooks - Expand test coverage across all translation packages (getters, rules, utilities) - Fix min stable level zeroing, duplicated arcs, time series store, and template injection bugs - Fix smoke test to build all workspace packages locally for dependency resolution - Rewrite documentation to match new framework style and update README ### Features * v2.0.0 ([#187](#187)) ([161bcc9](161bcc9)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
pesap
added a commit
that referenced
this pull request
Apr 8, 2026
🤖 I have created a release *beep* *boop* --- ## 0.1.0 (2026-04-08) ### ⚠ BREAKING CHANGES * Replace monolithic parser/exporter with plugin architecture. - Introduce R2X Plugin Management System with discoverable plugin configs - Restructure into four independent packages under packages/: r2x-reeds-to-sienna, r2x-reeds-to-plexos, r2x-sienna-to-plexos, r2x-plexos-to-sienna - Extract parsing/exporting into separate model plugins, translations are now pure mapping logic - Overhaul CI/CD with per-package release-please, dependabot, auto-labeler, and commit linting - Add taplo (TOML linting), ty (type checking), and updated pre-commit hooks - Expand test coverage across all translation packages (getters, rules, utilities) - Fix min stable level zeroing, duplicated arcs, time series store, and template injection bugs - Fix smoke test to build all workspace packages locally for dependency resolution - Rewrite documentation to match new framework style and update README ### Features * v2.0.0 ([#187](#187)) ([161bcc9](161bcc9)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Signed-off-by: pesap <pesap@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: pesap <pesap@users.noreply.github.com>
pesap
added a commit
that referenced
this pull request
Apr 8, 2026
🤖 I have created a release *beep* *boop* --- ## 0.1.0 (2026-04-08) ### ⚠ BREAKING CHANGES * Replace monolithic parser/exporter with plugin architecture. - Introduce R2X Plugin Management System with discoverable plugin configs - Restructure into four independent packages under packages/: r2x-reeds-to-sienna, r2x-reeds-to-plexos, r2x-sienna-to-plexos, r2x-plexos-to-sienna - Extract parsing/exporting into separate model plugins, translations are now pure mapping logic - Overhaul CI/CD with per-package release-please, dependabot, auto-labeler, and commit linting - Add taplo (TOML linting), ty (type checking), and updated pre-commit hooks - Expand test coverage across all translation packages (getters, rules, utilities) - Fix min stable level zeroing, duplicated arcs, time series store, and template injection bugs - Fix smoke test to build all workspace packages locally for dependency resolution - Rewrite documentation to match new framework style and update README ### Features * v2.0.0 ([#187](#187)) ([161bcc9](161bcc9)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Signed-off-by: pesap <pesap@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: pesap <pesap@users.noreply.github.com>
pesap
pushed a commit
that referenced
this pull request
Apr 8, 2026
🤖 I have created a release *beep* *boop* --- ## [2.0.0](r2x-v1.2.0...r2x-v2.0.0) (2026-04-08) ### ⚠ BREAKING CHANGES * Replace monolithic parser/exporter with plugin architecture. - Introduce R2X Plugin Management System with discoverable plugin configs - Restructure into four independent packages under packages/: r2x-reeds-to-sienna, r2x-reeds-to-plexos, r2x-sienna-to-plexos, r2x-plexos-to-sienna - Extract parsing/exporting into separate model plugins, translations are now pure mapping logic - Overhaul CI/CD with per-package release-please, dependabot, auto-labeler, and commit linting - Add taplo (TOML linting), ty (type checking), and updated pre-commit hooks - Expand test coverage across all translation packages (getters, rules, utilities) - Fix min stable level zeroing, duplicated arcs, time series store, and template injection bugs - Fix smoke test to build all workspace packages locally for dependency resolution - Rewrite documentation to match new framework style and update README ### Features * add check_solve_year method and add it to reeds parser test ([#158](#158)) ([366d7c4](366d7c4)) * Add compatibility with more operational cost representation on Plexos ([#40](#40)) ([77dfceb](77dfceb)) * Add functions to convert recf.h5 to new hdf5 format from ReEDS ([#115](#115)) ([cd0863e](cd0863e)) * Add hurdle rate plugin for ReEDS2Plexos ([#60](#60)) ([c0d28f6](c0d28f6)) * Add new function that creates an instance of a model with the option to skip validation ([#110](#110)) ([dab93ff](dab93ff)) * Add ReEDS parser to the public version and some Plexos exporter fixes ([#43](#43)) ([d1a61f0](d1a61f0)) * Adding `smr` technology from ReEDS. ([#197](#197)) ([0f938e3](0f938e3)) * Adding cambium and electrolyzer plugin ([#135](#135)) ([966e5ac](966e5ac)) * Adding new CLI entrypoints and better handling of scenarios ([#94](#94)) ([45cda9b](45cda9b)) * Adding updated version of timeseries exporter and dispatch methods to get year from different models ([#125](#125)) ([b3d4b3d](b3d4b3d)) * Cost Function definition and export fixes ([#24](#24)) ([eec9cb6](eec9cb6)) * export fuel curves for plexos ([#77](#77)) ([bd651e4](bd651e4)) * First draft of ThermalMultiStart struct ([#148](#148)) ([81dda11](81dda11)) * Implements ValueCurves & Improve Prime Mover and Fuel Type Mapping ([#12](#12)) ([fcc37c0](fcc37c0)) * improve imports fuel costs ([#13](#13)) ([c169f1b](c169f1b)) * **models:** Updating PHES to reflect latest version of PSY. ([#144](#144)) ([46ac96e](46ac96e)) * Multiple updates to the Plexos parser ([#47](#47)) ([bf284f2](bf284f2)) * New emission_cap plugin that sets a custom constraint for Plexos output model. ([#57](#57)) ([9114586](9114586)) * **plexos:** Adding parsing of `year,month,day` files from plexos ([#175](#175)) ([1af4b33](1af4b33)) * **plexos:** plexos parser xml ([#93](#93)) ([835e904](835e904)) * **plugins:** Adding CCS plugin for ReDS and Plexos translation ([#95](#95)) ([73087e2](73087e2)) * Update issue templates ([ece260b](ece260b)) * Update runner to UV ([#80](#80)) ([03c5e05](03c5e05)) * v2.0.0 ([#187](#187)) ([161bcc9](161bcc9)) ### Bug Fixes * Add correct sorting for plexos files with TS_NYMDH and caching better the data files. ([#152](#152)) ([196f0d9](196f0d9)) * Add special handling for load.h5 on ReEDS. ([#149](#149)) ([5701526](5701526)) * Added correct unit validation for `FuelPrice` ([#86](#86)) ([1f4f0b1](1f4f0b1)), closes [#83](#83) * Adding capability to filter by weather year instead of indexing ([#160](#160)) ([e70f2e0](e70f2e0)) * Adding datetime fix for h5files ([#174](#174)) ([9199cf3](9199cf3)) * Adding missing exports from models ([#154](#154)) ([2b67581](2b67581)) * Cambium fixes and upgrader fixes ([#119](#119)) ([f926bb4](f926bb4)) * change co2_cap column name to tonne_per_year ([#138](#138)) ([553570a](553570a)) * Changed `BaseUnit` and description for `fixed` field for `ThermalGenerationCost` ([#79](#79)) ([d2a2140](d2a2140)), closes [#76](#76) * Changing time series name for Regulation reserves ([#145](#145)) ([b0efb89](b0efb89)) * Cleaning configuration file for plexos and adding more testing ([#11](#11)) ([dee6edc](dee6edc)) * Compatibility fixes for standard scenarios ([#62](#62)) ([fc505d2](fc505d2)) * Correct parsing of TS_NMDH for plexos parser ([#100](#100)) ([8fd1a9c](8fd1a9c)) * Correctly assign `output_active_power_limits` ([#59](#59)) ([cc76cf2](cc76cf2)), closes [#58](#58) * **docs:** Update README.md ([249ab1b](249ab1b)) * Enable round trip from plexos ([#128](#128)) ([a16ea32](a16ea32)) * **enums:** Uppercase all enums to be compliant with other languages. ([#29](#29)) ([98c2a60](98c2a60)), closes [#17](#17) * hmap_myr.csv and can_imports_quarter_frac.csv for ReEDS compatibility ([#151](#151)) ([c85fd06](c85fd06)) * Improve PSY compatibility and incorporate changes to infrasys and data modeling ([#112](#112)) ([8a61169](8a61169)) * Infrasys json serialization and compatibiility fixes ([#106](#106)) ([40137fd](40137fd)) * Make ReEDS parser compatible with new cost functions ([#44](#44)) ([0e09279](0e09279)) * **plexos_export:** Added `coalduns` mapping to ReEDS and adding line flow exporter ([#55](#55)) ([b8cc616](b8cc616)) * **plexos:** Ext data export, Variable defaults, and Data File Scenario Filtering ([#38](#38)) ([e963011](e963011)) * **plexos:** Fix Rating and Availability Logic ([#8](#8)) ([2658b67](2658b67)) * ReEDS compatibility changes ([#114](#114)) ([b0ef7de](b0ef7de)) * **reeds:** Adding more technologies and better logging for renewable profile. ([#157](#157)) ([708a9d5](708a9d5)) * **reeds:** Adding new reeds_tech `coal-new_coal-ccs_mod` ([#156](#156)) ([a73bc7e](a73bc7e)) * **reeds:** Correct upgrader function for load.h5 ([#143](#143)) ([e962dec](e962dec)) * Removing old reference to named tuples and core packages and improving upgrader. ([#170](#170)) ([b93efad](b93efad)) * Reverting file name to use the seasons instead of quarters ([#155](#155)) ([339ec9a](339ec9a)) * Sienna exporter incompatibility when starting from ReEDS ([#108](#108)) ([05befac](05befac)) * update file name for planned outages from ReEDS ([#49](#49)) ([a07253e](a07253e)) * Update link on README ([e02aca5](e02aca5)) * Updating codebase to match internal ([#16](#16)) ([cd4d606](cd4d606)) * variable scenario filtering, and availability TS multiplier ([#91](#91)) ([0b37690](0b37690)) ### Documentation * Adding first version of documentation ([#42](#42)) ([d893a6a](d893a6a)) * Remove missing link for image ([#196](#196)) ([baea8a1](baea8a1)) * Removing references to other repo. ([9910834](9910834)) * Update README.md ([ac9971c](ac9971c)) ### CI/CD * **actions:** Added GitHub actions to the repo ([#6](#6)) ([eec81bb](eec81bb)) * Add capability to run the CI manually ([2332c31](2332c31)) * Add codecoverage ([eec2c24](eec2c24)) * Adding action on push to main ([a524c6e](a524c6e)) * Adding new way of making releases ([#140](#140)) ([14d7359](14d7359)) * Adding publish to pypy ([6dae411](6dae411)) ### Build * **deps:** bump actions/upload-artifact from 4.6.2 to 7.0.0 ([#249](#249)) ([4eb4301](4eb4301)) * **deps:** bump astral-sh/setup-uv from 7.6.0 to 8.0.0 ([#247](#247)) ([d8f3cdc](d8f3cdc)) * **deps:** bump codecov/codecov-action from 5.5.4 to 6.0.0 ([#248](#248)) ([1b7acb5](1b7acb5)) * **deps:** bump pypa/gh-action-pypi-publish from 1.13.0 to 1.14.0 ([#250](#250)) ([bb1fc94](bb1fc94)) ### Tests * Added PJM test system and fixed enum representation to be just string. ([#21](#21)) ([1277159](1277159)) * **codecov:** Adding codecov file ([#92](#92)) ([959ef4d](959ef4d)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related