From 60ab9668f4a72066fb42fa240240116c9dde1606 Mon Sep 17 00:00:00 2001 From: Rodrigo Patote <47055922+patote85@users.noreply.github.com> Date: Mon, 21 Sep 2026 12:31:43 -0300 Subject: [PATCH 1/8] ci: add pyproject.toml (ruff + mypy minimal) --- pyproject.toml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..b2d41ac --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,30 @@ +[project] +name = "aws-lambda-api-gateway-python" +version = "0.0.0" +requires-python = ">=3.12" + +[tool.ruff] +target-version = "py312" +line-length = 100 +src = ["lambda", "tests", "cdk"] + +[tool.ruff.lint] +# Minimal hard constraints (Lauren): catch real footguns without rewriting the app. +select = ["E", "F", "I", "W"] +ignore = ["E501"] + +[tool.ruff.lint.per-file-ignores] +"tests/**" = ["E402"] + +[tool.mypy] +python_version = "3.12" +ignore_missing_imports = true +warn_return_any = false +warn_unused_configs = true +check_untyped_defs = false +# Package dir named `lambda` is a reserved word; typecheck tests + cdk first. +files = ["tests", "cdk"] + +[[tool.mypy.overrides]] +module = "lambda.*" +ignore_errors = true From a9966ad8ca15a20f123af2202b86a494dc768526 Mon Sep 17 00:00:00 2001 From: Rodrigo Patote <47055922+patote85@users.noreply.github.com> Date: Mon, 21 Sep 2026 12:31:54 -0300 Subject: [PATCH 2/8] ci: add requirements-dev.txt for ruff and mypy --- requirements-dev.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 requirements-dev.txt diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 0000000..15bfc55 --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,3 @@ +# Dev / CI lint+types (not required at Lambda runtime) +ruff>=0.8.0 +mypy>=1.13.0 From be128bbe66937bf9bace8fb5a209b070a14b403b Mon Sep 17 00:00:00 2001 From: Rodrigo Patote <47055922+patote85@users.noreply.github.com> Date: Mon, 21 Sep 2026 12:31:55 -0300 Subject: [PATCH 3/8] =?UTF-8?q?ci:=20Makefile=20=E2=80=94=20lint=20+=20typ?= =?UTF-8?q?echeck=20in=20make=20check?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index dc3649a..94b1f04 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,19 @@ -# Agent-friendly check: shortest path = correct path (pytest + cdk synth). -# No deploy. Requires: pip install -r requirements.txt and -r cdk/requirements.txt; Node for npx. +# Agent-friendly check: shortest path = correct path. +# No deploy. Requires: pip install -r requirements.txt -r requirements-dev.txt +# and -r cdk/requirements.txt; Node for npx. -.PHONY: check test synth +.PHONY: check test synth lint typecheck test: PYTHONPATH=. pytest tests/test_exclusao.py -v +lint: + ruff check lambda tests cdk + +typecheck: + mypy + synth: npx --yes aws-cdk@2 synth -check: test synth +check: lint typecheck test synth From 7dc7a03dcc395e1785bc6122e8a6933ed6199f0d Mon Sep 17 00:00:00 2001 From: Rodrigo Patote <47055922+patote85@users.noreply.github.com> Date: Mon, 21 Sep 2026 12:32:00 -0300 Subject: [PATCH 4/8] ci: add lint job (ruff + mypy) --- .github/workflows/ci.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ce80cbb..1e13359 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,30 @@ concurrency: cancel-in-progress: true jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + cache: pip + cache-dependency-path: | + requirements.txt + requirements-dev.txt + + - name: Install lint deps + run: | + pip install -r requirements.txt + pip install -r requirements-dev.txt + + - name: Ruff + run: ruff check lambda tests cdk + + - name: Mypy + run: mypy + test: runs-on: ubuntu-latest steps: From f692af505e81cacda060d8c7e2b2962082107483 Mon Sep 17 00:00:00 2001 From: Rodrigo Patote <47055922+patote85@users.noreply.github.com> Date: Mon, 21 Sep 2026 12:32:29 -0300 Subject: [PATCH 5/8] =?UTF-8?q?docs:=20README=20=E2=80=94=20lint/types=20n?= =?UTF-8?q?o=20make=20check=20(incremental)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c6ac21b..c63db36 100644 --- a/README.md +++ b/README.md @@ -40,15 +40,16 @@ Cada solicitação grava **dois** itens (histórico depois ponteiro): ```bash pip install -r requirements.txt +pip install -r requirements-dev.txt # ruff + mypy pip install -r cdk/requirements.txt # só se for rodar synth PYTHONPATH=. pytest tests/test_exclusao.py -v -# ou o caminho curto (pytest + cdk synth, sem deploy): +# caminho curto (lint + types + pytest + cdk synth, sem deploy): make check ``` Usa **moto** (sem AWS real). O pacote `lambda/` importa via `importlib` (nome reservado). -CI (GitHub Actions): em todo PR/`push` na `main` — job **`test`** (pytest/moto, Python 3.12) e job **`synth`** (`npx aws-cdk@2 synth`, sem credenciais AWS / sem deploy). +CI (GitHub Actions): em todo PR/`push` na `main` — jobs **`lint`** (ruff + mypy), **`test`** (pytest/moto) e **`synth`** (`npx aws-cdk@2 synth`, sem AWS / sem deploy). --- From ad2b9d76fc1d0705492d5697b9e6ed19ed852599 Mon Sep 17 00:00:00 2001 From: Rodrigo Patote <47055922+patote85@users.noreply.github.com> Date: Mon, 21 Sep 2026 12:37:30 -0300 Subject: [PATCH 6/8] ci: ruff E/F/W only; mypy tests only (green path) --- pyproject.toml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b2d41ac..716f504 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,8 +9,9 @@ line-length = 100 src = ["lambda", "tests", "cdk"] [tool.ruff.lint] -# Minimal hard constraints (Lauren): catch real footguns without rewriting the app. -select = ["E", "F", "I", "W"] +# Hard constraints (Lauren/pstack): errors + unused. Import-sort (I) deferred — +# CDK multi-alias imports fight isort without value; enable in a later PR. +select = ["E", "F", "W"] ignore = ["E501"] [tool.ruff.lint.per-file-ignores] @@ -22,8 +23,8 @@ ignore_missing_imports = true warn_return_any = false warn_unused_configs = true check_untyped_defs = false -# Package dir named `lambda` is a reserved word; typecheck tests + cdk first. -files = ["tests", "cdk"] +# `lambda/` is a reserved package name; CDK stubs are heavy — typecheck tests only for now. +files = ["tests"] [[tool.mypy.overrides]] module = "lambda.*" From 2a7d9d211c0e18d517429abd7d0b1d41ebbee6b8 Mon Sep 17 00:00:00 2001 From: Rodrigo Patote <47055922+patote85@users.noreply.github.com> Date: Mon, 21 Sep 2026 12:37:53 -0300 Subject: [PATCH 7/8] ci: make typecheck runs mypy tests only --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 94b1f04..398c758 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ lint: ruff check lambda tests cdk typecheck: - mypy + mypy tests synth: npx --yes aws-cdk@2 synth From cc56df859011a793e530066b053dea5fa0fc0002 Mon Sep 17 00:00:00 2001 From: Rodrigo Patote <47055922+patote85@users.noreply.github.com> Date: Mon, 21 Sep 2026 12:37:54 -0300 Subject: [PATCH 8/8] ci: mypy tests only in lint job --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1e13359..20fc0f9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,7 @@ jobs: run: ruff check lambda tests cdk - name: Mypy - run: mypy + run: mypy tests test: runs-on: ubuntu-latest