rich_utils
lazy load in 0.17.0 release breaking safety
usage
#1285
-
First Check
Commit to Help
Example CodeWith typer>=0.17.0
>>> import typer
>>> typer.rich_utils
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'typer' has no attribute 'rich_utils'
>>> DescriptionIt looks like the lazy evaluation update in 0.17.0 removed I get the error while using I can pin to Operating SystemmacOS Operating System DetailsNo response Typer Version
Python Version3.12.11 Additional ContextNo response |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
Suggested fix here: pyupio/safety#778 (comment) |
Beta Was this translation helpful? Give feedback.
-
Submitted fix PR here: pyupio/safety#779 |
Beta Was this translation helpful? Give feedback.
-
My vote on this is that submodules should always be available as attributes. |
Beta Was this translation helpful? Give feedback.
-
So the whole point of not importing I see that [UPDATE]: just confirming that we don't intend to roll-back the lazy import of |
Beta Was this translation helpful? Give feedback.
So the whole point of not importing
rich_utils
unconditionally, was to avoid the overhead of importingrich
stuff that might not actually be needed (cf detailed analysis here). I think overal that's a really nice performance gain for many use-cases, but I can see the problem when downstream libraries assume all of this stuff (including the things inrich_utils
itself) are imported by default. Then again, we didn't expose it in__init__.py
and I would personally always import the submodule first.I see that
safety
has already merged the fix. Just to be sure, I'll run this by Tiangolo quickly to see whether we want to change anything on our end.[UPDATE]: just confirming that we don't inten…