Skip to content

Commit

Permalink
Merge branch 'main' into masenf/add-hooks-var-data
Browse files Browse the repository at this point in the history
  • Loading branch information
masenf authored May 15, 2024
2 parents f165724 + d96baac commit 8826854
Show file tree
Hide file tree
Showing 63 changed files with 2,134 additions and 955 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
labels: bug
assignees: ''

---
Expand Down
5 changes: 5 additions & 0 deletions .github/actions/setup_build_env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,8 @@ runs:
run: |
source ${{ inputs.create-venv-at-path }}/*/activate
poetry install --only-root --no-interaction
- name: Install uv
shell: bash
run: |
poetry run pip install uv
13 changes: 9 additions & 4 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:

- name: Install Requirements for reflex-web
working-directory: ./reflex-web
run: poetry run pip install -r requirements.txt
run: poetry run uv pip install -r requirements.txt
- name: Init Website for reflex-web
working-directory: ./reflex-web
run: poetry run reflex init
Expand Down Expand Up @@ -117,7 +117,7 @@ jobs:
run-poetry-install: true
create-venv-at-path: .venv
- name: Install additional dependencies for DB access
run: poetry run pip install psycopg2-binary
run: poetry run uv pip install psycopg2-binary
- name: Run benchmark tests
env:
APP_HARNESS_HEADLESS: 1
Expand Down Expand Up @@ -149,7 +149,7 @@ jobs:
run-poetry-install: true
create-venv-at-path: .venv
- name: Install additional dependencies for DB access
run: poetry run pip install psycopg2-binary
run: poetry run uv pip install psycopg2-binary
- name: Build reflex
run: |
poetry build
Expand Down Expand Up @@ -192,8 +192,13 @@ jobs:
source .venv/*/activate
poetry install --without dev --no-interaction --no-root
- name: Install uv
shell: bash
run: |
poetry run pip install uv
- name: Install additional dependencies for DB access
run: poetry run pip install psycopg2-binary
run: poetry run uv pip install psycopg2-binary

- if: ${{ env.DATABASE_URL }}
name: calculate and upload size
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: 'Dependency Review'
on: [pull_request]

permissions:
contents: read

jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v4
- name: 'Dependency Review'
uses: actions/dependency-review-action@v4
with:
allow-licenses: Apache-2.0, BSD-2-Clause, BSD-3-Clause, HPND, ISC, MIT, MPL-2.0, PSF-2.0, Unlicense
2 changes: 1 addition & 1 deletion .github/workflows/integration_app_harness.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
python-version: ${{ matrix.python-version }}
run-poetry-install: true
create-venv-at-path: .venv
- run: poetry run pip install pyvirtualdisplay pillow
- run: poetry run uv pip install pyvirtualdisplay pillow
- name: Run app harness tests
env:
SCREENSHOT_DIR: /tmp/screenshots
Expand Down
32 changes: 26 additions & 6 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ env:

jobs:
example-counter:
env:
OUTPUT_FILE: import_benchmark.json
timeout-minutes: 30
strategy:
# Prioritize getting more information out of the workflow (even if something fails)
Expand Down Expand Up @@ -74,9 +76,9 @@ jobs:
- name: Install requirements for counter example
working-directory: ./reflex-examples/counter
run: |
poetry run pip install -r requirements.txt
poetry run uv pip install -r requirements.txt
- name: Install additional dependencies for DB access
run: poetry run pip install psycopg2-binary
run: poetry run uv pip install psycopg2-binary
- name: Check export --backend-only before init for counter example
working-directory: ./reflex-examples/counter
run: |
Expand All @@ -98,13 +100,31 @@ jobs:
npm -v
poetry run bash scripts/integration.sh ./reflex-examples/counter dev
- name: Measure and upload .web size
if: ${{ env.DATABASE_URL }}
if: ${{ env.DATABASE_URL && github.event.pull_request.merged == true }}
run:
poetry run python scripts/benchmarks/benchmark_reflex_size.py --os "${{ matrix.os }}"
--python-version "${{ matrix.python-version }}" --commit-sha "${{ github.sha }}"
--pr-id "${{ github.event.pull_request.id }}" --db-url "${{ env.DATABASE_URL }}"
--branch-name "${{ github.head_ref || github.ref_name }}"
--measurement-type "counter-app-dot-web" --path ./reflex-examples/counter/.web
- name: Install hyperfine
if: github.event.pull_request.merged == true
run: cargo install --locked hyperfine
- name: Benchmark imports
if: github.event.pull_request.merged == true
working-directory: ./reflex-examples/counter
run: hyperfine --warmup 3 "export POETRY_VIRTUALENVS_PATH=../../.venv; poetry run python counter/counter.py" --show-output --export-json "${{ env.OUTPUT_FILE }}" --shell bash
- name: Upload Benchmarks
if : ${{ env.DATABASE_URL && github.event.pull_request.merged == true }}
run:
poetry run python scripts/benchmarks/benchmark_imports.py --os "${{ matrix.os }}"
--python-version "${{ matrix.python-version }}" --commit-sha "${{ github.sha }}"
--benchmark-json "./reflex-examples/counter/${{ env.OUTPUT_FILE }}"
--db-url "${{ env.DATABASE_URL }}" --branch-name "${{ github.head_ref || github.ref_name }}"
--event-type "${{ github.event_name }}" --actor "${{ github.actor }}" --pr-id "${{ github.event.pull_request.id }}"




