Skip to content

[regression] circular import when rxconfig.py attempts to import State #6661

@masenf

Description

@masenf

Describe the bug
The State __init_subclass__ path depends on get_config. So the config itself is unable to actually import any State classes, which makes it impossible to express any dynamic state vars passed to plugins, like RadixThemesPlugin.

To Reproduce
In rxconfig.py:

class State(rx.State):
    ...

Expected behavior
User should be able to define and/or import State classes in the rxconfig.py for the purposes of dynamic configuration.

Alternatively, if there was a way to define config and plugins outside of an importable module, that might be better and more forward looking.

For example, if the config defined some kind of __post_init__ callback, then dynamic configuration could be deferred until the config object actually existed. And it would allow mostly static (toml) config, while still providing a hook for running python code after the static config is loaded.

Specifics (please complete the following information):

  • Python Version: 3.10+
  • Reflex Version: 0.9.3+
  • OS: any

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions