From c1b4918e47b75edb902c328f315932157c258778 Mon Sep 17 00:00:00 2001 From: Victor Guo Date: Sun, 14 Sep 2025 18:15:58 -0500 Subject: [PATCH 1/4] ci --- tests/perf/test_averages_perf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/perf/test_averages_perf.py b/tests/perf/test_averages_perf.py index 2e9120e..2da312d 100644 --- a/tests/perf/test_averages_perf.py +++ b/tests/perf/test_averages_perf.py @@ -17,7 +17,7 @@ def _best_time(fn, data, repeats=5): return min(times), statistics.mean(times) -EXPECTED_MAX_TIME = 0.055 # 55 milliseconds +EXPECTED_MAX_TIME = 0.054 # 54 milliseconds def test_average_age_performance(capfd): From bdb5ec0c1891265765a1714dd956eee693bbd6d7 Mon Sep 17 00:00:00 2001 From: Victor Guo Date: Sun, 14 Sep 2025 18:19:24 -0500 Subject: [PATCH 2/4] test --- tests/perf/test_averages_perf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/perf/test_averages_perf.py b/tests/perf/test_averages_perf.py index 2da312d..ef2f071 100644 --- a/tests/perf/test_averages_perf.py +++ b/tests/perf/test_averages_perf.py @@ -17,7 +17,7 @@ def _best_time(fn, data, repeats=5): return min(times), statistics.mean(times) -EXPECTED_MAX_TIME = 0.054 # 54 milliseconds +EXPECTED_MAX_TIME = 0.053 # 53 milliseconds def test_average_age_performance(capfd): From 1ee04026d13b9c4cfb7b942e31ad9d6e394157d8 Mon Sep 17 00:00:00 2001 From: Victor Guo Date: Sun, 14 Sep 2025 18:24:21 -0500 Subject: [PATCH 3/4] test --- .github/workflows/ci.yml | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 329730f..962e883 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,17 +10,23 @@ concurrency: group: ci-${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true +# Optional: least-privilege default +permissions: + contents: read + jobs: precommit: name: pre-commit (lint/format/tests) runs-on: ubuntu-latest - if: github.event_name != 'push' || github.ref == 'refs/heads/main' + # Run on PRs, and on pushes to main + if: ${{ github.event_name != 'push' || github.ref == 'refs/heads/main' }} steps: - name: Checkout uses: actions/checkout@v4 - name: Set up Python + id: py uses: actions/setup-python@v5 with: python-version: "3.12" @@ -37,33 +43,33 @@ jobs: uses: actions/cache@v4 with: path: .venv - key: venv-${{ runner.os }}-${{ steps.py.outputs.python-version || '3.12' }}-${{ hashFiles('poetry.lock') }} + key: venv-${{ runner.os }}-${{ steps.py.outputs.python-version }}-${{ hashFiles('poetry.lock') }} restore-keys: | venv-${{ runner.os }}- - name: Install dependencies run: poetry install --no-interaction - # This runs all hooks defined in pre-commit (e.g., ruff, pytest, mypy) + # Runs all hooks defined in pre-commit (e.g., ruff, pytest, mypy) - name: Run pre-commit on all files run: | poetry run pre-commit install poetry run pre-commit run --all-files - # === Optional: separate pytest job (keep if you want tests isolated) === + # Optional: keep if you want tests isolated from pre-commit tests: name: pytest (separated) runs-on: ubuntu-latest needs: precommit - if: > - github.event_name != 'push' || github.ref == 'refs/heads/main' - # If you already run pytest in pre-commit, you can disable this whole job + # Run on PRs, and on pushes to main + if: ${{ github.event_name != 'push' || github.ref == 'refs/heads/main' }} steps: - name: Checkout uses: actions/checkout@v4 - name: Set up Python + id: py uses: actions/setup-python@v5 with: python-version: "3.12" @@ -80,7 +86,7 @@ jobs: uses: actions/cache@v4 with: path: .venv - key: venv-${{ runner.os }}-${{ steps.py.outputs.python-version || '3.12' }}-${{ hashFiles('poetry.lock') }} + key: venv-${{ runner.os }}-${{ steps.py.outputs.python-version }}-${{ hashFiles('poetry.lock') }} restore-keys: | venv-${{ runner.os }}- @@ -104,4 +110,3 @@ jobs: with: name: pytest-junit path: pytest-junit.xml - if-no-files-found: ignore From 1f84e7ab7784b727c92a32bb1d4c69966ab8414b Mon Sep 17 00:00:00 2001 From: Victor Guo Date: Sun, 14 Sep 2025 18:43:42 -0500 Subject: [PATCH 4/4] fixed --- .coverage | Bin 53248 -> 53248 bytes .pre-commit-config.yaml | 20 ++++++++++---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.coverage b/.coverage index 54da429df352ca3c37bfa9df1558b839d69d4dc6..39a2087316fba1abbd272d7bedd71cc5b0d63d36 100644 GIT binary patch delta 309 zcmZozz}&Eac|sCX-p-9Fi|pCz82I<|*KHOQDB`cTXJTP!WOlZS2`x@7Dvn7n%`eW3 zaY-%CF3B&5DM>9ZiAgL=ElNyJjVUflj>%0eDauSPhKUvH6;#?Yl4C%8d}dx|Nqjs% v&;%|91_mbndItUj{PjRb74z3Surx9=Qs5>gd!PZFq#6Koliuck@k|8(N(XT( delta 235 zcmZozz}&Eac|sCXS?9)-MfPm-82Hcg&)Y00Fo{1;pNW|vRX-y?H&wqZGr1(cNI$VG zwJ0$?Rlm3>SwAt=e-clq0 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2bdc951..7a60c74 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,31 +1,31 @@ +# .pre-commit-config.yaml repos: - # Ruff - linting and formatting - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.13.0 hooks: - - id: ruff - args: [--fix] # automatically fix issues - - id: ruff-format # format code + - id: ruff # lint + - id: ruff-format # format - # mypy - static type checking - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.18.1 hooks: - id: mypy - # Built-in file checks - repo: https://github.com/pre-commit/pre-commit-hooks rev: v6.0.0 hooks: - - id: trailing-whitespace # remove trailing spaces - - id: end-of-file-fixer # ensure files end with newline + - id: trailing-whitespace + - id: end-of-file-fixer - # pytest with 100% coverage requirement + # Local hook for pytest with 100% coverage requirement - repo: local hooks: - id: pytest-coverage name: pytest with 100% coverage - entry: poetry run pytest --cov=src --cov-fail-under=100 --cov-report=term-missing language: system + entry: poetry run pytest -q --maxfail=1 --disable-warnings --cov-fail-under=100 --cov-report=term-missing pass_filenames: false always_run: true + env: + PYTHONDONTWRITEBYTECODE: "1" # stop __pycache__ / *.pyc + COVERAGE_FILE: ".git/.coverage" # keep coverage DB inside .git