Commit graph

8 commits

Author SHA1 Message Date
0b558635a8
py-topdir.mk: Introduce $(PY_CHECK_ROOTS)

Replace variable PY_SRC_ROOT by PY_CHECK_ROOTS. The name PY_SRC_ROOT was a bad choice, given that it isn't immediately obvious that it a) can contain multiple root locations to be checked, and that it b) specifically concerns static type checking.

As of this commit, it's possible to limit the type checking scope with PY_CHECK_ROOTS as in

PY_CHECK_ROOTS="src/python/jw/pkg/CmdBase.py src/python/jw/lib" \ make check
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-06-09 07:45:15 +02:00
b2f0fe2595
py-topdir.mk: Make pyright optional

Be prepared to not have working pyright. This is necessary, because the next commit will remove it for Debian.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-06-04 23:14:49 +02:00
fdabca79e8
py-topdir.mk: py-format|check-annotation-imports

Add two new targets, basically

py-check-annotation-imports: ruff check --select TC,FA --fix --unsafe-fixes .
py-format-annotation-imports: ruff format --select TC,FA --fix --unsafe-fixes .

They basically import statements merely used for annotation only during type checking runs:

if TYPE_CHECKING: import AirFrobnicator from frobnication
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-06-03 17:46:14 +02:00
f1456f1d46
project.conf, py-topdir.mk: Fix check target for Kali

"make check" fails on Kali Linux, because the machinery lacks pieces:

- Add mypy, yapf3, python3-pyright to project.conf for Debian. The pyright package is not in upstream Kali, but is now supplied by the jw-foss repo.
- ifdef ruff out from "make check" in py-topdir.mk, because it's too much work to get that to work from packages on Kali Linux for now.

project.conf, py-topdir.mk: Make Kali work

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-06-02 17:52:07 +02:00
5a1ef45cc0
topdir.mk: Fix: make topdir does only half a job

make topdir doesn't reliably regenerate pyrightconfig.json because of .SECONDEXPANSION. Adding a second dollar symbol $$(TD_GENERATE_FILES) solves the problem.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-06-01 14:33:52 +02:00
8c5c98c95a
py-topdir.mk: Use pyright

py-topdir.mk: Use ruff and yapf

- Use pyright for the target py-check-syntax

- Generate a $(TOPDIR)/pyrightconfig.json for that

- Add pyrightconfig-base.json because it's used by pyrightconfig.json
- Add python3-pyright to pkg.requires.release, anticipating the use of the py-syntax-check target by CI
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-05-31 18:20:37 +02:00
36d854ce19
py-topdir.mk: Use ruff and yapf
- Use ruff and yapf for the targets py-check-syntax, py-format and py-check-format.
- Add a pyproject.toml for those. It also includes configuration for isort, albeit not being directly used in the linter targets.

- Make .gitignore igore that in newly created projects.

- Add ruff, yapf and isort to pkg.requires.release, anticipating their use by CI.
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-05-31 18:20:36 +02:00
22b09dd9aa
py-topdir.mk: Add file

Add a file to be included from every toplevel Makefile of every repo that owns Python code. It defines the following targets:

py-check: py-check-syntax py-check-format py-check-syntax: py-check-format: py-format:

Currently, only mypy is run from py-check-syntax, but the targets are meant as entry point for further linter jobs in the future.

There's also

py-format-assignments:

which is meant to add spaces around "=" in multi-line assignment blocks, but, pending future experiments, I thing that target is going to be removed again. Left in for now.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-05-31 18:20:35 +02:00