Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor mkchromecast to make __init__.py minimal and avoid import __init__ #425

Open
xsdg opened this issue Nov 29, 2023 · 0 comments
Open
Assignees
Labels
codehealth Tasks focused on improving the maintainability of the codebase

Comments

@xsdg
Copy link
Collaborator

xsdg commented Nov 29, 2023

As implemented, there's a lot of work being done in __init__.py that should be done elsewhere.

  • Argument parsing should be done directly in bin/mkchromecast
  • The mkchromecast library should be designed as a library, with one or more classes that encapsulate the functionality, can be instantiated with appropriate arguments, and can be unit-tested independently
  • Many of the python files in mkchromecast use import mkchromecast.__init__. This is a code smell. Especially given that mkchromecast is a binary + library pair, __init__.py shouldn't do any work, and should only present the external API of the library. The modules in the library should import things directly, and shouldn't pass back through __init__.py.
  • __init__.py is used in this way because mkchromecast uses a lot of global variables and very little encapsulation. This is also a code smell, and makes the code difficult to unit test effectively.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
codehealth Tasks focused on improving the maintainability of the codebase
Projects
None yet
Development

No branches or pull requests

1 participant