Skip to content

load plugins from env variable#5524

Merged
adhami3310 merged 3 commits into
mainfrom
load-plugins-from-env-variable
Jul 3, 2025
Merged

load plugins from env variable#5524
adhami3310 merged 3 commits into
mainfrom
load-plugins-from-env-variable

Conversation

@adhami3310
Copy link
Copy Markdown
Member

REFLEX_PLUGINS=reflex.plugins.tailwind_v3.TailwindV3Plugin

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

Added support for loading Reflex plugins through environment variables, enabling runtime plugin configuration via REFLEX_PLUGINS environment variable.

  • New interpret_plugin_env function in reflex/environment.py allows loading plugins using dot-notation format (e.g., package.module.PluginName)
  • Added validation for plugin class inheritance and import paths with descriptive error messages
  • Implements dynamic plugin instantiation based on environment variable string parsing

1 file reviewed, no comments
Edit PR Review Bot Settings | Greptile

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Jul 3, 2025

CodSpeed Performance Report

Merging #5524 will not alter performance

Comparing load-plugins-from-env-variable (467785e) with main (398e1e6)

Summary

✅ 8 untouched benchmarks

Copy link
Copy Markdown
Collaborator

@masenf masenf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working for me with 2 local plugins separated by colon

A test case would be nice though, I think we already have some test cases for interpreting other env types in test_config.py (probably should move those to test_environment.py)

@masenf
Copy link
Copy Markdown
Collaborator

masenf commented Jul 3, 2025

This should give us some impetus to expand the plugin API to allow for more interesting integrations, like post_compile to give a chance for custom modifications in the .web directory.

Copy link
Copy Markdown
Collaborator

@masenf masenf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

redundant tests can probably be removed from test_config.py now

@adhami3310 adhami3310 merged commit 4a765ea into main Jul 3, 2025
41 checks passed
@adhami3310 adhami3310 deleted the load-plugins-from-env-variable branch July 3, 2025 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants