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

Gather all component configurations #71

Open
davidbrochart opened this issue Apr 5, 2023 · 5 comments
Open

Gather all component configurations #71

davidbrochart opened this issue Apr 5, 2023 · 5 comments

Comments

@davidbrochart
Copy link
Contributor

It would be nice to be able to gather the configuration of the whole application, from the root component and recursively to all sub-components. I'm especially interested in doing something like this at the command line:

asphalt run config.yaml --help-all

And that would print all possible parameters. Ideally, there would be an explanation for each parameter, but I guess that it would require each component to use Click somehow.

@agronholm
Copy link
Member

An interesting idea, but would probably require substantial effort to implement properly.

@agronholm
Copy link
Member

I may have to go with a specific validation framework for component configuration. Pydantic v2 is looking like a viable option for that.

@davidbrochart
Copy link
Contributor Author

If you go with Pydantic, we could take advantage of the fields description to display help about configuration:

from pydantic import BaseModel, Field

class Foo(BaseModel):
    a: int = Field(description="a field")

Foo.__fields__["a"].field_info.description
# shows 'a field'

@agronholm
Copy link
Member

Yes, that was part of the plan. I wonder if it would be better to just abstract out the API so it could accommodate other validation frameworks too?

@davidbrochart
Copy link
Contributor Author

Yes why not, it would be even better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants