Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request]: Extract And Generalize Plugin System #421

Open
TimothyWillard opened this issue Dec 9, 2024 · 0 comments
Open

[Feature request]: Extract And Generalize Plugin System #421

TimothyWillard opened this issue Dec 9, 2024 · 0 comments
Labels
enhancement Request for improvement or addition of new feature(s). gempyor Concerns the Python core. medium priority Medium priority.

Comments

@TimothyWillard
Copy link
Contributor

Label

enhancement, gempyor

Priority Label

medium priority

Is your feature request related to a problem? Please describe.

There is duplicated code in:

def InitialConditionsFactory(config: confuse.ConfigView, path_prefix: str = "."):
if config is not None and "method" in config.keys():
if config["method"].as_str() == "plugin":
klass = utils.search_and_import_plugins_class(
plugin_file_path=config["plugin_file_path"].as_str(),
class_name="InitialConditions",
config=config,
path_prefix=path_prefix,
)
return klass
return InitialConditions(config, path_prefix=path_prefix)

and:

def SeedingFactory(config: confuse.ConfigView, path_prefix: str = "."):
if config is not None and "method" in config.keys():
if config["method"].as_str() == "plugin":
klass = utils.search_and_import_plugins_class(
plugin_file_path=config["plugin_file_path"].as_str(),
class_name="Seeding",
config=config,
path_prefix=path_prefix,
)
return klass
return Seeding(config, path_prefix=path_prefix)

These should be consolidated down into one place.

Is your feature request related to a new application, scenario round, pathogen? Please describe.

No response

Describe the solution you'd like

Ideally the parent class for Seeding and InitialConditions would be able to handle this, something like SimulationPluginComponent or similar.

@TimothyWillard TimothyWillard added enhancement Request for improvement or addition of new feature(s). gempyor Concerns the Python core. medium priority Medium priority. labels Dec 9, 2024
@TimothyWillard TimothyWillard added this to the Software Quality milestone Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Request for improvement or addition of new feature(s). gempyor Concerns the Python core. medium priority Medium priority.
Projects
None yet
Development

No branches or pull requests

1 participant