Skip to content

Commit

Permalink
Merge branch 'main' into radix_3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Lendemor committed Apr 19, 2024
2 parents 588e8f1 + 7b61e7e commit 5e2a8b1
Show file tree
Hide file tree
Showing 316 changed files with 5,484 additions and 11,195 deletions.
11 changes: 10 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
[run]
source = reflex
branch = true
omit =
*/pyi_generator.py
reflex/__main__.py
reflex/app_module_for_backend.py
reflex/components/chakra/*
reflex/experimental/*

[report]
show_missing = true
# TODO bump back to 79
fail_under = 68
fail_under = 70
precision = 2

# Regexes for lines to exclude from consideration
Expand All @@ -24,6 +30,9 @@ exclude_also =

# Don't complain about abstract methods, they aren't run:
@(abc\.)?abstractmethod

# Don't complain about overloaded methods:
@overload

ignore_errors = True

Expand Down
98 changes: 87 additions & 11 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
name: benchmarking

on:
push:
branches: [main]
paths-ignore:
- '**/*.md'
pull_request:
branches: [main]
types:
- closed
paths-ignore:
- '**/*.md'

Expand All @@ -22,9 +19,11 @@ env:
TELEMETRY_ENABLED: false
NODE_OPTIONS: '--max_old_space_size=4096'
DATABASE_URL: ${{ secrets.DATABASE_URL }}
PR_TITLE: ${{ github.event.pull_request.title }}

jobs:
reflex-web:
if: github.event.pull_request.merged == true
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -63,18 +62,18 @@ jobs:
run: |
# Check that npm is home
npm -v
poetry run bash scripts/benchmarks.sh ./reflex-web prod
poetry run bash scripts/benchmarks/benchmarks.sh ./reflex-web prod
env:
LHCI_GITHUB_APP_TOKEN: $
- name: Run Benchmarks
# Only run if the database creds are available in this context.
if: ${{ env.DATABASE_URL }}
run: poetry run python scripts/lighthouse_score_upload.py "$GITHUB_SHA" ./integration/benchmarks/.lighthouseci
run: poetry run python scripts/benchmarks/lighthouse_score_upload.py "$GITHUB_SHA" ./integration/benchmarks/.lighthouseci
env:
GITHUB_SHA: ${{ github.sha }}
PR_TITLE: ${{ github.event.pull_request.title }}

simple-apps-benchmarks:
if: github.event.pull_request.merged == true
env:
OUTPUT_FILE: benchmarks.json
timeout-minutes: 50
Expand All @@ -92,6 +91,15 @@ jobs:
python-version: '3.9.18'
- os: windows-latest
python-version: '3.8.18'
# keep only one python version for MacOS
- os: macos-latest
python-version: '3.8.18'
- os: macos-latest
python-version: '3.9.18'
- os: macos-latest
python-version: '3.10.13'
- os: macos-latest
python-version: '3.12.0'
include:
- os: windows-latest
python-version: '3.10.11'
Expand Down Expand Up @@ -119,11 +127,79 @@ jobs:
- name: Upload benchmark results
# Only run if the database creds are available in this context.
if: ${{ env.DATABASE_URL }}
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run:
poetry run python scripts/simple_app_benchmark_upload.py --os "${{ matrix.os }}"
poetry run python scripts/benchmarks/simple_app_benchmark_upload.py --os "${{ matrix.os }}"
--python-version "${{ matrix.python-version }}" --commit-sha "${{ github.sha }}"
--benchmark-json "${{ 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-build-size:
if: github.event.pull_request.merged == true
timeout-minutes: 30
strategy:
# Prioritize getting more information out of the workflow (even if something fails)
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup_build_env
with:
python-version: 3.11.5
run-poetry-install: true
create-venv-at-path: .venv
- name: Install additional dependencies for DB access
run: poetry run pip install psycopg2-binary
- name: Build reflex
run: |
poetry build
- name: Upload benchmark results
# Only run if the database creds are available in this context.
if: ${{ env.DATABASE_URL }}
run:
poetry run python scripts/benchmarks/benchmark_reflex_size.py --os ubuntu-latest
--python-version 3.11.5 --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 "reflex-build" --path ./dist

reflex-plus-dependency-size:
if: github.event.pull_request.merged == true
timeout-minutes: 30
strategy:
# Prioritize getting more information out of the workflow (even if something fails)
fail-fast: false
matrix:
# Show OS combos first in GUI
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.11.5']

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.3.1
virtualenvs-create: true
virtualenvs-in-project: true
virtualenvs-path: .venv

- name: Run poetry install
shell: bash
run: |
python -m venv .venv
source .venv/*/activate
poetry install --without dev --no-interaction --no-root
- name: Install additional dependencies for DB access
run: poetry run pip install psycopg2-binary

- if: ${{ env.DATABASE_URL }}
name: calculate and upload size
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 "reflex-package" --path ./.venv
16 changes: 10 additions & 6 deletions .github/workflows/check_generated_pyi.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
name: check-generated-pyi

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.id }}
cancel-in-progress: true

on:
push:
branches: [ "main" ]
# We don't just trigger on pyi_generator.py and the components dir, because
branches: ['main']
# We don't just trigger on make_pyi.py and the components dir, because
# there are other things that can change the generator output
# e.g. black version, reflex.Component, reflex.Var.
paths-ignore:
- '**/*.md'
pull_request:
branches: [ "main" ]
branches: ['main']
paths-ignore:
- '**/*.md'

