From 8b50263aac2975b4c5e6dc8528b2b1f3a35b9d05 Mon Sep 17 00:00:00 2001 From: Padreug Date: Sun, 19 Jul 2026 17:48:11 +0200 Subject: [PATCH] chore: add test + lint tooling (pyproject, Makefile) Poetry/pytest/ruff/black/mypy config mirroring the aio extension lint pipeline (spirekeeper template). `make test` runs pytest; `make check` runs the linters. Enables a tests/ suite for the extension. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_019VUQCfdqiLSsFS2jcGnaFD --- Makefile | 25 +++++++++++++++++++++ pyproject.toml | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 Makefile create mode 100644 pyproject.toml diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f4c6b71 --- /dev/null +++ b/Makefile @@ -0,0 +1,25 @@ +all: format check + +format: black ruff + +check: mypy checkblack checkruff + +mypy: + poetry run mypy . + +black: + poetry run black . + +ruff: + poetry run ruff check . --fix + +checkruff: + poetry run ruff check . + +checkblack: + poetry run black --check . + +test: + PYTHONUNBUFFERED=1 \ + DEBUG=true \ + poetry run pytest diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..9f00a22 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,60 @@ +[tool.poetry] +name = "chatelet" +version = "0.1.0" +description = "Nostr-native room rentals (Airbnb-style) for LNbits" +authors = ["padreug "] + +[tool.poetry.dependencies] +python = "^3.10 | ^3.9" +lnbits = {version = "*", allow-prereleases = true} +mypy = "^1.13.0" + +[tool.poetry.group.dev.dependencies] +black = "^24.3.0" +pytest-asyncio = "^0.21.0" +pytest = "^7.3.2" +mypy = "^1.5.1" +pre-commit = "^3.2.2" +ruff = "^0.3.2" +pytest-md = "^0.2.0" + +[build-system] +requires = ["poetry-core>=1.0.0"] +build-backend = "poetry.core.masonry.api" + +[tool.mypy] +[[tool.mypy.overrides]] +module = [ + "lnbits.*", + "loguru.*", + "fastapi.*", + "pydantic.*", +] +ignore_missing_imports = "True" + +[tool.pytest.ini_options] +log_cli = false +testpaths = [ + "tests" +] + +[tool.black] +line-length = 88 + +[tool.ruff] +line-length = 88 + +[tool.ruff.lint] +# F pyflakes / E,W pycodestyle / I isort / A builtins / C mccabe / N naming +# UP pyupgrade / RUF ruff / B bugbear +select = ["F", "E", "W", "I", "A", "C", "N", "UP", "RUF", "B"] +ignore = ["UP007"] # keep Optional[X] on py3.10 +fixable = ["ALL"] +unfixable = [] +dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" + +[tool.ruff.lint.flake8-bugbear] +extend-immutable-calls = [ + "fastapi.Depends", + "fastapi.Query", +]