docs: remove dead code, unused assets and unused dependencies from the docs app

FA
4h ago
+163-3664

All Submissions:

  • Have you followed the guidelines stated in CONTRIBUTING.md file?
  • Have you checked to ensure there aren't any other open Pull Requests for the desired changed?

Type of change

  • Bug fix (non-breaking change which fixes an issue) — cleanup of the docs app; no page or URL changes

Changes To Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

What changed

Docs-audit session E (dead code, assets and dependencies). I re-checked every finding against current main before deleting anything.

1. 19 unreachable modules deleted. An AST import graph rooted at reflex_docs.reflex_docs, rxconfig.py, agent_files/ and every reflex_docs import in docs/**/*.md reaches none of them:
components/{ai_guide_graphic,button,hint,webpage}, models.py, pages/docs/{api_reference/plugins,api_reference/utils,guide,source}, pages/docs_landing/views/cta_artwork, pages/gallery, pages/integrations/{integration,integration_header}, templates/docpage/sidebar/sidebar_items/cloud, templates/docpage/state, utils/http, views/animated_box, views/bottom_section/{get_started,newsletter}.

  • /flexdown-guide ("Coming Soon"): guide.py was never imported, so the route was never registered. It was absent from the route list and sitemap, and nothing links to it, so no redirect is needed.
  • pages/docs/source.py (finding 4): only its own test (test_responsive_description_is_rendered_once in test_site_quality.py) imported it. That test is deleted with it. The README's "Edit this page" lookup now lives in templates/docpage/docpage.py:github_edit_url, and API pages are built by apiref.py.
  • components/button.py went dead once newsletter.py was deleted. The audit's earlier count only kept it because of a prose example in docs/app/CLAUDE.md. That example now imports reflex_docs.templates.docpage, and CLAUDE.md no longer mentions the nonexistent mainpage template or the deleted CTA views.
  • The now-orphaned .docs-hint CSS rule is removed as well.

2. docpage template: 288 lines of deletions only. Removed copy_to_markdown, ask_ai_chat, RadixDocState, hover_item, dict_to_formatted_string, used_component, style_grid and their now-unused imports. Nothing is restructured, so session B's chrome edits should merge cleanly. feedback_button_toc stays because the docpage layout uses it.

3. 8 landing SVGs and 12 public assets deleted. For each one I grepped the filename across the whole repo, including docs markdown and packages/reflex-site-shared, and also checked the dynamic paths (artwork(name), agent-logos/{name}, components_previews/{section}/{mode}/{name}, the AI-card --ai-cloud CSS).

  • Landing SVGs: ai_mcp, framework_{auth,components,database}, getting_started_illustration, mcp_illustration, reflex_mark, squares_docs_logo. Only ai_getting_started.svg is used.
  • Public assets: meta/mstile-*.png (5) and meta/browserconfig.xml (the only file that referenced mstile-150x150.png, and nothing links to it), docs/{light,dark}/{getting_started,mcp}.svg, framework-diagrams/lavender.avif, chakra_color_mode_provider.js.
  • Kept robots.txt (a convention file, not linked from code), the sankeychart previews (used via BUNDLED_PREVIEWS) and agent-logos/* (used through an f-string).

5. Dependencies.

  • Removed orjson (only imported by the deleted utils/http.py), plus fastapi, psycopg[binary] and dev uvicorn. None is imported by the app or its tests, and the markdown FastAPI/psycopg snippets are plain display blocks, not exec.
  • Replaced plotly-express with plotly: the demos import plotly.express, which ships in plotly. The shim only added statsmodels, scipy, patsy, formulaic and interface-meta, and no demo uses trendlines or anything else that needs them.
  • The uv.lock diff is removals plus the plotly edge that replaces plotly-express: the removals are those 5 packages, orjson, plotly-express, and the docs-app edges. fastapi, psycopg and uvicorn stay locked because reflex's own dev group pins them.

Regression test. tests/test_module_reachability.py walks the static import graph and asserts that the list of unreachable modules is exactly []. Before this change it listed the 19 modules.

  • The reachability test follows import statements only; a module loaded any other way (importlib, string paths, exec) would count as unreachable.

Verification

  • I couldn't run reflex export here: reflex-enterprise needs a logged-in Reflex account, and reflex compile dies at bun install because the proxy blocks a GitHub tarball. Instead, a script imports the app, evaluates every registered page component and dumps the route list. Result before and after: 562 routes, 0 render errors, identical route lists.
  • The "after" run used a venv synced to the new deps, so fastapi, psycopg and statsmodels weren't installed. Every page still rendered.
  • uv run pytest tests/ in docs/app, without a built site: 871 passed, 110 skipped, 16 xfailed (one test removed, two added). The skips and xfails are browser/build tests that need an exported site; I could not build the full site here to get the with-site count.
  • uv run pre-commit run --all-files (ruff, codespell, pyright, ty, biome) is clean.

Skipped findings

  • 6, duplicated reflex_site_shared lib/meta/meta.py: the copies have diverged. lib/meta emits root-relative /meta/... and /favicon.ico links for a site served at the domain root, while meta/meta.py uses rx.asset for the /docs prefix. The docs app imports only meta.meta, but reflex-site-shared is a released package and lib/meta looks like it serves the marketing site (another repo), so I left it.

https://claude.ai/code/session_01LwJUCTguDjAk9Bii1bDD9E