From 557fe159d546b33331a344e5029f07837a6b7301 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Tue, 14 Jul 2026 12:05:08 +0200 Subject: [PATCH] Optimized Python package building --- .gitignore | 3 ++ README.md | 6 ++-- lim/catalog.py | 4 +-- lim/config.py | 13 ++++++-- .../configuration}/packages/general.txt | 0 .../configuration}/packages/server/luks.txt | 0 distributions.yml => lim/distributions.yml | 0 pyproject.toml | 30 +++++++++++++++++-- 8 files changed, 45 insertions(+), 11 deletions(-) rename {configuration => lim/configuration}/packages/general.txt (100%) rename {configuration => lim/configuration}/packages/server/luks.txt (100%) rename distributions.yml => lim/distributions.yml (100%) diff --git a/.gitignore b/.gitignore index fc6b817..d4f400b 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,6 @@ log.txt __pycache__/ *.pyc .pytest_cache/ +dist/ +build/ +*.egg-info/ diff --git a/README.md b/README.md index 63d1cae..fdc8589 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,6 @@ lim --type chroot ``` main.py # entry point (the `lim` alias) -distributions.yml # single point of truth for the image catalog lim/ cli.py # argument parsing and command dispatch catalog.py # read-only access to distributions.yml @@ -92,14 +91,15 @@ lim/ storage/ # single drive and RAID1 encryption setups image/ # image setup, backup, chroot, verification data/ # encfs lock/unlock and data import/export -configuration/ # package collections used during image setup + distributions.yml # single point of truth for the image catalog + configuration/ # package collections used during image setup tests/unit/ # unit tests (all external commands mocked) tests/lint/ # architecture guards (e.g. max file length) ``` ## Configuration & Customization 🔧 -Customize your environment in the `configuration/` folder: +Customize your environment in the `lim/configuration/` folder: - **General Packages:** Contains common packages for all setup scripts. - **Server LUKS Packages:** Contains packages needed for setting up LUKS encryption on servers. diff --git a/lim/catalog.py b/lim/catalog.py index ab2a222..cb14226 100644 --- a/lim/catalog.py +++ b/lim/catalog.py @@ -1,4 +1,4 @@ -"""Read-only access to the image catalog (distributions.yml in the repo root).""" +"""Read-only access to the image catalog (distributions.yml in the package).""" from functools import cache @@ -6,7 +6,7 @@ import yaml from lim import config -CATALOG_PATH = config.REPOSITORY_PATH / "distributions.yml" +CATALOG_PATH = config.CATALOG_PATH @cache diff --git a/lim/config.py b/lim/config.py index 7bc5152..14159da 100644 --- a/lim/config.py +++ b/lim/config.py @@ -1,10 +1,17 @@ -"""Repository paths shared by all modules.""" +"""Package and repository paths shared by all modules. + +Configuration and the image catalog ship inside the package so that +wheel installs work; the encfs data store stays repository-relative. +""" from pathlib import Path -REPOSITORY_PATH = Path(__file__).resolve().parent.parent -CONFIGURATION_PATH = REPOSITORY_PATH / "configuration" +PACKAGE_ROOT = Path(__file__).resolve().parent +CONFIGURATION_PATH = PACKAGE_ROOT / "configuration" PACKAGE_PATH = CONFIGURATION_PATH / "packages" +CATALOG_PATH = PACKAGE_ROOT / "distributions.yml" + +REPOSITORY_PATH = PACKAGE_ROOT.parent ENCRYPTED_PATH = REPOSITORY_PATH / ".encrypted" DECRYPTED_PATH = REPOSITORY_PATH / "decrypted" DATA_PATH = DECRYPTED_PATH / "data" diff --git a/configuration/packages/general.txt b/lim/configuration/packages/general.txt similarity index 100% rename from configuration/packages/general.txt rename to lim/configuration/packages/general.txt diff --git a/configuration/packages/server/luks.txt b/lim/configuration/packages/server/luks.txt similarity index 100% rename from configuration/packages/server/luks.txt rename to lim/configuration/packages/server/luks.txt diff --git a/distributions.yml b/lim/distributions.yml similarity index 100% rename from distributions.yml rename to lim/distributions.yml diff --git a/pyproject.toml b/pyproject.toml index e16a331..55eca5d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,11 +1,35 @@ +[build-system] +# 77+ for PEP 639 SPDX `license = "..."` + `license-files`. +requires = ["setuptools>=77"] +build-backend = "setuptools.build_meta" + [project] name = "linux-image-manager" -version = "2.0.0" -description = "Linux Image Manager — manages Linux images and encrypted storage" +version = "1.0.0" +description = "CLI (`lim`) for downloading, verifying and flashing Linux images, LUKS/Btrfs encrypted storage (single drive and RAID1), image backups and chroot maintenance" +readme = "README.md" requires-python = ">=3.10" -license = { file = "LICENSE.txt" } +authors = [{ name = "Kevin Veen-Birkenbach", email = "kevin@veen.world" }] +maintainers = [{ name = "Kevin Veen-Birkenbach", email = "kevin@veen.world" }] +license = "GPL-3.0-only" +license-files = ["LICENSE.txt"] +urls = { Homepage = "https://veen.world", Repository = "https://github.com/kevinveenbirkenbach/linux-image-manager" } +classifiers = [ + "Environment :: Console", + "Operating System :: POSIX :: Linux", + "Programming Language :: Python :: 3", +] dependencies = ["PyYAML>=6"] +[project.scripts] +lim = "lim.cli:main" + +[tool.setuptools.packages.find] +include = ["lim*"] + +[tool.setuptools.package-data] +lim = ["distributions.yml", "configuration/packages/**/*.txt"] + [tool.pytest.ini_options] testpaths = ["tests"]