legrego / homeassistant-elasticsearch

Publish Home-Assistant events to Elasticsearch
https://legrego.github.io/homeassistant-elasticsearch/
MIT License
145 stars 38 forks source link

Dev Container does not contain Home Assistant #208

Closed strawgate closed 2 months ago

strawgate commented 2 months ago

Describe the bug I am attempting to follow the contributors guide but hass is not present in the dev container and the related tasks mentioned in the contributors guide are not present

To Reproduce Steps to reproduce the behavior:

  1. Install VS Code and Docker
  2. Open the repository, re-open in Container
  3. ./scripts/develop

Expected behavior Starts home assistant with homeassistant-elasticsearch loaded.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

legrego commented 2 months ago

Hey @strawgate, thanks for the report. I'm having a hard time reproducing this.

Part of the Dev Container setup is to execute scripts/setup, which installs everything listed in the project's requirements.txt, including both ES and Home Assistant:

https://github.com/legrego/homeassistant-elasticsearch/blob/f12534e5d2c88f6c049021402ab9d158f845f64b/.devcontainer/devcontainer.json#L20

https://github.com/legrego/homeassistant-elasticsearch/blob/f12534e5d2c88f6c049021402ab9d158f845f64b/scripts/setup#L7

Did you notice any errors during container creation that can help me pinpoint the issue?

strawgate commented 2 months ago

The version of setup on main just has

python3 -m poetry install

https://github.com/legrego/homeassistant-elasticsearch/blob/63a72bbe705ef3cbb54985b4014497fb38177805/scripts/setup#L1-L7

Could that be the issue?

Will try to get a log shortly

legrego commented 2 months ago

Ah. My local main is behind upstream. Yeah I might have messed something up during my migration to poetry for dependency management.

legrego commented 2 months ago

I think I found the issue, and raised https://github.com/legrego/homeassistant-elasticsearch/pull/209 to address it. Let me know if you have any more issues with the dev container after I merge this fix

strawgate commented 2 months ago

Home assistant is actually still missing when I build the dev container

strawgate commented 2 months ago

and ruff is too actually

legrego commented 2 months ago

Within the dev container, are you executing commands within the Python virtual environment managed by poetry?

strawgate commented 2 months ago

I'm opening the workspace in the Dev container and running the develop and lint scripts in the scripts folder.

Is there another step required?

legrego commented 2 months ago

For VSCode, you'll want to ensure that the correct Python interpreter is used. Once you select the interpreter that corresponds to the poetry environment, then you should be able to open a new terminal in VSCode. This new terminal should automatically be scoped to the poetry managed environment:

https://github.com/legrego/homeassistant-elasticsearch/assets/3493255/fbb1c85b-532d-4ad8-b903-af2144f1a3bc

There's probably a way to streamline this, but I haven't spent the time to dig into it yet.

legrego commented 2 months ago

I have a handful of improvements to the dev container in https://github.com/legrego/homeassistant-elasticsearch/pull/213 which just merged. I'll leave this issue open until we can verify it's working for you.

strawgate commented 2 months ago

Looks good