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

lazy load Rich #154

Merged
merged 2 commits into from
Feb 3, 2024
Merged

lazy load Rich #154

merged 2 commits into from
Feb 3, 2024

Conversation

dwreeves
Copy link
Collaborator

@dwreeves dwreeves commented Feb 3, 2024

Motivation:

Rich is only used to render help text; it's entirely unnecessary during normal code execution unless the user is explicitly using it in their code.

Start-up speed is a nonzero factor in adoption of Click and, by extension, Rich-Click. See for example this discussion in the Airflow repo where Click (and Rich-Click!!!) was considered, and then ultimately dropped in part for performance reasons. apache/airflow#22613 (comment)

It's very low cost to use typing.TYPE_CHECKING to defer loading anything related to Rich (except for type checking), and lazy then load the rich_help_rendering.py module. These are not major performance gains, but they're not nothing either.

@dwreeves dwreeves merged commit bfca2a5 into ewels:main Feb 3, 2024
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant