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
Format complicated type hints better in help #13655
Comments
This reminds me of the same UX issue RTD has with typehints in their sphinx template. I agree, it's unhelpful at best. For anyone interested in improving this (my future self included), look at the |
|
|
Testing with a recent ipython this looks mostly good though: prompt(
message: 'AnyFormattedText | None' = None,
*,
history: 'History | None' = None,
editing_mode: 'EditingMode | None' = None,
refresh_interval: 'float | None' = None,
vi_mode: 'bool | None' = None,
lexer: 'Lexer | None' = None,
completer: 'Completer | None' = None,
complete_in_thread: 'bool | None' = None,
is_password: 'bool | None' = None,
key_bindings: 'KeyBindingsBase | None' = None,
bottom_toolbar: 'AnyFormattedText | None' = None,
style: 'BaseStyle | None' = None,
color_depth: 'ColorDepth | None' = None,
cursor: 'AnyCursorShapeConfig' = None,
include_default_pygments_style: 'FilterOrBool | None' = None,
style_transformation: 'StyleTransformation | None' = None,
swap_light_and_dark_colors: 'FilterOrBool | None' = None,
rprompt: 'AnyFormattedText | None' = None,
multiline: 'FilterOrBool | None' = None,
prompt_continuation: 'PromptContinuationText | None' = None,
wrap_lines: 'FilterOrBool | None' = None,
enable_history_search: 'FilterOrBool | None' = None,
search_ignore_case: 'FilterOrBool | None' = None,
complete_while_typing: 'FilterOrBool | None' = None,
validate_while_typing: 'FilterOrBool | None' = None,
complete_style: 'CompleteStyle | None' = None,
auto_suggest: 'AutoSuggest | None' = None,
validator: 'Validator | None' = None,
clipboard: 'Clipboard | None' = None,
mouse_support: 'FilterOrBool | None' = None,
input_processors: 'list[Processor] | None' = None,
placeholder: 'AnyFormattedText | None' = None,
reserve_space_for_menu: 'int | None' = None,
enable_system_prompt: 'FilterOrBool | None' = None,
enable_suspend: 'FilterOrBool | None' = None,
enable_open_in_editor: 'FilterOrBool | None' = None,
tempfile_suffix: 'str | Callable[[], str] | None' = None,
tempfile: 'str | Callable[[], str] | None' = None,
default: 'str' = '',
accept_default: 'bool' = False,
pre_run: 'Callable[[], None] | None' = None,
set_exception_handler: 'bool' = True,
handle_sigint: 'bool' = True,
in_thread: 'bool' = False,
inputhook: 'InputHook | None' = None,
) -> 'str' |
Yes, I can see that in |
Hmm, no I don't think so. Would that be helpful here? |
I typed
because I wanted to know the default for some argument in that api. It printed the following,
which I found rather unhelpful. For one the annotation of the argument I was interested in doesn't fit in a single line in the terminal. I wonder if there is a way to make less prominent long complicated annotations. This could be done by changing the color in which their are displayed, imposing a maximum length for the type hint or having an option is to hide annotations altogether from help. Another possibility would be to try to keep the type aliases as in the original source code rather than resolving them. Not sure how easy that is.
The text was updated successfully, but these errors were encountered: