refactor!: port shell scripts to Python package

Bash scripts were untestable and duplicated device/LUKS/mount logic;
the lim/ package centralizes it behind one subprocess wrapper and a
YAML image catalog (single point of truth).

BREAKING CHANGE: scripts/*.sh removed. Use `lim --type <cmd>`; new
types mount/umount/single-boot/raid1-boot/lock/unlock/import/export
replace direct script calls. --extra is deprecated and ignored.

- distributions.yml + lim/catalog.py hold the image catalog (PyYAML)
- pytest suite: 102 tests with mocked subprocess (tests/unit) and a
  250-line max file-length guard (tests/lint)
- ruff strict (select ALL), GitHub Actions CI, Dependabot; Travis gone
- Makefile: install (symlink ~/.local/bin/lim) and test targets
- fixes over bash: SUDO_USER-aware chown, mmcblk/nvme partition paths,
  sha512 checksum support, whole-pipeline failure detection, blkid
  UUID fallback for pre-mounted images, conditional fstab seeding for
  PARTUUID/LABEL images, clean errors for missing binaries
This commit is contained in:
Kevin Veen-Birkenbach
2026-07-14 11:27:49 +02:00
parent c420dd164d
commit ccdef065df
77 changed files with 3402 additions and 1614 deletions

41
pyproject.toml Normal file
View File

@@ -0,0 +1,41 @@
[project]
name = "lim"
version = "1.0.0"
description = "Linux Image Manager — manages Linux images and encrypted storage"
requires-python = ">=3.10"
license = { file = "LICENSE.txt" }
dependencies = ["PyYAML>=6"]
[tool.pytest.ini_options]
testpaths = ["tests"]
[tool.ruff]
target-version = "py310"
line-length = 100
[tool.ruff.lint]
select = ["ALL"]
ignore = [
# This tool's UI is print/prompt based and its purpose is orchestrating
# system commands — these rules contradict the design:
"T201", # print used as console UI
"S603", # subprocess without shell is exactly what runner.py wraps
"S607", # system tools are resolved via PATH on purpose
# Style choices:
"D203", # conflicts with D211 (blank line before class docstring)
"D213", # conflicts with D212 (multi-line docstring summary position)
"D1", # docstrings are not required on every symbol
"COM812", # trailing commas are handled by the formatter
"TRY003", # exception messages are written inline
"EM101", # literal exception messages are fine
"EM102", # f-string exception messages are fine
]
[tool.ruff.lint.per-file-ignores]
"tests/*" = [
"S101", # pytest asserts
"ANN", # test signatures need no annotations
"PLR2004", # literal expectations in assertions
"ARG", # fixtures are injected even when unused
"SLF001", # tests may exercise internal helpers directly
]