Skip to content

Commit

Permalink
Merge pull request #97 from robberwick/reconfigure-package-exports
Browse files Browse the repository at this point in the history
refactor: Reconfigure package imports
  • Loading branch information
robberwick authored Nov 10, 2024
2 parents db67797 + 3220403 commit 3c6b842
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ dev = ["black", "isort"]
test = ["coverage", "pytest", "pytest-cov", "pytest-mock"]

[project.scripts]
blinkstick = "blinkstick:main"
blinkstick = "blinkstick.main:main"

[project.urls]
homepage = "https://pypi.python.org/pypi/blinkstick/"
Expand Down
Empty file removed src/__init__.py
Empty file.
7 changes: 6 additions & 1 deletion src/blinkstick/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
from .main import main
from importlib.metadata import version, PackageNotFoundError

from .blinkstick import BlinkStick, BlinkStickPro, BlinkStickProMatrix
from .blinkstick import find_all, find_by_serial, find_first, get_blinkstick_package_version
from .colors import Color, ColorFormat
from .constants import BlinkStickVariant
from .exceptions import BlinkStickException

try:
__version__ = version("blinkstick")
except PackageNotFoundError:
Expand Down
11 changes: 6 additions & 5 deletions src/blinkstick/main.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#!/usr/bin/env python3

from optparse import OptionParser, IndentedHelpFormatter, OptionGroup
from blinkstick import blinkstick
from blinkstick.constants import BlinkStickVariant
import textwrap
import sys
import logging

from .blinkstick import get_blinkstick_package_version, find_all, find_by_serial
from .constants import BlinkStickVariant
logging.basicConfig()


Expand Down Expand Up @@ -71,7 +72,7 @@ def format_option(self, option):

def format_usage(self, usage):
return "BlinkStick control script %s\n(c) Agile Innovative Ltd 2013-2014\n\n%s" % (
blinkstick.get_blinkstick_package_version(), IndentedHelpFormatter.format_usage(self, usage))
get_blinkstick_package_version(), IndentedHelpFormatter.format_usage(self, usage))


def print_info(stick):
Expand Down Expand Up @@ -217,9 +218,9 @@ def main():
(options, args) = parser.parse_args()

if options.serial is None:
sticks = blinkstick.find_all()
sticks = find_all()
else:
sticks = [blinkstick.find_by_serial(options.serial)]
sticks = [find_by_serial(options.serial)]

if len(sticks) == 0:
print("BlinkStick with serial number " + options.backend + " not found...")
Expand Down

0 comments on commit 3c6b842

Please sign in to comment.