For an extensive guide on the different ways to contribute to Reflex see our Contributing Guide on Notion.
Here is a quick guide on how to run Reflex repo locally so you can start contributing to the project.
Prerequisites:
- uv version >= 0.6.0 and add it to your path (see UV Docs for more info).
1. Fork this repository:
Fork this repository by clicking on the Fork button on the top right.
2. Clone Reflex and navigate into the repo:
git clone https://github.com/<YOUR-USERNAME>/reflex.git
cd reflex3. Install your local Reflex build:
uv sync4. Now create an examples folder so you can test the local Python build in this repository.
- We have the
examplesfolder in the.gitignore, so your changes inreflex/exampleswon't be reflected in your commit.
mkdir examples
cd examples5. Init and Run
uv run reflex init
uv run reflex runAll the changes you make to the repository will be reflected in your running app.
- We have the examples folder in the .gitignore, so your changes in reflex/examples won't be reflected in your commit.
Any feature or significant change added should be accompanied with unit tests.
Within the 'test' directory of Reflex you can add to a test file already there or create a new test python file if it doesn't fit into the existing layout.
- Any feature or significant change that has been added.
- Any edge cases or potential problem areas.
- Any interactions between different parts of the code.
Once you solve a current issue or improvement to Reflex, you can make a PR, and we will review the changes.
Before submitting, a pull request, ensure the following steps are taken and test passing.
In your reflex directory run make sure all the unit tests are still passing using the following command.
This will fail if code coverage is below 72%.
uv run pytest tests/units --cov --no-cov-on-fail --cov-report=Next make sure all the following tests pass. This ensures that every new change has proper type checking.
uv run ruff check .
uv run pyright reflex testsFinally, run ruff to format your code.
uv run ruff format .Consider installing git pre-commit hooks so Ruff, Pyright, and make_pyi will run automatically before each commit.
uv run pre-commit installThat's it you can now submit your PR. Thanks for contributing to Reflex!
We welcome AI-assisted contributions, but they must meet the same quality bar as any other PR.
- A human developer must be responsible for the PR contents and review process. Bot account PRs are subject to prejudicial closure.
- Ensure pre-commit hooks and unit tests pass before submitting.
- Review the patch locally with an "adversarial" prompt before opening the PR.
- Apply fixes for reasonable feedback from Greptile and/or Copilot review bots.
- Resolve or dismiss irrelevant bot feedback with a brief explanation.
- All added/changed lines MUST have unit or integration test coverage with real assertions. No untested code, no bogus test code.
- PRs with merge conflicts or failing tests will not be reviewed or merged. The maintainers do not spend time on PRs that are not in a ready state. If you need attention on a PR that is not ready, mention the maintainers in a comment.
The Reflex documentation lives in this repo under docs/. All doc pages are plain Markdown files in docs/, and the docs site itself (a Reflex app that renders them) lives in docs/app/. If you're fixing a typo, clarifying an explanation, or adding a new page, you can do it all in this repo by editing the relevant .md file.
1. Run the docs site locally:
cd docs/app
uv sync
uv run reflex runThen open http://localhost:3000/docs/. The dev server picks up changes to the .md files in docs/ so you can preview edits live.
2. Speed up dev builds with the page whitelist (optional):
By default the dev server compiles every page, which can be slow. To only compile the pages you're working on, edit docs/app/reflex_docs/whitelist.py and add paths to WHITELISTED_PAGES:
WHITELISTED_PAGES = [
"/getting-started/introduction",
"/components/props",
]Paths must start with /, have no trailing slash, and are prefix-matched. An empty list builds everything. Restart the dev server after editing.
To edit the templates in Reflex you can do so in two way.
Change to the basic blank template can be done in the reflex/.templates/apps/blank directory.
Others templates can be edited in their own repository. For example the sidebar template can be found in the reflex-sidebar repository.
For some pull requests when adding new components you will have to generate a pyi file for the new component. This is done by running the following command in the reflex directory.
(Please check in with the team before adding a new component to Reflex we are cautious about adding new components to Reflex's core.)
uv run python -m reflex.utils.pyi_generator