Skip to content

Enable pip and uv to install CLI tools alongside the library - #846

Open
cyberkni wants to merge 3 commits into
mjg59:devfrom
cyberkni:master
Open

cyberkni wants to merge 3 commits into
mjg59:devfrom
cyberkni:master

Conversation

@cyberkni

@cyberkni cyberkni commented Oct 4, 2026

Copy link
Copy Markdown

Context

I really like using uv(and uvx) for accessing python tools without making a full installation. I noticed this repo contains a library and cli combined but the installation process for the CLI is a separate step after installing the library. This seemed a bit inconvenient since both pip and uv can install CLI tools.

Proposed change

Implement packaging for CLI tools by:

  • Relocate CLI tools from cli/* to broadlink/cli* - this is required to put the CLI tools as a submodule within the broadlink package namespace as broadlink.cli
  • Add broadlink/cli/init.py - needed for the directory to be a module
  • Update existing cli/* scripts to just import the matching CLI module and run its main() - this provides backwards compatibility with the original install scheme
  • Update setup.py to deploy CLI tools during install - this enables uv to do the right thing with tools in this library.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New device
  • New product id (the device is already supported with a different id)
  • New feature (which adds functionality to an existing device)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests
  • Documentation

Additional information

I verified this changed by:
Starting with my workstation not having the library installed yet.
Then, I installed the package directly from my git repo using: uv tool install git+https://github.com/cyberrkni/python-broadlink/

Finally, I used the installed tools to ensure they worked. I used the learn function writing to a file for this.

Checklist

  • The code change is tested and works locally.
  • The code has been formatted using Black.
  • The code follows the Zen of Python.
  • I am creating the Pull Request against the correct branch.
  • Documentation added/updated.

Move broadlink_cli and broadlink_discovery into broadlink.cli with main()
functions so they install via pip or uv tool install. The scripts in cli/
remain as thin wrappers.
Provide CLI tools as console_scripts entry points
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant