Skip to content

perf: defer scope import in console.py to Console.log()#5

Closed
KRRT7 wants to merge 1 commit intomasterfrom
perf/defer-scope-console
Closed

perf: defer scope import in console.py to Console.log()#5
KRRT7 wants to merge 1 commit intomasterfrom
perf/defer-scope-console

Conversation

@KRRT7
Copy link
Copy Markdown
Owner

@KRRT7 KRRT7 commented Apr 9, 2026

Summary

Move from .scope import render_scope from module level to inside the log() method, gated behind the log_locals check.

rich.scope pulls in rich.table, rich.panel, and fractions — none of which are needed unless log_locals=True is explicitly requested.

Testing

952 passed on CPython 3.9–3.14 and PyPy 3.10.

Move `from .scope import render_scope` from module level to inside
the `log()` method, gated behind the `log_locals` check.

rich.scope pulls in rich.table, rich.panel, and fractions — none of
which are needed unless log_locals=True is explicitly requested.
@KRRT7
Copy link
Copy Markdown
Owner Author

KRRT7 commented Apr 9, 2026

Superseded by the consolidated stacked PRs #12 + #13.

@KRRT7 KRRT7 closed this Apr 9, 2026
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