Flatten to a single package directory

The checkout is now astrape/astrape-ems, not astrape/astrape-ems/<package>. The package
contents move to the repository root and pyproject maps the package name to
'.' via package-dir, with the subpackages listed explicitly.

The systemd units move out to /srv/astrape/deploy/systemd, outside every
repository, because they describe this deployment rather than any one
component.

Verified both install modes: editable, which is how the deployment runs, and
a plain wheel install, which is what the container build does.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
rpotter6298
2026-08-30 15:05:15 +02:00
parent 91ab976bee
commit d5f3c0f7ac
15 changed files with 6 additions and 27 deletions
-25
View File
@@ -1,25 +0,0 @@
[Unit]
Description=Astrape Sigenergy Plant Ingest
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=gibil
Group=gibil
WorkingDirectory=/srv/astrape
Environment=PYTHONUNBUFFERED=1
Environment=PYTHONDONTWRITEBYTECODE=1
# WorkingDirectory is /srv/astrape, which also holds the gibil checkout. Without
# this, Python prepends the working directory to sys.path and the repo root
# /srv/astrape/gibil shadows the installed package as a namespace portion --
# gibil.__file__ becomes None and imports work only by accident. All code is
# installed into the venv, so nothing needs the working directory on sys.path.
Environment=PYTHONSAFEPATH=1
ExecStart=/srv/astrape/.venv/bin/python -m astrape_ems.scripts.daemons.plant_daemon
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
+6 -2
View File
@@ -9,5 +9,9 @@ description = "Energy backend connection: Sigenergy Modbus client and plant stor
requires-python = ">=3.12"
dependencies = ["gibil", "psycopg[binary]>=3.2,<4", "pymodbus>=3.8,<4"]
[tool.setuptools.packages.find]
include = ["astrape_ems*"]
# Flat layout: this repository *is* the package. package-dir maps astrape_ems to the
# repository root rather than to a nested astrape_ems/ directory, so the checkout is
# astrape/astrape-ems and not astrape/astrape-ems/astrape_ems.
[tool.setuptools]
packages = ["astrape_ems", "astrape_ems.classes", "astrape_ems.scripts", "astrape_ems.scripts.daemons", "astrape_ems.scripts.debug"]
package-dir = {"astrape_ems" = "."}