fix(hosting-cli): make reflex-base an optional dependency
Fixes ENG-11615.
The problem
Since #6866, reflex-hosting-cli declares reflex-base >= 0.9.8.post19.dev0 while constants/hosting.py still advertises reflex support down to 0.6.6.post1 (recommending 0.7.6). reflex-base does not exist below 0.9.0 — it was carved out in #6281 and reflex only began depending on it at 0.9.x. So the declared floor cannot be satisfied on any reflex the CLI claims to support.
It fails quietly rather than loudly: reflex 0.8.9 declares no reflex-base dependency, so pip installs reflex 0.8.9 and reflex-base 0.9.8 side by side with no conflict to detect. The runtime gate passes and the user carries a second, mismatched framework base.
Nothing is broken for users today — this only exists on main. Published 0.1.70 was cut ~20 hours before #6866 landed, so 0.1.71 would be the first release to ship it. The declared pin was also understated by 25 commits (post19 predates reflex_base.utils.log existing at all), but that is moot now.
The fix
The dependency was never needed for the shared logging pipeline. reflex_base.utils.log lists "reflex_cli" in PACKAGE_LOGGER_NAMES, so it parents the CLI's loggers from its own side — the CLI joins the pipeline without importing anything. Only three things were genuinely imported, and each is now resolved from reflex-base when importable and from a local fork otherwise:
| reflex >= 0.9 | older reflex | |
|---|---|---|
LogLevel | reflex_base.constants.base | new reflex_cli.constants.log_level |
SUCCESS, set_log_level | reflex_base.utils.log | new reflex_cli.utils.log |
print/print_table/ask/status/rule/progress | reflex_base.utils.console | reflex_cli.utils.console |
On reflex 0.9 every name resolves to the identical reflex-base object, so behavior there is unchanged. #6866's refactor — standard logging, purple debug, errors to stderr, success hidden at --loglevel warning — is kept in full; the fallback handler reproduces the same styles, stderr routing and level gating.
The forked LogLevel lives in its own module so pyright checks it independently rather than inside an except ImportError branch.
MINIMUM_REFLEX_VERSION / RECOMMENDED_REFLEX_VERSION are left at 0.6.6.post1 / 0.7.6 — they are truthful again.
API change
reflex_cli.utils.console drops the PoorProgress and is_debug re-exports (added by #6866, never used) and the debug/info/success/log/warn/error/timing/deprecate re-exports, rather than duplicating them into the fallback. The CLI has logged through logging since #6866 and reflex-base deprecated the legacy helpers in #6867. This is an unreleased surface, so no deprecation cycle applies.
Verification
ruff check/ruff formatclean;pyright reflex packages/reflex-hosting-cli testsreports 0 errors- 7672 unit tests pass, 74.87% coverage
check_min_deps.py18/18 PASS;--check-dev-pinsnow reports zero dev pins repo-wide- 24 new tests in
tests/units/reflex_cli/utils/test_log.pyinstall a meta-path finder that makesreflex_baseunimportable, then assert every CLI module still imports and the fallback sink renders, gates and routes correctly. Confirmed the guard bites: reintroducingfrom reflex_base.utils import loginscan.pyfailstest_cli_imports_without_reflex_basefor bothscananddeployments.
Reviewer notes
check_min_deps.pydoes not cover the fallback. It fails only on errors new at minimum resolution, and reflex-base is absent from both its environments, so the unresolved import cancels out. The new unit tests are the only guard on that path.- The fallback duplicates ~60 lines of reflex-base's
RichConsoleHandler. If those styles drift in reflex-base, the fallback diverges silently — only theLogLevelenum is cross-checked against reflex-base, not the styles. constants/base.pyimports reflex-base'sLogLevelunderTYPE_CHECKING, so type-checking the CLI without reflex-base installed shows an unresolved import. This is deliberate: it keepsreflex/reflex.pypassingconfig.loglevelstraight through instead of reviving the_convert_reflex_loglevel_to_reflex_cli_loglevelmapper #6866 deleted.- The fallback attaches no handler until
set_log_levelis called; before that, records fall tologging.lastResort. Every CLI entry point calls it first, so this only affects direct library use. - The issue's separate open question — whether
check_min_deps.pyshould validate dev-pinned floors against workspace commit distance — is not addressed here.