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

Beta 2024.12.0b0 breaks amp #2698

Open
Bergasha opened this issue Nov 27, 2024 · 12 comments
Open

Beta 2024.12.0b0 breaks amp #2698

Bergasha opened this issue Nov 27, 2024 · 12 comments

Comments

@Bergasha
Copy link

IMPORTANT: Please search the issues, including closed issues, and the FAQ before opening a new issue. The template is mandatory; failure to use it will result in issue closure.

Describe the bug

Integration does not load

To Reproduce

update to latest beta

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

it works

Screenshots

System details

  • Home Assistant version: 2024.12.0bo
  • alexa_media version (from const.py or HA startup log): 14.8
  • alexapy version (from pip show alexapy in homeasssistant container or HA startup log): 1.29.4
  • Is Amazon 2FA/2SV enabled <!---We will not debug login issues if unanswered---> (y/n): y
  • Amazon Domain: amazon.com

Debug Logs (alexa_media & alexapy)

Unable to install package alexapy==1.29.4: × No solution found when resolving dependencies: ╰─▶ Because alexapy==1.29.4 depends on aiofiles>=23.1.0,<24.0.0 and aiofiles>=24.1.0, we can conclude that alexapy==1.29.4 cannot be used. And because you require alexapy==1.29.4, we can conclude that your requirements are unsatisfiable.

Additional context

@IceBotYT
Copy link

IceBotYT commented Nov 27, 2024

It looks like an update to aiofiles 24.1.0 would fix the problem

@danielbrunt57
Copy link
Collaborator

danielbrunt57 commented Nov 28, 2024

It looks like an update to aiofiles 24.1.0 would fix the problem

I checked what's changed in aiofiles 24.1.0 from 23.2.1 and the update looks to be safe for alexapy to use. That said, it still needs to be tested first. Then alexapy library dependencies updated followed by alexapy bump to v1.29.5, then new AMP bump with a revised manifest.json...

@alandtse: alexapy issue posted:
Error loading Alexa Media Player integration on the latest HA beta release 2024.12.0b0 which requires aiofiles>=24.1.0

@larena1
Copy link

larena1 commented Nov 28, 2024

Can't we just move alexapy into this repo to ease further development? Aland is not anymore maintaining it anyway and even barely looking into issues and prs unfortunately so everything takes really long and then it still needs to be published to pypi and bumped here etc

@danielbrunt57
Copy link
Collaborator

It's not as simple as that since alexapy is a python library that HA imports like httpx, aiohttp, aiofiles, typing, etc, etc, etc.
Besides, @alandtse still owns the GitHub repo for alexa_media and the GutLab repo for alexapy in PyPi and manages and reviews the PR's for them. He's just contributing and code or consultation. Good luck finding someone to take on the responsibility of the entire project!

I posted an issue for this in alexapy and Alan has responded there but there's no PR there yet. I just wish the current AMP release of 5.0.0 was 4.13.9 or 4.14.0 until alexapy is updated, merged, then AMP updated, merged and then released as 5.0.0.

@pbranly
Copy link

pbranly commented Nov 29, 2024

Hi
I just used the 5.0.0 with the last HA beta and the issue is still there
"Setup failed for custom integration 'alexa_media': Requirements for alexa_media not found: ['alexapy==1.29.4']."
Phil

@larena1
Copy link

larena1 commented Nov 29, 2024

It's not as simple as that since alexapy is a python library that HA imports like httpx, aiohttp, aiofiles, typing, etc, etc, etc.

It's just about copying the files, adjusting the imports and doing the same also with the auth capture proxy, isn't it? I think both libraries are not used anywhere else either way and the only downside would be updates of the component being a bit bigger but also less maintenance burden for @alandtse who needs to monitor multiple repos, bump and release alexapy, then bump alexapy here and release the component. It would also make it easier to develop stuff when it's all in the component and quick fixes could even be applied by the users as in this case before an official update is available

@danielbrunt57
Copy link
Collaborator

danielbrunt57 commented Nov 29, 2024

Hi I just used the 5.0.0 with the last HA beta and the issue is still there "Setup failed for custom integration 'alexa_media': Requirements for alexa_media not found: ['alexapy==1.29.4']." Phil

There's been no change yet in alexapy and it's aiofiles>=23.1.0,<24.0.0 requirement and I highly doubt any change will occur before 12.0.0 official is released next week.

If you want to continue using AMP, you'll have to stay on Core 11.x until alexapy is updated
unless you are prepared to do the following...

@danielbrunt57
Copy link
Collaborator

danielbrunt57 commented Nov 30, 2024

