oliver-zehentleitner / maity

clean-up: G6 tools and scripts: build files: lock-check and release-build copied across Makefiles, PY vs PYTHON, cli/setup.py outside lint, hatch_build type: ignore

Sign in to report

tsk-tvk5atq3306p Open

From the clean-up audit tsk-hgnbapyw7hnh (uncovered files, G6: CLI leftovers, public-page leftovers, tools and scripts), read at 9dfd4b65.

1. lock-check is written three times and release-build twice (duplication)

  • Files: lock-check in hub/Makefile:66-74, cli/Makefile:44-60 and tools/Makefile:14-20 (each: copy the inputs to a temp dir, strip --hash= lines with the same sed, recompile with $(LOCK), diff -u). release-build in hub/Makefile:89-94 and cli/Makefile:67-72 (same five lines; hub makes the venv with $(PYTHON), cli with a hard-coded python3).
  • What is wrong: a fix to one copy (for example the hash stripping, or the venv's Python) has to be made three times, and the copies have already drifted.
  • Proposal: one mk/locks.mk at the repository root with a lock_check macro (inputs, outputs, constraints) and a release_build recipe, included by the three Makefiles. The cli-only setuptools pin check (the python3 -c step at the end of cli/Makefile's lock-check) stays in cli/Makefile.
  • Effort: M. Risk: low to medium; CI's hub-lock, cli and changelog jobs run these targets, so the PR proves itself.

2. The Python variable is PYTHON in hub/ and PY in cli/ (naming)

  • Files: hub/Makefile:4 PYTHON ?= python3; cli/Makefile:1 PY ?= ...; tools/pre_push.py:37 PYTHON_VARIABLE = {"hub": "PYTHON", "cli": "PY"} exists only to bridge the two names; cli/Makefile:25 and :69 call python3 directly instead of the variable.
  • Proposal: PYTHON in both (cli keeps its .venv default), use it at cli/Makefile:25 and :69, drop PYTHON_VARIABLE. Update CONTRIBUTING.md/README lines that name PY= if any.
  • Effort: S. Risk: low (a local make PY=... habit changes).

3. cli/setup.py is not linted or type-checked (debt)

  • Files: cli/Makefile:7-17 (ruff/black/mypy over src tests only); cli/setup.py (30 lines, imports maity.versioninfo after a sys.path.insert). The hub checks its build hook: hub/Makefile:17-24 and hub/pyproject.toml:71 name hatch_build.py.
  • Proposal: add setup.py to the cli lint, format and typecheck targets.
  • Effort: S. Risk: none.

4. hub/hatch_build.py silences mypy instead of giving the type parameter (debt, type: ignore)

  • Files: hub/hatch_build.py:34 class BundleHook(BuildHookInterface): # type: ignore[type-arg]. hatchling's BuildHookInterface is Generic[BuilderConfigBound] (hatchling/builders/hooks/plugin/interface.py:12 in the locked version).
  • Proposal: BuildHookInterface[BuilderConfig] (from hatchling.builders.config) and drop the ignore.
  • Effort: S. Risk: none.

Covered elsewhere

None. Searched: hatch_build, release-build, lock-check, PYTHON_VARIABLE.

Effort: M + 3S.

Notes

  1. Lotse · Nov 18, 2026, 20:06 UTC

    Item 1 (the lock-check copied across the Makefiles) moves to tsk-kgkh3gz3mkfz, which already holds it. Leave it out here (lotse, req-gqt5b2812nej).