Skip to content

Commit 328c749

Browse files
gbaclaude
andcommitted
Depend on python3-aprslib; stop masking the import failure
aprscot 8.2.0-1 cannot start at all as packaged. On a fresh AryaOS box: AttributeError: module 'aprscot' has no attribute 'KISSWorker' at functions.py:49 in create_tasks The real cause is two problems stacked. MISSING DEPENDENCY. classes.py imports aprslib.parsing, and setup.cfg correctly lists aprslib in install_requires, but the generated deb Depends on only "pytak, python3-aiohttp" -- stdeb did not translate aprslib into python3-aprslib. python3-aprslib IS in Debian (0.7.2-2), so the fix is just to name it in stdeb.cfg. MASKED FAILURE. __init__.py wrapped every import in except ImportError as exc: warnings.warn(f"COMPAT: CI. Ignoring Exception {str(exc)}") a leftover py3.6 CI shim. It swallowed "No module named 'aprslib'", left the module loaded but exporting nothing, and turned a clear import error into an AttributeError thrown much later and much further away. Every path was affected -- KISS, the APRS-IS internet feed, and SensorWorker -- so no configuration of aprscot could have worked. Constants import unconditionally (no third-party deps), and the class and function imports are now allowed to raise. A missing dependency should stop the process at import with the name of what is missing. Verified: with aprslib present all three workers and create_tasks are exported; with aprslib hidden the import now fails loudly with "No module named 'aprslib'" instead of silently degrading. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0197da7dhvcPoHxYKamrYqyM
1 parent e4ef6bd commit 328c749

2 files changed

Lines changed: 22 additions & 26 deletions

File tree

aprscot/__init__.py

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,26 @@
2020

2121
__version__ = "8.2.0"
2222

23-
# COMPAT: CI compat (was py 3.6)
24-
try:
25-
from .constants import ( # NOQA
26-
DEFAULT_APRSIS_PORT,
27-
DEFAULT_COT_TYPE,
28-
DEFAULT_COT_STALE,
29-
DEFAULT_APRSIS_HOST,
30-
DEFAULT_APRSIS_CALLSIGN,
31-
DEFAULT_APRSIS_PASSCODE,
32-
DEFAULT_APRSIS_FILTER,
33-
DEFAULT_KISS_PORT,
34-
DEFAULT_SENSOR_KEEPALIVE_PERIOD,
35-
DEFAULT_SENSOR_LAT,
36-
DEFAULT_SENSOR_LON,
37-
DEFAULT_SENSOR_HAE,
38-
DEFAULT_SENSOR_ID,
39-
DEFAULT_SENSOR_COT_TYPE,
40-
DEFAULT_SENSOR_PAYLOAD_TYPE,
41-
)
23+
# Constants are safe to import with no third-party dependencies, so they are
24+
# imported unconditionally and a genuine problem here is allowed to raise.
25+
from .constants import ( # NOQA
26+
DEFAULT_APRSIS_PORT,
27+
DEFAULT_COT_TYPE,
28+
DEFAULT_COT_STALE,
29+
DEFAULT_APRSIS_HOST,
30+
DEFAULT_APRSIS_CALLSIGN,
31+
DEFAULT_APRSIS_PASSCODE,
32+
DEFAULT_APRSIS_FILTER,
33+
DEFAULT_KISS_PORT,
34+
DEFAULT_SENSOR_KEEPALIVE_PERIOD,
35+
DEFAULT_SENSOR_LAT,
36+
DEFAULT_SENSOR_LON,
37+
DEFAULT_SENSOR_HAE,
38+
DEFAULT_SENSOR_ID,
39+
DEFAULT_SENSOR_COT_TYPE,
40+
DEFAULT_SENSOR_PAYLOAD_TYPE,
41+
)
4242

43-
from .functions import aprs_to_cot, create_tasks, gen_sensor_cot # NOQA
43+
from .functions import aprs_to_cot, create_tasks, gen_sensor_cot # NOQA
4444

45-
from .classes import APRSWorker, KISSWorker, SensorWorker # NOQA
46-
except ImportError as exc:
47-
import warnings
48-
49-
warnings.warn(f"COMPAT: CI. Ignoring Exception {str(exc)}")
45+
from .classes import APRSWorker, KISSWorker, SensorWorker # NOQA

stdeb.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[DEFAULT]
22
Package3: aprscot
33
Replaces3: python3-aprscot
4-
Depends3: pytak, python3-aiohttp
4+
Depends3: pytak, python3-aiohttp, python3-aprslib

0 commit comments

Comments
 (0)