reflex-web:
strategy:
Expand Down Expand Up @@ -134,9 +154,9 @@ jobs:

- name: Install Requirements for reflex-web
working-directory: ./reflex-web
run: poetry run pip install -r requirements.txt
run: poetry run uv pip install -r requirements.txt
- name: Install additional dependencies for DB access
run: poetry run pip install psycopg2-binary
run: poetry run uv pip install psycopg2-binary
- name: Init Website for reflex-web
working-directory: ./reflex-web
run: poetry run reflex init
Expand All @@ -146,7 +166,7 @@ jobs:
npm -v
poetry run bash scripts/integration.sh ./reflex-web prod
- name: Measure and upload .web size
if: ${{ env.DATABASE_URL }}
if: ${{ env.DATABASE_URL && github.event.pull_request.merged == true }}
run:
poetry run python scripts/benchmarks/benchmark_reflex_size.py --os "${{ matrix.os }}"
--python-version "${{ matrix.python-version }}" --commit-sha "${{ github.sha }}"
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/integration_tests_wsl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,16 @@ jobs:
run: |
poetry install
- name: Install uv
shell: wsl-bash {0}
run: |
poetry run pip install uv
- name: Install requirements for counter example
working-directory: ./reflex-examples/counter
shell: wsl-bash {0}
run: |
poetry run pip install -r requirements.txt
poetry run uv pip install -r requirements.txt
- name: Check export --backend-only before init for counter example
working-directory: ./reflex-examples/counter
shell: wsl-bash {0}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
create-venv-at-path: .venv
# TODO pre-commit related stuff can be cached too (not a bottleneck yet)
- run: |
poetry run pip install pre-commit
poetry run uv pip install pre-commit
poetry run pre-commit run --all-files
env:
SKIP: update-pyi-files
4 changes: 2 additions & 2 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ jobs:
export REDIS_URL=redis://localhost:6379
poetry run pytest tests --cov --no-cov-on-fail --cov-report=
# Change to explicitly install v1 when reflex-hosting-cli is compatible with v2
- name: Run unit tests w/ pydantic v2
- name: Run unit tests w/ pydantic v1
run: |
export PYTHONUNBUFFERED=1
poetry run pip install "pydantic>2"
poetry run uv pip install "pydantic~=1.10"
poetry run pytest tests --cov --no-cov-on-fail --cov-report=
- run: poetry run coverage html
9 changes: 9 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,15 @@ pre-commit install
That's it you can now submit your PR. Thanks for contributing to Reflex!


## Editing Templates

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`](https://github.com/reflex-dev/sidebar-template) repository.


## Other Notes

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.
Expand Down
2 changes: 1 addition & 1 deletion integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def pytest_exception_interact(node, call, report):
safe_filename = re.sub(
r"(?u)[^-\w.]",
"_",
str(node.nodeid).strip().replace(" ", "_").replace(":", "_"),
str(node.nodeid).strip().replace(" ", "_").replace(":", "_").replace(".py", ""),
)

try:
Expand Down
1 change: 1 addition & 0 deletions integration/init-test/in_docker_test_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function do_export () {
echo "Preparing test project dir"
python3 -m venv ~/venv
source ~/venv/bin/activate
pip install -U pip

echo "Installing reflex from local repo code"
pip install /reflex-repo
Expand Down
1 change: 1 addition & 0 deletions integration/test_component_state.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test that per-component state scaffold works and operates independently."""

from typing import Generator

import pytest
Expand Down
Loading

0 comments on commit 8826854

Please sign in to comment.