Skip to content

Commit 51e795e

Browse files
authored
Merge pull request #4 from Lendemor/lendemor/add_CI
add CI
2 parents ff5e708 + b8a2590 commit 51e795e

File tree

8 files changed

+72
-6
lines changed

8 files changed

+72
-6
lines changed

.github/workflows/pre-commit.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: pre-commit
2+
3+
on:
4+
pull_request:
5+
branches: ["main"]
6+
push:
7+
branches: ["main"]
8+
9+
jobs:
10+
pre-commit:
11+
timeout-minutes: 30
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: actions/setup-python@v2
16+
with:
17+
python-version: "3.12"
18+
- run: |
19+
pip install pre-commit
20+
pip install pyright
21+
pre-commit run --all-files
22+
env:
23+
SKIP: update-pyi-files

.pre-commit-config.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
fail_fast: true
2+
3+
repos:
4+
5+
- repo: https://github.com/charliermarsh/ruff-pre-commit
6+
rev: v0.7.0
7+
hooks:
8+
- id: ruff-format
9+
args: [custom_components, monaco_demo]
10+
- id: ruff
11+
args: ["--fix", "--exit-non-zero-on-fix"]
12+
13+
- repo: https://github.com/codespell-project/codespell
14+
rev: v2.3.0
15+
hooks:
16+
- id: codespell
17+
args: [custom_components, "*_demo"]
18+
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
from .monaco import *
1+
"""The reflex_monaco component."""
2+
3+
from .monaco import monaco, monaco_diff

custom_components/reflex_monaco/monaco.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class MonacoComponent(rx.Component):
1414
language: rx.Var[str]
1515

1616
# The theme to use for the editor.
17-
theme: rx.Var[str] = rx.color_mode_cond("light", "vs-dark") # type: ignore
17+
theme: rx.Var[str] = rx.color_mode_cond("light", "vs-dark")
1818

1919
# The line to jump to in the editor.
2020
line: rx.Var[int] = rx.Var.create(1)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Demo package for reflex-monaco."""

monaco_demo/monaco_demo/monaco_demo.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22

33
from typing import Any
44

5-
from reflex_monaco import monaco, monaco_diff
6-
75
import reflex as rx
6+
from reflex_monaco import monaco, monaco_diff
87

98
ORIGINAL_CONTENT = """
109
# Reflex Monaco Editor Demo
@@ -34,14 +33,17 @@ class FileState(rx.State):
3433

3534
@rx.event
3635
def load_file_content(self):
36+
"""Load the file content."""
3737
self.modified_content = self.original_content
3838

3939
@rx.event
4040
def on_change(self, value: str):
41+
"""Update the modified content."""
4142
self.modified_content = value
4243

4344
@rx.event
4445
def on_view_change(self, view: str):
46+
"""Update the active view."""
4547
self.active_view = view
4648

4749

@@ -50,6 +52,7 @@ def on_view_change(self, view: str):
5052

5153

5254
def edit_view():
55+
"""The Monaco editor view."""
5356
return monaco(
5457
width=MONACO_WIDTH,
5558
height=MONACO_HEIGHT,
@@ -61,6 +64,7 @@ def edit_view():
6164

6265

6366
def diff_view():
67+
"""The Monaco diff editor view."""
6468
return monaco_diff(
6569
width=MONACO_WIDTH,
6670
height=MONACO_HEIGHT,
@@ -73,6 +77,7 @@ def diff_view():
7377

7478
@rx.page(on_load=FileState.load_file_content)
7579
def index() -> Any:
80+
"""The main page."""
7681
return rx.vstack(
7782
rx.box(),
7883
rx.heading(

monaco_demo/rxconfig.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
"""Config file for the monaco_demo app."""
2+
13
import reflex as rx
24

35
config = rx.Config(
46
app_name="monaco_demo",
5-
)
7+
)

pyproject.toml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,19 @@ dev = ["build", "twine"]
2626

2727

2828
[tool.setuptools.packages.find]
29-
where = ["custom_components"]
29+
where = ["custom_components"]
30+
31+
32+
[tool.ruff]
33+
target-version = "py310"
34+
output-format = "concise"
35+
lint.isort.split-on-trailing-comma = false
36+
lint.select = ["B", "C4", "E", "ERA", "F", "FURB", "I", "N", "PERF", "PTH", "RUF", "SIM", "T", "TRY", "W"]
37+
lint.ignore = ["B008", "D205", "E501", "F403", "SIM115", "RUF006", "RUF008", "RUF012", "TRY0"]
38+
lint.pydocstyle.convention = "google"
39+
include = ["custom_components/**/*.py", "ag_grid_demo/**/*.py"]
40+
41+
[tool.ruff.lint.per-file-ignores]
42+
"__init__.py" = ["F401"]
43+
"env.py" = ["ALL"]
44+
"*/alembic/*" = ["ALL"]

0 commit comments

Comments
 (0)