Skip to content

Conversation

@RinZ27
Copy link

@RinZ27 RinZ27 commented Jan 4, 2026

PR Description

This PR addresses an issue in the ArgparseTranslator where internal Python type hints (such as Union[...], Optional[...], and Annotated[...]) were leaking into the CLI help messages from function docstrings. These annotations clutter the help output and can be confusing for end-users.

Key Changes

  • Docstring Summary Isolation: Updated _build_description to strictly extract the function summary while stripping out redundant metadata sections like Parameters, Returns, and Examples which are already handled by argparse or are purely technical.
  • Robust Type Cleaning: Enhanced the clean_type_annotation helper with more resilient regex patterns to handle varied spacing and nested type structures.
  • User-Friendly Syntax: Ensured that pipe-style unions (int | str) and Union objects are consistently translated to human-readable "or" syntax (e.g., int or str).

Testing

  • Verified locally that pytest cli/tests/test_argparse_translator.py passes.
  • Manually confirmed that running CLI commands with --help now displays clean, concise descriptions without implementation details.

Potential Risks

  • Low risk: These changes only affect the string transformation logic used for generating help messages and do not impact core command logic or argument parsing.

Review Guide

  • Please review the regex patterns in the _build_description method to ensure they handle edge-case docstring indentations appropriately.

Best regards,
Rin

@CLAassistant
Copy link

CLAassistant commented Jan 4, 2026

CLA assistant check
All committers have signed the CLA.

@RinZ27 RinZ27 force-pushed the fix/cli-description-cleanup branch from 43137f4 to 94d387f Compare January 7, 2026 04:40
@RinZ27
Copy link
Author

RinZ27 commented Jan 8, 2026

Hi @deeleeramone, I've cleaned up the linting issue (minor whitespace on a blank line) and updated the branch. Could you please trigger the CI checks when you have a moment? Thanks!

@deeleeramone deeleeramone added bug Bugs and bug fixes cli OpenBB Platform CLI labels Jan 9, 2026
@deeleeramone deeleeramone self-requested a review January 10, 2026 06:41
Copy link
Contributor

@deeleeramone deeleeramone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for identifying a problem and providing the solution.

@RinZ27
Copy link
Author

RinZ27 commented Jan 10, 2026

It was a pleasure contributing to the project's security. I'm glad I could help make it a bit safer. Thank you for the smooth review process! @deeleeramone

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

Labels

bug Bugs and bug fixes cli OpenBB Platform CLI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants