Skip to content

Make reflex init and docs uv-first#6287

Open
GautamBytes wants to merge 2 commits intoreflex-dev:mainfrom
GautamBytes:feat/migrate-to-uv
Open

Make reflex init and docs uv-first#6287
GautamBytes wants to merge 2 commits intoreflex-dev:mainfrom
GautamBytes:feat/migrate-to-uv

Conversation

@GautamBytes
Copy link
Copy Markdown

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)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

New Feature Submission:

  • Does your submission pass the tests?
  • Have you linted your code locally prior to submission?

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?

Description

  • make fresh reflex init projects generate pyproject.toml by default
  • keep existing requirements.txt projects working without creating a second manifest
  • update README, getting started docs, and onboarding docs to use uv
  • improve pyproject.toml dependency detection so only real Reflex dependencies count

After these steps, you're ready to open a pull request.

closes #6269

Signed-off-by: Gautam Manchandani <gautammanch@Gautams-MacBook-Air.local>
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 5, 2026

Greptile Summary

This PR makes reflex init uv-first by defaulting to pyproject.toml generation for new apps, while preserving backward compatibility for existing projects using requirements.txt. It also updates the README, getting-started, and onboarding docs to use uv commands throughout.

Key changes:

  • initialize_python_manifest in frontend_skeleton.py contains the core logic: new apps get pyproject.toml, existing requirements.txt projects are left untouched, and existing pyproject.toml files are preserved but checked for a Reflex dependency
  • pyproject_toml_template in compiler/templates.py generates a minimal PEP 517-compatible pyproject.toml
  • The _init entry point in reflex.py now surfaces appropriate uv sync / uv pip install next-steps after initialization
  • Six unit tests cover all manifest-detection branches including Poetry-style dependencies
  • Integration test now verifies pyproject.toml is created and requirements.txt is absent for blank template init

Minor issues: the Windows uv installation command is absent from the README, and a RequirementsTxt-namespaced constant is used in a pyproject.toml-specific user-facing message.

Confidence Score: 4/5

Safe to merge — core logic is correct and well-tested, backward compatibility with requirements.txt is preserved.

No P0 or P1 findings. Three P2 issues remain: missing Windows install guidance in README, a RequirementsTxt constant used in a pyproject.toml message, and a minor regex delimiter issue in the fallback TOML parser. None of these block merge but the README gap is worth addressing before release.

README.md (missing Windows uv install guidance), reflex/reflex.py (RequirementsTxt constant in pyproject message), reflex/utils/frontend_skeleton.py (fallback regex)

Important Files Changed

Filename Overview
reflex/utils/frontend_skeleton.py Adds initialize_python_manifest and helpers for pyproject.toml/requirements.txt detection — logic is correct and well-tested; fallback TOML regex has a minor delimiter-matching gap
reflex/reflex.py Calls initialize_python_manifest post-init and shows uv next-steps; pyproject.toml message incorrectly references RequirementsTxt.DEFAULTS_STUB
packages/reflex-base/src/reflex_base/compiler/templates.py Adds pyproject_toml_template that generates a minimal, valid pyproject.toml with pinned reflex version
packages/reflex-base/src/reflex_base/constants/config.py Adds DEFAULT_VERSION and REQUIRES_PYTHON constants to PyprojectToml namespace — clean addition
README.md Switches to uv-first getting-started flow; Windows uv installation guidance is missing
tests/units/utils/test_utils.py Comprehensive unit tests for all manifest initialization branches including Poetry-style, fallback, existing files — good edge-case coverage
tests/integration/init-test/in_docker_test_script.sh Installs uv in Docker and asserts pyproject.toml created / requirements.txt absent after blank init
reflex/utils/templates.py Remote template install hint updated to prefer uv sync for pyproject.toml and uv pip install for requirements.txt templates

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[reflex init] --> B{rxconfig.py exists?}
    B -- Yes --> C[reinit: skip app creation]
    B -- No --> D[initialize_default_app / remote template]
    D --> E[initialize_python_manifest]
    C --> E
    E --> F{pyproject.toml exists?}
    F -- Yes --> G{has reflex dependency?}
    G -- Yes --> H[return kind=pyproject]
    G -- No --> I[return kind=pyproject\nneeds_manual=True]
    F -- No --> J{requirements.txt exists?}
    J -- Yes --> K[_initialize_requirements_txt\nreturn kind=requirements]
    J -- No --> L[_initialize_pyproject_toml\ncreate new file\nreturn kind=pyproject]
    H --> M{manifest.kind?}
    I --> M
    K --> M
    L --> M
    M -- pyproject --> N[Show: uv sync + uv run reflex run]
    M -- requirements --> O[Show: uv pip install -r requirements.txt]
Loading

Reviews (1): Last reviewed commit: "Make reflex init uv-first" | Re-trigger Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate documentation and base template to uv + pyproject.toml

1 participant