
Research
Supply Chain Attack on Axios Pulls Malicious Dependency from npm
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.
r2x-core
Advanced tools
Extensible framework for building power system model translators with plugin architecture
Extensible framework for power system model translation
R2X Core is a model-agnostic framework for building power system model translators. It provides the core infrastructure, data models, plugin architecture, and APIs that enable translation between different power system modeling platforms.
R2X Core serves as the foundation for building translators between power system models like ReEDS, PLEXOS, SWITCH, Sienna, and more. It provides a plugin-based architecture where you can register parsers, exporters, and transformations to create custom translation workflows.
PluginConfig with automatic validationpip install r2x-core
Or with uv:
uv add r2x-core
Python version support: 3.11, 3.12, 3.13
The DataStore provides a high-level interface for managing and loading data files:
from r2x_core import DataStore, DataFile
# Create a DataStore pointing to your data directory
store = DataStore(path="/path/to/data")
# Add files to the store
data_file = DataFile(name="generators", fpath="gen.csv")
store.add_data(data_file)
# Or add multiple files at once
files = [
DataFile(name="generators", fpath="gen.csv"),
DataFile(name="loads", fpath="load.csv"),
DataFile(name="buses", fpath="buses.h5")
]
store.add_data(*files)
# Read data from the store
gen_data = store.read_data("generators")
# List all available data files
available_files = store.list_data()
# Remove a data file
store.remove_data("generators")
Create a plugin to translate power system models:
from r2x_core import Plugin, PluginConfig, PluginContext, Rule, System, DataStore
from rust_ok import Ok
# Define type-safe configuration
class MyModelConfig(PluginConfig):
input_folder: str
model_year: int
scenario: str = "base"
# Implement your translator plugin
class MyModelTranslator(Plugin[MyModelConfig]):
def on_prepare(self):
# Load data and setup resources
return Ok(None)
def on_build(self):
# Create system from input data
system = System(name=f"{self.config.scenario}_{self.config.model_year}")
return Ok(system)
def on_translate(self):
# Define translation rules
rules = [
Rule(
name="translate_generators",
source_type="SourceGenerator",
target_type="Generator",
version=1,
field_map={
"name": "name",
"capacity": "p_max_mw",
"location": "zone",
}
),
]
# Apply rules to create target system
return Ok(self.system)
# Execute the translation
config = MyModelConfig(input_folder="/path/to/data", model_year=2030)
context = PluginContext(config=config)
plugin = MyModelTranslator.from_context(context)
result = plugin.run()
print(f"Translated system: {result.system.name}")
Register plugins via pyproject.toml entry points for automatic discovery:
[project.entry-points.r2x_plugin]
my_model_translator = "my_package.plugins:MyModelTranslator"
my_model_builder = "my_package.plugins:MyModelBuilder"
The plugin system automatically discovers and introspects plugins to extract their capabilities:
from r2x_core import Plugin
# Get plugin metadata programmatically
config_type = MyModelTranslator.get_config_type()
print(f"Config type: {config_type.__name__}")
# Discover which hooks are implemented
hooks = MyModelTranslator.get_implemented_hooks()
print(f"Implemented hooks: {hooks}")
# Output: ['on_prepare', 'on_build', 'on_translate']
# Introspect config fields
import inspect
fields = config_type.model_fields
for field_name, field_info in fields.items():
print(f" {field_name}: {field_info.annotation}")
Plugins are discovered, instantiated, and executed through a shared registry that handles dependency injection and lifecycle management.
Comprehensive documentation is available at nrel.github.io/r2x-core:
Curious about what we're working on? Check out the roadmap:
We welcome contributions! Please see our Contributing Guide for guidelines on how to contribute to R2X Core.
R2X Core is released under the BSD 3-Clause License. See LICENSE.txt for details.
FAQs
Extensible framework for building power system model translators with plugin architecture
We found that r2x-core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.

Security News
TeamPCP is partnering with ransomware group Vect to turn open source supply chain attacks on tools like Trivy and LiteLLM into large-scale ransomware operations.