Skip to content

Commit

Permalink
add workflow to check dependencies on release branch (#4050)
Browse files Browse the repository at this point in the history
* add workflow to check dependencies on release branch

* rename action to follow convention of other actions

* update workflow

* bump poetry version

* relock deps

* update check to ignore pyright and ruff

* oops, you saw nothing

* split dep check in two job

* fix frontend dep check

* fix stuff

* hmm yeah

* nope nope nope

* sigh

* bump js versions for some packages

* fix some warnings in tests

* fix tests

* try some options

* try to set asyncio policy

* debug dep check

* fix attempt for backend dep

* clean up output for backend check

* run bun outdated on reflex-web to catch most of the packages

* fix python version

* fix python version

* add missing env

* fix bun command

* fix workdir of frontend check

* update packages version

* up-pin plotly.js version

* add debug ouput

* clean frontend dep check output

* fix output

* fix async tests for redis

* relock poetry.lock

* Non-async functions do not need pytest_asyncio.fixture

* test_state: close StateManagerRedis connection in test to avoid warning

---------

Co-authored-by: Masen Furer <m_github@0x26.net>
  • Loading branch information
Lendemor and masenf authored Oct 7, 2024
1 parent 7cd5c90 commit 59dd54c
Show file tree
Hide file tree
Showing 23 changed files with 267 additions and 152 deletions.
2 changes: 1 addition & 1 deletion .github/actions/setup_build_env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ inputs:
poetry-version:
description: 'Poetry version to install'
required: false
default: '1.3.1'
default: '1.8.3'
run-poetry-install:
description: 'Whether to run poetry install on current dir'
required: false
Expand Down
88 changes: 88 additions & 0 deletions .github/workflows/check_outdated_dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: check-outdated-dependencies

on:
push: # This will trigger the action when a pull request is opened or updated.
branches:
- 'release/**' # This will trigger the action when any branch starting with "release/" is created.
workflow_dispatch: # Allow manual triggering if needed.

jobs:
backend:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- uses: ./.github/actions/setup_build_env
with:
python-version: '3.9'
run-poetry-install: true
create-venv-at-path: .venv

- name: Check outdated backend dependencies
run: |
outdated=$(poetry show -oT)
echo "Outdated:"
echo "$outdated"
filtered_outdated=$(echo "$outdated" | grep -vE 'pyright|ruff' || true)
if [ ! -z "$filtered_outdated" ]; then
echo "Outdated dependencies found:"
echo "$filtered_outdated"
exit 1
else
echo "All dependencies are up to date. (pyright and ruff are ignored)"
fi
frontend:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: ./.github/actions/setup_build_env
with:
python-version: '3.10.11'
run-poetry-install: true
create-venv-at-path: .venv
- name: Clone Reflex Website Repo
uses: actions/checkout@v4
with:
repository: reflex-dev/reflex-web
ref: main
path: reflex-web
- name: Install Requirements for reflex-web
working-directory: ./reflex-web
run: poetry run uv pip install -r requirements.txt
- name: Install additional dependencies for DB access
run: poetry run uv pip install psycopg2-binary
- name: Init Website for reflex-web
working-directory: ./reflex-web
run: poetry run reflex init
- name: Run Website and Check for errors
run: |
poetry run bash scripts/integration.sh ./reflex-web dev
- name: Check outdated frontend dependencies
working-directory: ./reflex-web/.web
run: |
raw_outdated=$(/home/runner/.local/share/reflex/bun/bin/bun outdated)
outdated=$(echo "$raw_outdated" | grep -vE '\|\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\|' || true)
echo "Outdated:"
echo "$outdated"
# Ignore 3rd party dependencies that are not updated.
filtered_outdated=$(echo "$outdated" | grep -vE 'Package|@chakra-ui|lucide-react|@splinetool/runtime|ag-grid-react|framer-motion' || true)
no_extra=$(echo "$filtered_outdated" | grep -vE '\|\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-' || true)
if [ ! -z "$no_extra" ]; then
echo "Outdated dependencies found:"
echo "$filtered_outdated"
exit 1
else
echo "All dependencies are up to date. (3rd party packages are ignored)"
fi
185 changes: 95 additions & 90 deletions poetry.lock

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,21 @@ reflex-hosting-cli = ">=0.1.2,<2.0"
charset-normalizer = ">=3.3.2,<4.0"
wheel = ">=0.42.0,<1.0"
build = ">=1.0.3,<2.0"
setuptools = ">=69.1.1,<70.2"
setuptools = ">=75.0"
httpx = ">=0.25.1,<1.0"
twine = ">=4.0.0,<6.0"
tomlkit = ">=0.12.4,<1.0"
lazy_loader = ">=0.4"
reflex-chakra = ">=0.6.0"

[tool.poetry.group.dev.dependencies]
pytest = ">=7.1.2,<8.0"
pytest = ">=7.1.2,<9.0"
pytest-mock = ">=3.10.0,<4.0"
pyright = ">=1.1.229,<1.1.335"
darglint = ">=1.8.1,<2.0"
toml = ">=0.10.2,<1.0"
pytest-asyncio = ">=0.20.1,<0.22.0" # https://github.com/pytest-dev/pytest-asyncio/issues/706
pytest-cov = ">=4.0.0,<5.0"
pytest-asyncio = ">=0.24.0"
pytest-cov = ">=4.0.0,<6.0"
ruff = "^0.4.9"
pandas = ">=2.1.1,<3.0"
pillow = ">=10.0.0,<11.0"
Expand Down Expand Up @@ -100,3 +100,7 @@ lint.pydocstyle.convention = "google"
"reflex/.templates/*.py" = ["D100", "D103", "D104"]
"*.pyi" = ["D301", "D415", "D417", "D418", "E742"]
"*/blank.py" = ["I001"]

[tool.pytest.ini_options]
asyncio_default_fixture_loop_scope = "function"
asyncio_mode = "auto"
2 changes: 1 addition & 1 deletion reflex/components/core/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class UploadFilesProvider(Component):
class Upload(MemoizationLeaf):
"""A file upload component."""

library = "react-dropzone@14.2.3"
library = "react-dropzone@14.2.9"

tag = "ReactDropzone"

Expand Down
4 changes: 2 additions & 2 deletions reflex/components/datadisplay/dataeditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,10 @@ class DataEditor(NoSSRComponent):

tag = "DataEditor"
is_default = True
library: str = "@glideapps/glide-data-grid@^5.3.0"
library: str = "@glideapps/glide-data-grid@^6.0.3"
lib_dependencies: List[str] = [
"lodash@^4.17.21",
"marked@^4.0.10",
"marked@^14.1.2",
"react-responsive-carousel@^3.2.7",
]

Expand Down
4 changes: 2 additions & 2 deletions reflex/components/gridjs/datatable.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
class Gridjs(Component):
"""A component that wraps a nivo bar component."""

library = "gridjs-react@6.0.1"
library = "gridjs-react@6.1.1"

lib_dependencies: List[str] = ["gridjs@6.0.6"]
lib_dependencies: List[str] = ["gridjs@6.2.0"]


class DataTable(Gridjs):
Expand Down
10 changes: 5 additions & 5 deletions reflex/components/markdown/markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def get_base_component_map() -> dict[str, Callable]:
class Markdown(Component):
"""A markdown component."""

library = "react-markdown@8.0.7"
library = "react-markdown@9.0.1"

tag = "ReactMarkdown"

Expand Down Expand Up @@ -157,19 +157,19 @@ def add_imports(self) -> ImportDict | list[ImportDict]:
return [
{
"": "katex/dist/katex.min.css",
"remark-math@5.1.1": ImportVar(
"remark-math@6.0.0": ImportVar(
tag=_REMARK_MATH._js_expr, is_default=True
),
"remark-gfm@3.0.1": ImportVar(
"remark-gfm@4.0.0": ImportVar(
tag=_REMARK_GFM._js_expr, is_default=True
),
"remark-unwrap-images@4.0.0": ImportVar(
tag=_REMARK_UNWRAP_IMAGES._js_expr, is_default=True
),
"rehype-katex@6.0.3": ImportVar(
"rehype-katex@7.0.1": ImportVar(
tag=_REHYPE_KATEX._js_expr, is_default=True
),
"rehype-raw@6.1.1": ImportVar(
"rehype-raw@7.0.0": ImportVar(
tag=_REHYPE_RAW._js_expr, is_default=True
),
},
Expand Down
2 changes: 1 addition & 1 deletion reflex/components/plotly/plotly.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class Plotly(NoSSRComponent):

library = "react-plotly.js@2.6.0"

lib_dependencies: List[str] = ["plotly.js@2.22.0"]
lib_dependencies: List[str] = ["plotly.js@2.35.2"]

tag = "Plot"

Expand Down
2 changes: 1 addition & 1 deletion reflex/components/radix/primitives/form.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
class FormComponent(RadixPrimitiveComponentWithClassName):
"""Base class for all @radix-ui/react-form components."""

library = "@radix-ui/react-form@^0.0.3"
library = "@radix-ui/react-form@^0.1.0"


class FormRoot(FormComponent, HTMLForm):
Expand Down
2 changes: 1 addition & 1 deletion reflex/components/react_player/react_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ReactPlayer(NoSSRComponent):
reference: https://github.com/cookpete/react-player.
"""

library = "react-player@2.12.0"
library = "react-player@2.16.0"

tag = "ReactPlayer"

Expand Down
2 changes: 1 addition & 1 deletion reflex/components/sonner/toast.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class Config:
class Toaster(Component):
"""A Toaster Component for displaying toast notifications."""

library: str = "sonner@1.4.41"
library: str = "sonner@1.5.0"

tag = "Toaster"

Expand Down
28 changes: 14 additions & 14 deletions reflex/constants/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Bun(SimpleNamespace):
"""Bun constants."""

# The Bun version.
VERSION = "1.1.10"
VERSION = "1.1.29"
# Min Bun Version
MIN_VERSION = "0.7.0"
# The directory to store the bun.
Expand Down Expand Up @@ -116,21 +116,21 @@ class Commands(SimpleNamespace):
PATH = "package.json"

DEPENDENCIES = {
"@babel/standalone": "7.25.3",
"@emotion/react": "11.11.1",
"axios": "1.6.0",
"@babel/standalone": "7.25.7",
"@emotion/react": "11.13.3",
"axios": "1.7.7",
"json5": "2.2.3",
"next": "14.2.13",
"next-sitemap": "4.1.8",
"next-themes": "0.2.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-focus-lock": "2.11.3",
"socket.io-client": "4.6.1",
"universal-cookie": "4.0.4",
"next": "14.2.14",
"next-sitemap": "4.2.3",
"next-themes": "0.3.0",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-focus-lock": "2.13.2",
"socket.io-client": "4.8.0",
"universal-cookie": "7.2.0",
}
DEV_DEPENDENCIES = {
"autoprefixer": "10.4.14",
"postcss": "8.4.31",
"autoprefixer": "10.4.20",
"postcss": "8.4.47",
"postcss-import": "16.1.0",
}
2 changes: 1 addition & 1 deletion reflex/constants/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Tailwind(SimpleNamespace):
"""Tailwind constants."""

# The Tailwindcss version
VERSION = "tailwindcss@3.3.2"
VERSION = "tailwindcss@3.4.13"
# The Tailwind config.
CONFIG = "tailwind.config.js"
# Default Tailwind content paths
Expand Down
4 changes: 2 additions & 2 deletions tests/units/components/core/test_cond.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from reflex.components.base.fragment import Fragment
from reflex.components.core.cond import Cond, cond
from reflex.components.radix.themes.typography.text import Text
from reflex.state import BaseState, State
from reflex.state import BaseState
from reflex.utils.format import format_state_name
from reflex.vars.base import LiteralVar, Var, computed_var

Expand Down Expand Up @@ -124,7 +124,7 @@ def test_cond_no_else():
def test_cond_computed_var():
"""Test if cond works with computed vars."""

class CondStateComputed(State):
class CondStateComputed(BaseState):
@computed_var
def computed_int(self) -> int:
return 0
Expand Down
4 changes: 2 additions & 2 deletions tests/units/components/core/test_foreach.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class ForEachState(BaseState):
color_index_tuple: Tuple[int, str] = (0, "red")


class TestComponentState(ComponentState):
class ComponentStateTest(ComponentState):
"""A test component state."""

foo: bool
Expand Down Expand Up @@ -288,5 +288,5 @@ def test_foreach_component_state():
with pytest.raises(TypeError):
Foreach.create(
ForEachState.colors_list,
TestComponentState.create,
ComponentStateTest.create,
)
14 changes: 7 additions & 7 deletions tests/units/components/core/test_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from reflex.vars.base import LiteralVar, Var


class TestUploadState(State):
class UploadStateTest(State):
"""Test upload state."""

def drop_handler(self, files):
Expand Down Expand Up @@ -55,7 +55,7 @@ def test_upload_create():

up_comp_2 = Upload.create(
id="foo_id",
on_drop=TestUploadState.drop_handler([]), # type: ignore
on_drop=UploadStateTest.drop_handler([]), # type: ignore
)
assert isinstance(up_comp_2, Upload)
assert up_comp_2.is_used
Expand All @@ -65,7 +65,7 @@ def test_upload_create():

up_comp_3 = Upload.create(
id="foo_id",
on_drop=TestUploadState.drop_handler,
on_drop=UploadStateTest.drop_handler,
)
assert isinstance(up_comp_3, Upload)
assert up_comp_3.is_used
Expand All @@ -75,7 +75,7 @@ def test_upload_create():

up_comp_4 = Upload.create(
id="foo_id",
on_drop=TestUploadState.not_drop_handler([]), # type: ignore
on_drop=UploadStateTest.not_drop_handler([]), # type: ignore
)
assert isinstance(up_comp_4, Upload)
assert up_comp_4.is_used
Expand All @@ -91,7 +91,7 @@ def test_styled_upload_create():

styled_up_comp_2 = StyledUpload.create(
id="foo_id",
on_drop=TestUploadState.drop_handler([]), # type: ignore
on_drop=UploadStateTest.drop_handler([]), # type: ignore
)
assert isinstance(styled_up_comp_2, StyledUpload)
assert styled_up_comp_2.is_used
Expand All @@ -101,7 +101,7 @@ def test_styled_upload_create():

styled_up_comp_3 = StyledUpload.create(
id="foo_id",
on_drop=TestUploadState.drop_handler,
on_drop=UploadStateTest.drop_handler,
)
assert isinstance(styled_up_comp_3, StyledUpload)
assert styled_up_comp_3.is_used
Expand All @@ -111,7 +111,7 @@ def test_styled_upload_create():

styled_up_comp_4 = StyledUpload.create(
id="foo_id",
on_drop=TestUploadState.not_drop_handler([]), # type: ignore
on_drop=UploadStateTest.not_drop_handler([]), # type: ignore
)
assert isinstance(styled_up_comp_4, StyledUpload)
assert styled_up_comp_4.is_used
Expand Down
File renamed without changes.
Loading

0 comments on commit 59dd54c

Please sign in to comment.