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

Ability for plugins to use oscrc for configuration? #1426

Open
birkenfeld opened this issue Oct 12, 2023 · 2 comments
Open

Ability for plugins to use oscrc for configuration? #1426

birkenfeld opened this issue Oct 12, 2023 · 2 comments
Assignees
Labels

Comments

@birkenfeld
Copy link

Is your feature request related to a problem? Please describe.
Before the recent refactoring of the osc.conf module (#1387), I used oscrc to configure my plugin command. It worked ad-hoc, since the configuration was just a dictionary obtained from the config parser, and no validation/checking was performed.

Now it is unclear if this is still wanted/supported, but I feel like it is preferable to allow this, as a separate config file requires me to roll my own config parser and so on, and all the nice new machinery that is now in osc would have to be somewhat duplicated.

Describe the solution you'd like
The mechanics to define a new command could allow also giving config Fields.

Describe alternatives you've considered
What works now already but is monkeypatching level of hacky:

class MyOptions(osc.conf.Options):
    new_field: str = Field(...)
osc.conf.Options = MyOptions

Additional context
cc @dmach

@dmach
Copy link
Contributor

dmach commented Oct 19, 2023

@birkenfeld I've just implemented and merged #1438
It allows using Options and HostOptions as a dicts with arbitrary values, loading values from oscrc works as well.
It is good enough to fix compatibility issues I introduced a while back, but I don't think we should use this as the final solution. Let's keep this open and try to come up with something better.

@dmach dmach self-assigned this Oct 19, 2023
@birkenfeld
Copy link
Author

Thanks a lot!

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

No branches or pull requests

2 participants