-
-
Notifications
You must be signed in to change notification settings - Fork 314
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
Cli providers params #1180
Cli providers params #1180
Conversation
I like a lot of what I'm seeing here, getting rid of the click-option-group package is nice. Keeping all of the click usage confined to one module is clean. I think I would prefer if this could be made a little bit closer to the approach that the Typer project uses. It combines using docstrings with an annotated function signature. See it in action in the CLI Options with Help section of their docs. I would really really really prefer to not have anything syntactic in the docstrings. Using the docstring in the generated docs is great, but don't parse it. class SomeProvider(Provider):
def __init__(
self,
username: Annotated[str, Option(help="OpenSubtitles username")],
password: Annotated[str, Option(help="OpenSubtitles password")],
)
"""
Downloads subtitles from OpenSubtitles.
[username] and [password] are required if not set in config.toml
"""
...
Instead, use the signature annotations for anything where you'd need to parse a docstring and inline the docstring into the generated documentation. I think it's worth raising that hard coding the parameters that an extension can use is pretty restrictive. Who knows what kind of requirements might be needed by some future extension. Is there not some way to allow more flexibility in this regard? Perhaps allowing aping a narrow subset of click's api and exposing that to extensions would work? |
I like the usage of Annotated type hints, thanks, it's much better than parsing the docstring.
It's not the case! It takes all the arguments of the |
123c0f7
to
7020cf9
Compare
901bcda
to
f1d612d
Compare
I'll try and incorporate this and the examples you gave in #1177 into my provider soon. |
f1d612d
to
8c42d40
Compare
I decided not to use |
8c42d40
to
2455934
Compare
2455934
to
b2a9c3c
Compare
closes #1179
This is a breaking change, for command line usage.