#So apparently we still load hassio as

1 messages · Page 1 of 1 (latest)

shy topaz
#

cc @nova ridge

nova ridge
#

@crisp rock can you check?

crisp rock
#

EDIT: What I do not understand yet: Why did from aiohasupervisor import SupervisorError not fail, which is done before IngressPanel?

shy topaz
#

Yep I just saw that one as well

crisp rock
#

wait hm

#

I guess that means its still happening

shy topaz
#

I thought we now made it so that core could run without aiohasupervisor right

crisp rock
#

I think the reason its breaking where its breaking is because IngressPanel is new

#

we upgraded the version of aiohasupervisor after removing the depenency from core requiremetns

#

they probably have the old version still in their venv but not the new one

#

and so its speicifically not finding that reference

#

but that means somehow its still loading...

#

Think analytics is gonna pull it in

shy topaz
#

Right

#

Is this something you can look at?

crisp rock
#

its any of them isn't it?

#

I guess its not that something pulls it in but rather something pulls it in without declaring the dependency in manifest

#

ok yea ill take a look

#

anyone asks for system info its just going to try and load hassio. and that's not in an integration at all

#

Isn't system info what we call to load that panel in the UI? I can fix it but I don't get why we're doing that so early in startup

shy topaz
#

cc @finite crater

finite crater
#

likely as optimisation, looks like something that Nick would add

crisp rock
#

I figured it out

#

its because a few of the things in there like get_user do blocking I/O to figure it out and don't change

#

so even though this function just returns a response without caching it and we toss the response we want those pieces of system info cached for later

finite crater
#

exactly

nova ridge
#

Nice find. So essentially our dependency drop of aiohasupervisor in the main requirement was a bit premature 🤔

crisp rock
#

Well yes and no. we had nothing automated to catch this

#

every integration that imports hassio stuff does now list hassio in its manifest, I just checked

#

but this helper currently bypasses our hassfest checks

#

it can create secret dependencies, like with bootstrap

shy topaz
#

I am wondering if there is an easy way to test this

crisp rock
#

but its just a bug, the code doesn't make sense

#

it was importing the hassio component and then using our is_hassio helper after

#

the one we made specifically to allow integrations to check if they should import hassio

finite crater
crisp rock
#

do you mean the helper?

#

or the import?

finite crater
#

not importing at top level

crisp rock
#

yea that's fine

#

we made an is_hassio helper that checks if hassio is loaded

#

and all around the codebase what you see is this

#
if is_hassio:
  from homeassistant.components import hassio

or something along those lines

finite crater
#

yeah, but here that won't work

crisp rock
#

this one does this

from homeassistant.components import hassio
if is_hassio
finite crater
#

you need a different solution here

crisp rock
#

how come?

finite crater
#

that helper checks if hassio is loaded, here it's too early in bootstrap

crisp rock
#

sure but we don't care anyway. It loads hassio to help craft a better response

#

and bootstrap tosses the entire response

finite crater
#

yeah, probably makes sense to split that function into two

#

and just call the one which does all the io from bootstrap

#

OK, I get what you're saying, it can be left the way it is too

#

since we don't care about the response

crisp rock
#

yea

#

it is admittedly doing a little more work then necessary

#

so what you're saying makes sense

#

but maybe since we're already in beta I'll do the quick fix here

#

and we can decide if we want to improve it after

finite crater
#

sounds OK

crisp rock
#
        if TYPE_CHECKING:
            from homeassistant.components import hassio  # noqa: PLC0415
        else:
            hassio = await async_import_module(hass, "homeassistant.components.hassio")

This style of import is redundant now though right?

#

if we put all this under if is_hassio(hass)

#

that means hassio is already in hass.config.components

#

so we can ust import. its not going to be blocking

finite crater
#

yes