ENG-10963 feat(log): deprecate the legacy console logging helpers (5/5) - #6867
Conversation
console.debug/info/success/log/warn/error/timing now emit a runtime deprecation warning (removal in 1.0) and are marked with typing_extensions.deprecated for type-level warnings. Behavior is otherwise unchanged; the interactive Rich features (print/rule/ status/ask/progress) remain first-class.
Greptile SummaryThe PR deprecates the legacy console logging helpers at runtime and for static type checking while retaining their existing rendering behavior.
Confidence Score: 5/5The PR appears safe to merge with no concrete blocking or independently actionable non-blocking issues identified. The deprecated helpers retain their previous rendering paths, timing avoids a duplicate deprecation notice through the extracted debug implementation, and the tests cover the principal compatibility contracts.
|
| Filename | Overview |
|---|---|
| packages/reflex-base/src/reflex_base/utils/console.py | Adds runtime and type-level deprecation markers while extracting the unchanged debug implementation for internal timing use. |
| tests/units/reflex_base/utils/test_log.py | Adds coverage for shim output and preservation of Rich print, log, and progress behavior. |
| packages/reflex-base/news/+eng-10963-console-deprecate.deprecation.md | Documents the deprecated helpers, planned removal, replacements, and unaffected interactive APIs. |
Reviews (1): Last reviewed commit: "feat(log): deprecate the legacy console ..." | Re-trigger Greptile
Merging this PR will not alter performance
Comparing Footnotes
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a3b76f45c9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if TYPE_CHECKING: | ||
| from typing_extensions import deprecated | ||
|
|
||
| debug = deprecated("Use logging.getLogger(__name__).debug(msg) instead")(debug) |
There was a problem hiding this comment.
Declare deprecated shims with decorator syntax
When consumers enable Pyright's reportDeprecated, none of these seven helpers produces a diagnostic because Pyright does not propagate PEP 702 metadata through an arbitrary deprecated(...)(function) assignment (verified with Pyright 1.1.409); it recognizes @deprecated(...) on a declaration instead. Consequently, the advertised type-level deprecation is ineffective, so provide TYPE_CHECKING declarations decorated with @deprecated while retaining the runtime implementations in the alternate branch.
AGENTS.md reference: AGENTS.md:L110-L119
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
1 issue found across 3 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/reflex-base/src/reflex_base/utils/console.py">
<violation number="1" location="packages/reflex-base/src/reflex_base/utils/console.py:601">
P2: The TYPE_CHECKING shim reassigns each function via `deprecated(...)(fn)` rather than applying `@deprecated` directly on a declaration. Type checkers like Pyright generally detect `reportDeprecated` diagnostics based on syntactic `@deprecated` decoration rather than an arbitrary functional call/reassignment, so this pattern may fail to produce the intended type-level deprecation warnings for callers using Pyright's `reportDeprecated`. Consider declaring stub functions under `TYPE_CHECKING` decorated directly with `@deprecated`, keeping the runtime implementation in the else branch.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| if TYPE_CHECKING: | ||
| from typing_extensions import deprecated | ||
|
|
||
| debug = deprecated("Use logging.getLogger(__name__).debug(msg) instead")(debug) |
There was a problem hiding this comment.
P2: The TYPE_CHECKING shim reassigns each function via deprecated(...)(fn) rather than applying @deprecated directly on a declaration. Type checkers like Pyright generally detect reportDeprecated diagnostics based on syntactic @deprecated decoration rather than an arbitrary functional call/reassignment, so this pattern may fail to produce the intended type-level deprecation warnings for callers using Pyright's reportDeprecated. Consider declaring stub functions under TYPE_CHECKING decorated directly with @deprecated, keeping the runtime implementation in the else branch.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/reflex-base/src/reflex_base/utils/console.py, line 601:
<comment>The TYPE_CHECKING shim reassigns each function via `deprecated(...)(fn)` rather than applying `@deprecated` directly on a declaration. Type checkers like Pyright generally detect `reportDeprecated` diagnostics based on syntactic `@deprecated` decoration rather than an arbitrary functional call/reassignment, so this pattern may fail to produce the intended type-level deprecation warnings for callers using Pyright's `reportDeprecated`. Consider declaring stub functions under `TYPE_CHECKING` decorated directly with `@deprecated`, keeping the runtime implementation in the else branch.</comment>
<file context>
@@ -559,3 +593,17 @@ def start(self):
+if TYPE_CHECKING:
+ from typing_extensions import deprecated
+
+ debug = deprecated("Use logging.getLogger(__name__).debug(msg) instead")(debug)
+ info = deprecated("Use logging.getLogger(__name__).info(msg) instead")(info)
+ success = deprecated(
</file context>
With every call site migrated,
console.debug/info/success/log/warn/error/timingnow emit a runtime deprecation warning (removal in 1.0) and are marked withtyping_extensions.deprecatedfor type-level warnings. Behavior is otherwise unchanged; the interactive Rich features (print/rule/status/ask/progress) remain first-class.This must land last: the deprecation markers only pass CI once no in-repo call site uses the helpers.
Stack (ENG-10963)
#6863 → #6864 → #6865 → #6866 → this.
Merge in order; each PR is based on the previous branch.