From e9514e622d27e14c4cd69f0c48d72aac3b32e685 Mon Sep 17 00:00:00 2001 From: Christopher Li <.@.> Date: Mon, 15 Sep 2025 20:41:44 -0400 Subject: [PATCH 1/5] stop tests running on pushes to main --- .github/workflows/test-project.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-project.yml b/.github/workflows/test-project.yml index 85e526c..59940dd 100644 --- a/.github/workflows/test-project.yml +++ b/.github/workflows/test-project.yml @@ -3,9 +3,9 @@ name: Scadable Tests on: pull_request: types: [opened, synchronize, reopened, ready_for_review] - push: - branches: - - main +# push: +# branches: +# - main jobs: test: From 2aaad11b31290fdf94cb32a563d1a0e57044f410 Mon Sep 17 00:00:00 2001 From: Christopher Li <.@.> Date: Mon, 15 Sep 2025 20:51:36 -0400 Subject: [PATCH 2/5] feat: add pre-commit hooks for linting --- .pre-commit-config.yaml | 14 ++++++++++++++ pyproject.toml | 5 +++-- 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..ef4821a --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,14 @@ +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v3.2.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files +- repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.13.0 + hooks: + - id: ruff-check + args: [ --fix ] + - id: ruff-format diff --git a/pyproject.toml b/pyproject.toml index c0c233e..8fe3fd5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,10 +24,11 @@ dependencies = [ dev = [ "pytest", "coverage", - "pytest-cov" + "pytest-cov", + "pre-commit" ] [project.urls] "Homepage" = "https://github.com/scadable/library-python" -"Bug Tracker" = "https://github.com/scadable/library-python/issues" \ No newline at end of file +"Bug Tracker" = "https://github.com/scadable/library-python/issues" From 0250ffc268eb9976c9a8a30b638c15d256132132 Mon Sep 17 00:00:00 2001 From: Christopher Li <.@.> Date: Mon, 15 Sep 2025 20:51:50 -0400 Subject: [PATCH 3/5] refactor: precommit hooks --- .gitignore | 6 +++--- README.md | 2 +- src/scadable/__init__.py | 2 +- tests/test_import.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 10ca01a..3578d82 100644 --- a/.gitignore +++ b/.gitignore @@ -182,9 +182,9 @@ cython_debug/ .abstra/ # Visual Studio Code -# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore +# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore -# and can be added to the global gitignore or merged into this file. However, if you prefer, +# and can be added to the global gitignore or merged into this file. However, if you prefer, # you could uncomment the following to ignore the entire vscode folder # .vscode/ @@ -207,4 +207,4 @@ marimo/_lsp/ __marimo__/ # Pycharm files -.idea \ No newline at end of file +.idea diff --git a/README.md b/README.md index d980934..a7cc10a 100644 --- a/README.md +++ b/README.md @@ -1 +1 @@ -# library-python \ No newline at end of file +# library-python diff --git a/src/scadable/__init__.py b/src/scadable/__init__.py index 8e23576..ad35e5a 100644 --- a/src/scadable/__init__.py +++ b/src/scadable/__init__.py @@ -1 +1 @@ -print("Hello World") \ No newline at end of file +print("Hello World") diff --git a/tests/test_import.py b/tests/test_import.py index 150d14e..5b8609e 100644 --- a/tests/test_import.py +++ b/tests/test_import.py @@ -1,2 +1,2 @@ def test_module_import(): - import src.scadable + pass From aaaf8fce4ba276acd91018d5228e7e34ee427e02 Mon Sep 17 00:00:00 2001 From: Christopher Li <.@.> Date: Mon, 15 Sep 2025 20:57:17 -0400 Subject: [PATCH 4/5] test: add import test case --- tests/test_import.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_import.py b/tests/test_import.py index 5b8609e..3c50747 100644 --- a/tests/test_import.py +++ b/tests/test_import.py @@ -1,2 +1,2 @@ def test_module_import(): - pass + import src.scadable # noqa From 8125b50bba9a7cff57153e26355ebf1b9ad46d0f Mon Sep 17 00:00:00 2001 From: Christopher Li <.@.> Date: Mon, 15 Sep 2025 22:18:26 -0400 Subject: [PATCH 5/5] chore: add workflow for linting --- .github/workflows/lint-project.yml | 32 ++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/lint-project.yml diff --git a/.github/workflows/lint-project.yml b/.github/workflows/lint-project.yml new file mode 100644 index 0000000..a43fcb2 --- /dev/null +++ b/.github/workflows/lint-project.yml @@ -0,0 +1,32 @@ +name: Run Pre-Commit Hooks + +on: + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + +jobs: + pre-commit: + name: Pre-commit checks + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.13' + - name: Cache pip + uses: actions/cache@v4 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }} + restore-keys: | + ${{ runner.os }}-pip- + ${{ runner.os }}- + - name: Install pre-commit + run: | + python -m pip install --upgrade pip + pip install pre-commit + - name: Run pre-commit + run: pre-commit run --all-files