Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 tests

test:
runs-on: ubuntu-latest
steps:
Expand Down
15 changes: 11 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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 tests

synth:
npx --yes aws-cdk@2 synth

check: test synth
check: lint typecheck test synth
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

---

Expand Down
31 changes: 31 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[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]
# 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]
"tests/**" = ["E402"]

[tool.mypy]
python_version = "3.12"
ignore_missing_imports = true
warn_return_any = false
warn_unused_configs = true
check_untyped_defs = false
# `lambda/` is a reserved package name; CDK stubs are heavy — typecheck tests only for now.
files = ["tests"]

[[tool.mypy.overrides]]
module = "lambda.*"
ignore_errors = true
3 changes: 3 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Dev / CI lint+types (not required at Lambda runtime)
ruff>=0.8.0
mypy>=1.13.0
Loading