Expand All @@ -21,15 +25,15 @@ jobs:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup_build_env
with:
python-version: "3.11.5"
python-version: '3.11.5'
run-poetry-install: true
create-venv-at-path: .venv
- run: |
poetry run python scripts/pyi_generator.py
poetry run python scripts/make_pyi.py
if [[ $(git status --porcelain) ]]; then
git status
git diff
echo "ERROR: pyi_generator.py output is out of date. Please run scripts/pyi_generator.py and commit the changes."
echo "ERROR: make_pyi.py output is out of date. Please run scripts/make_pyi.py and commit the changes."
exit 1
else
echo "No diffs - AOK!"
Expand Down
44 changes: 24 additions & 20 deletions .github/workflows/integration_app_harness.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
name: integration-app-harness

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.id }}
cancel-in-progress: true

on:
push:
branches: [ "main" ]
branches: ['main']
paths-ignore:
- '**/*.md'
pull_request:
branches: [ "main" ]
branches: ['main']
paths-ignore:
- '**/*.md'

Expand All @@ -18,8 +22,8 @@ jobs:
timeout-minutes: 30
strategy:
matrix:
state_manager: [ "redis", "memory" ]
python-version: ["3.8.18", "3.11.5", "3.12.0"]
state_manager: ['redis', 'memory']
python-version: ['3.8.18', '3.11.5', '3.12.0']
runs-on: ubuntu-latest
services:
# Label used to access the service container
Expand All @@ -35,22 +39,22 @@ jobs:
# Maps port 6379 on service container to the host
- 6379:6379
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup_build_env
with:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup_build_env
with:
python-version: ${{ matrix.python-version }}
run-poetry-install: true
create-venv-at-path: .venv
- run: poetry run pip install pyvirtualdisplay pillow
- name: Run app harness tests
env:
SCREENSHOT_DIR: /tmp/screenshots
REDIS_URL: ${{ matrix.state_manager == 'redis' && 'redis://localhost:6379' || '' }}
run: |
poetry run pytest integration
- uses: actions/upload-artifact@v4
name: Upload failed test screenshots
if: always()
with:
name: failed_test_screenshots
path: /tmp/screenshots
- run: poetry run pip install pyvirtualdisplay pillow
- name: Run app harness tests
env:
SCREENSHOT_DIR: /tmp/screenshots
REDIS_URL: ${{ matrix.state_manager == 'redis' && 'redis://localhost:6379' || '' }}
run: |
poetry run pytest integration
- uses: actions/upload-artifact@v4
name: Upload failed test screenshots
if: always()
with:
name: failed_test_screenshots
path: /tmp/screenshots
28 changes: 26 additions & 2 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ on:
paths-ignore:
- '**/*.md'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.id }}
cancel-in-progress: true

permissions:
contents: read

Expand All @@ -26,6 +30,8 @@ env:
PYTHONIOENCODING: 'utf8'
TELEMETRY_ENABLED: false
NODE_OPTIONS: '--max_old_space_size=4096'
DATABASE_URL: ${{ secrets.DATABASE_URL }}
PR_TITLE: ${{ github.event.pull_request.title }}

jobs:
example-counter:
Expand Down Expand Up @@ -60,17 +66,17 @@ jobs:
python-version: ${{ matrix.python-version }}
run-poetry-install: true
create-venv-at-path: .venv

- name: Clone Reflex Examples Repo
uses: actions/checkout@v4
with:
repository: reflex-dev/reflex-examples
path: reflex-examples

- name: Install requirements for counter example
working-directory: ./reflex-examples/counter
run: |
poetry run pip install -r requirements.txt
- name: Install additional dependencies for DB access
run: poetry run pip install psycopg2-binary
- name: Check export --backend-only before init for counter example
working-directory: ./reflex-examples/counter
run: |
Expand All @@ -91,6 +97,14 @@ jobs:
# Check that npm is home
npm -v
poetry run bash scripts/integration.sh ./reflex-examples/counter dev
- name: Measure and upload .web size
if: ${{ env.DATABASE_URL }}
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

reflex-web:
strategy:
Expand Down Expand Up @@ -121,6 +135,8 @@ jobs:
- name: Install Requirements for reflex-web
working-directory: ./reflex-web
run: poetry run pip install -r requirements.txt
- name: Install additional dependencies for DB access
run: poetry run pip install psycopg2-binary
- name: Init Website for reflex-web
working-directory: ./reflex-web
run: poetry run reflex init
Expand All @@ -129,3 +145,11 @@ jobs:
# Check that npm is home
npm -v
poetry run bash scripts/integration.sh ./reflex-web prod
- name: Measure and upload .web size
if: ${{ env.DATABASE_URL }}
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 "reflex-web-dot-web" --path ./reflex-web/.web
4 changes: 4 additions & 0 deletions .github/workflows/integration_tests_wsl.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: integration-tests-wsl

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.id }}
cancel-in-progress: true

on:
push:
branches: ['main']
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: pre-commit

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.id }}
cancel-in-progress: true

on:
pull_request:
branches: ['main']
Expand Down
Loading

0 comments on commit 5e2a8b1

Please sign in to comment.