bandsaunter/bandsaunter/__init__.py
The Dust Council c3b382a5f6 Ask for what is needed, and nothing that is not
An audit of the dependencies rather than a feature, prompted by being asked to
make sure they were all listed.  Four things were wrong, and one of them was
wrong in the direction nobody checks.

A dependency that was not one.  The packaging asked for matplotlib, in a
"plots" extra, and nothing in the program has ever imported it: the graphs a
weather log turns into are drawn by this package's own PNG writer, the same one
the waterfalls and the maps use.  Anybody installing with that extra got a
large package to no effect.  Declarations are checked against imports in one
direction as a matter of course -- an undeclared import fails on the first
machine that is not the one it was written on -- and never in the other, where
the failure is silent and costs somebody else's disk.

Two speech engines that could not be installed.  The transcriber takes five
engines and the metadata offered extras for two of them, so openai-whisper and
pocketsphinx were supported and unobtainable.  They are alternatives rather
than a set -- one is tiny and poor, one is the reference and slow -- so each has
an extra of its own now.

Nothing that can play a recording.  The package suggested no audio player at
all, so on a fresh install saunterbrowse's Enter key did nothing and there was
no way to find out why.  Recommended now, as any one of the three things that
provide pw-play, paplay or aplay.

Nothing that can open a map.  The register's g key hands a coordinate to a
browser, which needs something to start one; xdg-utils is suggested and the
absence documented, since printing the coordinates instead is the useful answer
on a headless receiver anyway.

And the readme's list of audio players was simply wrong -- it named sox, left
out mpv, and had the order it does not try them in.  It is generated from the
table the code actually uses now.

Checked complete rather than assumed: the manual covers all seventeen
subcommands, and the package ships every module, both manuals, the copyright,
the readme and the install instructions.

Nine tests so none of it drifts again, each confirmed by putting the defect
back.  The pair that matters checks the dependencies both ways: everything
imported has to be asked for, and everything asked for has to be imported.  The
second of those is the one that had never existed, and is the one that would
have caught matplotlib years ago.

Full suite 2901 passed.  Built as 2026-09-25_01.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016PsWPTweCT6pwxKngvVxcg
2026-09-25 08:29:20 -07:00

57 lines
2.2 KiB
Python
Executable file

"""bandsaunter -- a signal scanner for RTL-SDR receivers.
Sweeps arbitrary frequency ranges (or US band-plan presets), records what it
finds, and identifies the modulation -- including decoding CW/Morse to text
and transcribing speech.
"""
# Versions are the release date and a revision within that day, so
# 2026-08-21_02 is the second build made on the 21st. The revision is padded
# to two digits so versions sort as text.
VERSION_DATE = "2026-09-25"
VERSION_REVISION = 1
__version__ = f"{VERSION_DATE}_{VERSION_REVISION:02d}"
__all__ = ["__version__", "VERSION_DATE", "VERSION_REVISION",
"pep440_version", "debian_version", "version_notice"]
COPYRIGHT = "Copyright (C) 2026 The Dust Council"
def version_notice(program: str = "bandsaunter") -> str:
"""What ``--version`` prints: the version and the terms it comes under.
The GNU form, and for the GNU reason: the licence tells whoever is running
the program what they are allowed to do with it, and the program is the
only thing in front of them.
"""
return (f"{program} {__version__}\n"
f"{COPYRIGHT}\n"
"License GPLv3+: GNU GPL version 3 or later "
"<https://gnu.org/licenses/gpl.html>\n"
"This is free software: you are free to change and redistribute it.\n"
"There is NO WARRANTY, to the extent permitted by law.")
def pep440_version() -> str:
"""The version as Python packaging tools require it.
PEP 440 allows only digits and dots in the release segment, so the
displayed form cannot be used directly: pip rejects both the dashes and
the underscore. ``2026-08-21_01`` becomes ``2026.8.21.1``, which sorts
the same way and round-trips back to the same date and revision.
"""
year, month, day = VERSION_DATE.split("-")
return f"{int(year)}.{int(month)}.{int(day)}.{VERSION_REVISION}"
def debian_version() -> str:
"""The version as dpkg requires it.
Debian permits alphanumerics and ``. + - : ~`` in an upstream version but
not underscores, so the displayed form cannot be used there either. Dots
keep the zero padding, which makes dpkg's comparison agree with a plain
text sort.
"""
return f"{VERSION_DATE.replace('-', '.')}.{VERSION_REVISION:02d}"