Modernize asprom: tests, logging, Python 3 refactor, Alembic migrations - #2
Draft
daimoniac wants to merge 12 commits into
Draft
Modernize asprom: tests, logging, Python 3 refactor, Alembic migrations#2daimoniac wants to merge 12 commits into
daimoniac wants to merge 12 commits into
Conversation
Co-authored-by: Stefan Knott <daimoniac@users.noreply.github.com>
Co-authored-by: Stefan Knott <daimoniac@users.noreply.github.com>
Co-authored-by: Stefan Knott <daimoniac@users.noreply.github.com>
Co-authored-by: Stefan Knott <daimoniac@users.noreply.github.com>
Co-authored-by: Stefan Knott <daimoniac@users.noreply.github.com>
Co-authored-by: Stefan Knott <daimoniac@users.noreply.github.com>
Co-authored-by: Stefan Knott <daimoniac@users.noreply.github.com>
Co-authored-by: Stefan Knott <daimoniac@users.noreply.github.com>
Co-authored-by: Stefan Knott <daimoniac@users.noreply.github.com>
Co-authored-by: Stefan Knott <daimoniac@users.noreply.github.com>
- Discover MySQL service via kubectl (internal1/asprom by default) - Port-forward to localhost and run aspromGUI with generated config - Support ASPROM_CFG override in Cfg for non-default config paths Co-authored-by: Stefan Knott <daimoniac@users.noreply.github.com>
- Document venv + apt packages for mysqlclient build (PEP 668) - Bump mysqlclient to 2.2.8 for Python 3.14 support - dev-prod.sh prefers ./venv/bin/python3 when present Co-authored-by: Stefan Knott <daimoniac@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the asprom modernization plan: dev tooling, a full characterization test suite, structured logging, Python 3 cleanup, parameterized SQL, bug fixes, and Alembic migrations.
Key changes
Phase 0 — Tooling
pyproject.toml,pytest.ini,scripts/check.sh(ruff + pytest + mypy + coverage gate)__init__.pypymysql shimPhase 1 — Regression test suite
tests/conftest.pywith MySQL fixtures (ASPROM_TEST_DB_*env vars; testcontainers optional viaASPROM_USE_TESTCONTAINERS=1)inc/db.py—get_db()/set_db()decouples Bottlerequest.dbfrom CLI/testsPhase 2 — Structured logging
inc/logging.pywith structlog (JSON viaASPROM_LOG_FORMAT=json)print()in all entry points andinc/asprom.pyPhase 3 — Python 3 refactor
mypy inc/enforced in CIPhase 4 — Bug fixes
start_http_server(5000)callMachine.delete(): fixed exposure log logic, cascade-deletes child records, removes machine rowgetScannedRanges(): implemented onAspromScheduleModelPhase 5 — Alembic migrations
001, rename unique keys002ASPROM_RUN_MIGRATIONS=1runsalembic upgrade headin Docker start scriptdb/ddl.sqlunchanged for Docker first-bootPhase 6 — Coverage
inc/(gate: 70%)CI fix
tests/test_migrations.pyused hardcodedcwd="/workspace"which fails on GitHub Actions (/home/runner/work/asprom/asprom). Now uses repo root viaPath(__file__).Pre-commit workflow
Test plan
ASPROM_COV_FAIL_UNDER=70 ASPROM_RUN_MYPY=1 ./scripts/check.sh— 41 passed127.0.0.1:3306/asprom_test)