I've never seen this idiom before: try: AVOUCH_VERSION = importlib.metadata.version("avouch") except importlib.metadata.PackageNotFoundError: AVOUCH_VERSION = "0.3.2" What's the intended purpose? It seems to be protecting against a scenario where the package is not installed but the CLI is somehow running... ...But that seems like a very odd thing to be concerned about. Plus, unless I'm missing something, the program…
Could be for unit testing, maybe it's something that makes sense for the developer, or it's AI slop. In all cases it's a minor nitpick in my opinion.
AIs tend to have a debilitating phobia of any kind of exception. Claude especially will throw try/except and weird coersion everywhere in the code.
This bites you because it hides legitimate errors, even when the program is in such an unrecoverable state that it doesn't make logical sense to continue. It becomes impossible to debug, and requires the test suite to be absolutely perfect because you end up throwing away the only way for the language to warn you that something went wrong.
So while yes, it's relatively minor, like many code smells it is indicative that other things may be wrong.