Skip to content

Commit 6837115

Browse files
committed
Too many __version__ implementations, picked one.
Fixes issue #158 which was a result of trying to stuff a module type into a string, specifically `busylight.__version__`. That version was a duplicate of the code in `busylight.__init__` and a residual from how versioning was handled in the project Makefile. I think. I've slept since then. Keeping the __version__ in __init__ and removing __version__. Fixed the imports in __main__, busylight_api and test_cli to reflect the new reality.
1 parent c17181f commit 6837115

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

busylight/__main__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from .color import ColorLookupError, ColorTuple, parse_color_string
1515
from .effects import Effects
1616
from .manager import LightManager
17-
from .__version__ import __version__
17+
from . import __version__
1818

1919

2020
cli = typer.Typer()
@@ -368,7 +368,7 @@ def serve_http_api(
368368
help="Host name to bind the server to.",
369369
),
370370
port: int = typer.Option(
371-
21169,
371+
8000,
372372
"--port",
373373
"-p",
374374
help="Network port number to listen on.",

busylight/api/busylight_api.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,10 @@ async def startup():
141141

142142
@busylightapi.on_event("shutdown")
143143
async def shutdown():
144-
await busylightapi.off()
144+
try:
145+
await busylightapi.off()
146+
except Exception as error:
147+
logger.debug("problem during shutdown: {error}")
145148

146149

147150
## Exception Handlers

tests/functional/test_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from typer.testing import CliRunner
77

88
from busylight.__main__ import cli
9-
from busylight.__version__ import __version__
9+
from busylight import __version__
1010
from busylight.lights import USBLight
1111

1212
runner = CliRunner()

0 commit comments

Comments
 (0)