If you want to try using AMP & Core 12.x before alexapy is updated, you'll have to edit
line 16 in file homeassistant:/usr/local/lib/python3.12/site-packages/alexapy-1.29.4.dist-info/METADATA
to read Requires-Dist: aiofiles (>=23.1.0,<25.0.0). Before you can do that, you first have to get HA to install alexapy!

Here are my steps...
I upgraded from Core 2024.11.3 to 2024.12.0b2.
Then...

pip install alexapy

This will downgrade aiofiles to 23.2.1 and that has to be rectified as other modules depend on aiofiles 24.1.0.
Before rectifying though, edit /usr/local/lib/python3.13/site-packages/alexapy-1.29.4.dist-info/METADATA
Line 16: Change 24.0.0 to 25.0.0

Than...

pip install aiofiles -U

(this will restore aiofiles 24.1.0)

Since alexawebsocket.py will now fail on from aiohttp.http_websocket import ALLOWED_CLOSE_CODES in Python 3.13,
Edit /usr/local/lib/python3.13/site-packages/alexapy/alexwebsocket.py and change
Line 26:
from aiohttp.http_websocket import ALLOWED_CLOSE_CODES, WSCloseCode
To:
from aiohttp import http_websocket

Restart Home Assistant and AMP/alexapy should be working in HA Core 2024.12.x.

NOTE: This process will need to be repeated after every HA Core update since
updating core redownloads everything and the changes you've made will be lost!

aiofiles History
24.1.0 (2024-06-24)

  • Import os.link conditionally to fix importing on android. #175
  • Remove spurious items from aiofiles.os.all when running on Windows.
  • Switch to more modern async idioms: Remove types.coroutine and make AiofilesContextManager an awaitable instead a > coroutine.
  • Add aiofiles.os.path.abspath and aiofiles.os.getcwd. #174
  • aiofiles is now tested on Python 3.13 too. #184
  • Dropped Python 3.7 support. If you require it, use version 23.2.1

@larena1
Copy link

larena1 commented Nov 30, 2024

Or just install this wheel (might need to rename from zip to whl first as GitHub doesn't allow uploading whl files) using pip install alexapy-1.29.4-py3-none-any.whl and restart HA afterwards.

But that's exactly the reason why I think those few alexapy python files should be just moved into this repo.

alexapy-1.29.4-py3-none-any.zip

@dreimer1986
Copy link

dreimer1986 commented Nov 30, 2024

Unlikely. AlexaPy is a multi purpose module for Python and not bound to this single use case we have here. So if you would say "copied" as in forked, then yes, might be a nice idea if you want to add even more work to your maintenance workflow, but only then. Otherwise you have to wait until it's fixed over there. We are not talking about hours of work to fix it, so I see no reason to fork anything here. (+ Luckily it's nothing anyone here can decide anyways ^^)

And while we are at it... I use this Addin for years now and NEVER had big downtimes in the release cycle. So where in the name of :putgodlikentitynamehere: comes this never asked for "it's broken for months now!!!!!1eleven" mentality from?! It's your fault that you install the Home Assistant Beta and now complaining that things don't work for a few days is nothing but naive and if I were the developer, I would even call it a direct insult of my work. Betas are not meant for everyday use, but to report bugs. This was done already, so wait until it's fixed!

P.S. Because we live in a world where everyone feels immediately insulted, discriminated etc etc... This one was not against the ppl who came here to rightfully report the issue or help with temporary solutions.

@larena1
Copy link

larena1 commented Nov 30, 2024

Unlikely. AlexaPy is a multi purpose module for Python and not bound to this single use case we have here.

@dreimer1986 Thanks for the lesson although you seem to have missed that alexapy was built specifically for this addon to retire the previous NodeJS solution and might not even be used anywhere else than here.

For the rest please read my comments and arguments more thoroughly and save all our time by refraining from posting when you are unable to add anything of value to the discussion

@danielbrunt57
Copy link
Collaborator

As stated, betas are to test code and report issues. If you want an instant fix, go back to core 2024.11.

I am working when I have time to try fix the issue.

I managed to get alexapy 1.29.4 installed into core 2024.12.0b2 and found that alexawebsocket.py's from aiohttp.http_websocket import ALLOWED_CLOSE_CODES, WSCloseCode fails since aiohttp.http_websocket is structured differently in python 3.13 and ALLOWED_CLOSE_CODES is no longer defined where it used to be. This means that a new alexapy 1.29.5 should be released with the requirement that aiofiles is 24.x &/or python version is 3.13, a new AMP version released (6.0.0?) requiring alexapy 1.29.5 and all of that is a major breaking change. I'm inside alexawebsocket.py now to see if I can do conditional importing based on python minor version ('12' or '13). I'm not sure if this approach will pass Alan's scrutiny or not...

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

No branches or pull requests

6 participants