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

Can Plugins self-document what they define? #2063

Open
john-science opened this issue Jan 23, 2025 · 3 comments
Open

Can Plugins self-document what they define? #2063

john-science opened this issue Jan 23, 2025 · 3 comments
Labels
architecture Issues related to big picture system architecture

Comments

@john-science
Copy link
Member

john-science commented Jan 23, 2025

An ArmiPlugin can define several things for a simulation. I see two options:

  1. the class stored a short list-of-strings with the names of each one of the things they define
  2. a helper method to call to produce that list

This would make documentation easier. It would also make it easier to audit if a Parameter or Setting is still being used.

I suspect this will be easy to do.

Important Examples

def defineParameters() -> Dict:

def defineSettings() -> List:

But Also

def defineFlags() -> Dict[str, Union[int, flags.auto]]:

def defineBlockTypes() -> List:

def defineAssemblyTypes() -> List:

def defineBlueprintsSections() -> List:

def defineEntryPoints() -> List:

def defineSettingsValidators(inspector) -> List:

def defineCaseDependencies(case, suite):

@john-science john-science added the architecture Issues related to big picture system architecture label Jan 23, 2025
@john-science
Copy link
Member Author

@jakehader Just FYI. This was my idea. I think I can knock this out pretty fast.

@drewj-tp
Copy link
Contributor

I'm wondering about the why here. Is it to make generating API docs easier? The plugins already have the hooks that describe what expose / configure / define / etc.

A sphinx directive could help w/ the docs by calling e.g., Plugin.defineParameters and parse the returned dictionary with relative ease. Similarly for the other things.

Or something like Plugin.gatherAllDefines that just calls the hooks defined on the class and collects those definitions?

@john-science
Copy link
Member Author

john-science commented Jan 24, 2025

I'm wondering about the why here.

As I said above "It would also make it easier to audit if a Parameter or Setting is still being used." I have seen literally hundreds of parameters go unused for years because some team lost track of the fact they created it and they stopped using it.

The "problem" in ARMI is we made it really easy to create new settings, parameters, flags, etc. But it is even easier to stop using them and leave them around, uselessly cluttering a simulation.

A sphinx directive could help w/ the docs by calling e.g., Plugin.defineParameters

Sure! Something like that fits nicely into option (2) above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
architecture Issues related to big picture system architecture
Projects
None yet
Development

No branches or pull requests

2 participants