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

POC - External packages as component libraries #957

Closed

Conversation

timsavage
Copy link
Contributor

@timsavage timsavage commented Jan 15, 2020

Description:

This pull request implements support for multiple component libraries and loading additional packages via entry points (more details in the feature request linked below).

The existing component locations are given priority (in the existing order).

A sample component library package:
https://github.com/timsavage/esphome-poc-component-lib

Related issue (if applicable): implementation of esphome/feature-requests#542

Pull request in esphome-docs with documentation (if applicable): Docs will be written to go with this.

Checklist:

  • The code change is tested and works locally.
  • Tests have been added to verify that the new code works (under tests/ folder).

If user exposed functionality or configuration variables are added/changed:

@timsavage timsavage changed the title Proof of concept loading components from external libraries POC - External packages as components libraries Jan 15, 2020
@timsavage timsavage changed the title POC - External packages as components libraries POC - External packages as component libraries Jan 15, 2020
@stale
Copy link

stale bot commented Mar 17, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Mar 17, 2020
@stale stale bot removed the stale label Mar 17, 2020
@glmnet
Copy link
Member

glmnet commented Apr 19, 2020

Hey there, just looking at this... is there any other way to get the extra component besides cloning the repo and doing the python setup.py develop magic?

Reason I ask is because most people uses ESPHome with dashboard inside Hass "supervisor"

May be, the dashboard could install more "stuff"? like a new option in the dashboard where you give it the git repos url and it will take care of installing the thing, i.e. cloning and running the setup.py

Then you could see on the dashboard which "extras" you had installed, maybe some other thing needs to be done there? like requiring some metadata on the setup.py?

I really don't know much of setup.py stuff this is all magic for me.

Another option I'd like maybe more will be adding the git urls inside the yaml itself, much more like you tell esphome additional libraries or files to include, etc.

@timsavage
Copy link
Contributor Author

timsavage commented Apr 20, 2020

If the package is published, you can just pip install them. Either from PyPI or directly to a git repo.

Behind the scenes, most of the work is handled by the pkg_resources package and looking for the specific entry point defined in your setup.py (or setup.cfg), the same trick can be used to read in other package metadata which would allow for the list of extras to be displayed on the dashboard.

The main advantages I can see is this would allow for components to be decoupled from the core application, letting components get released more often.

As to being inside the Hass supervisor, that is fine, I would assume that esphome is installed via pip, the install would the change to pip install -U esphome esphome-components with any others the user wanted appended or of course esphome-components would be marked as a dependency of esphome in which case it would get installed at the same time.

@oxan
Copy link
Member

oxan commented Jul 10, 2021

Is this still relevant with the introduction of external components? They both seem to provide the same functionality, albeit in a different way.

@OttoWinter
Copy link
Member

Agree @oxan , we can close this.

@OttoWinter OttoWinter closed this Aug 3, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Sep 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants