Improve config docs with env var columns and responsive tables - #6819
Improve config docs with env var columns and responsive tables#6819masenf wants to merge 5 commits into
Conversation
- reflex-docgen: merge docstring Attributes sections across the MRO so inherited fields keep their base-class descriptions; drop the extra_fields workaround that listed every Config field twice on the api-reference Config page. - Add an Environment Variable column to the generated Config fields table so every REFLEX_* override (e.g. REFLEX_ENV_FILE) is listed and searchable; cross-link it from the Environment Variables page. - Remove the low-value "Key Configuration Areas" section from the Config docstring. - Rewrite the advanced-onboarding configuration page: correct the env var example (REFLEX_FRONTEND_PORT, not FRONTEND_PORT) and document env_file/python-dotenv, the app module, ports/hosts/URLs, CORS, deploy_url, path prefixes, and plugins (config and env string forms). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012ZK7KxuaTb2HePTSBFFpJp
…ontend The frontend substitutes its own domain when api_url points at localhost, so a backend reachable at the same address as the frontend works without setting api_url; clarify this on the onboarding page and in the Config docstring. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012ZK7KxuaTb2HePTSBFFpJp
avoid accidentally rendering inline triple-quoted strings as code block when passing them to `render_markdown`
the `internal` flag is not preserved through the `env_var` -> `EnvVar` translation, so we can't key off of it. Instead, all internal env vars get "__" prepended to the name, so just use that to make the determination.
The Config fields table (with its env var column) and the Environment Variables table were too wide for normal displays, forcing horizontal scrolling just to read descriptions. Using Tailwind container queries, the description column now stays in-row only when the container is wide enough; below that each entry renders as two lines, with the description spanning the full table width on the second line. The radix row divider is suppressed between the two lines of one logical row so entries stay visually grouped. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012ZK7KxuaTb2HePTSBFFpJp
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
| ) | ||
| ``` | ||
|
|
||
| Multiple files can be passed separated by `os.pathsep` (`:` on Linux/macOS, `;` on Windows); when several files set the same variable, the first file in the list takes precedence. Values from an env file override variables already present in the environment. |
There was a problem hiding this comment.
Correct dotenv precedence description
The documentation reverses the precedence between dotenv values and variables already present in the process environment. Explicit process-environment values take precedence, so this statement gives users the wrong expectation when both sources define the same variable.
| Multiple files can be passed separated by `os.pathsep` (`:` on Linux/macOS, `;` on Windows); when several files set the same variable, the first file in the list takes precedence. Values from an env file override variables already present in the environment. | |
| Multiple files can be passed separated by `os.pathsep` (`:` on Linux/macOS, `;` on Windows); when several files set the same variable, the first file in the list takes precedence. Variables already present in the environment override values from an env file. |
Knowledge Base Used: Config and Environment System
Greptile SummaryImproves configuration documentation and API-reference tables.
Confidence Score: 4/5The PR appears safe to merge after correcting the non-blocking dotenv precedence documentation. The implementation changes have no identified blocking defect, but the configuration guide currently tells users that dotenv values override existing process variables even though explicit environment values retain precedence. Files Needing Attention: docs/advanced_onboarding/configuration.md
|
| Filename | Overview |
|---|---|
| docs/advanced_onboarding/configuration.md | Substantially expands configuration guidance, but reverses dotenv-versus-process-environment precedence in one sentence. |
| docs/app/reflex_docs/pages/docs/source.py | Adds reusable responsive table helpers and Config environment-variable columns without an identified functional defect. |
| docs/app/reflex_docs/pages/docs/env_vars.py | Migrates the environment-variable reference to responsive rows and correctly excludes internal variables by their generated name prefix. |
| packages/reflex-docgen/src/reflex_docgen/_class.py | Merges inherited Attributes documentation in MRO order so subclass fields retain the nearest applicable descriptions. |
| packages/reflex-site-shared/src/reflex_site_shared/docs/markdown.py | Dedents Markdown by default while providing an explicit opt-out for whitespace-sensitive callers. |
| docs/app/agent_files/_plugin.py | Aligns generated Markdown references with inherited Config fields and the new environment-variable column. |
Reviews (1): Last reviewed commit: "docs: stack table descriptions below fie..." | Re-trigger Greptile
Merging this PR will not alter performance
Comparing Footnotes
|
Type of change
Summary
This PR improves the documentation for Reflex configuration and environment variables by:
Responsive table layouts for API reference pages: Tables now stack descriptions into a separate row on narrow containers, eliminating horizontal scrolling while keeping descriptions readable. Uses Tailwind container queries to adapt at breakpoints like
@2xland@4xl.Environment variable columns in config docs: The
rx.ConfigAPI reference now includes an "Environment Variable" column showing theREFLEX_*prefix for each field, making it clear how to override config via environment variables.Enhanced configuration documentation: Updated
docs/advanced_onboarding/configuration.mdwith:REFLEX_prefix.envfile loading, app module configuration, ports/hosts/URLs, CORS, path prefixes, and pluginsImproved docstring inheritance: Fixed
reflex-docgento merge Attributes sections from base classes in MRO order, so inherited fields (like those inrx.Configinheriting fromBaseConfig) get their descriptions from the base class docstring. This eliminates duplicate field listings and ensures all fields are documented.Markdown rendering flexibility: Added
dedentparameter torender_markdown()to allow callers to opt out of whitespace normalization when markdown is already formatted.Changes
Core changes:
docs/app/reflex_docs/pages/docs/source.py: Addedstacked_description_rows()andstacked_description_header()helpers to build responsive tables with container-query-based stacking. Updatedformat_fields()to support an optionalenv_var_prefixparameter that adds an environment variable column.packages/reflex-docgen/src/reflex_docgen/_class.py: Added_attributes_from_mro()to merge docstring Attributes sections from base classes, fixing inherited field descriptions.docs/app/reflex_docs/pages/docs/env_vars.py: Refactored environment variable table to use the new responsive table helpers.docs/app/agent_files/_plugin.py: Updated markdown generation to include environment variable columns whenenv_var_prefixis provided.packages/reflex-site-shared/src/reflex_site_shared/docs/markdown.py: Addeddedentparameter torender_markdown().docs/app/reflex_docs/pages/docs/apiref.py: Simplified module list and addedenv_var_prefixesdict to enable env var columns forrx.Config.docs/advanced_onboarding/configuration.md: Expanded with detailed sections on environment variables,.envfiles, app module configuration, ports/hosts, CORS, path prefixes, and plugins.Tests:
tests/units/docgen/test_class_and_component.py: Addedtest_inherited_fields_get_base_docstring_descriptions()andtest_config_fields_documented_once_with_descriptions()to verify inherited field descriptions and that allrx.Configfields are documented.tests/units/reflex_site_shared/docs/test_markdown.py: Addedtest_render_markdown_dedent_kwarg_controls_whitespace_normalization()to verify the newdedentparameter.Test Plan
dedentparameterhttps://claude.ai/code/session_012ZK7KxuaTb2HePTSBFFpJp