spyoungtech / ahk

Python wrapper for AutoHotkey with full type support. Harness the automation power of AutoHotkey with the beauty of Python.
MIT License
887 stars 66 forks source link

Use asyncio to block forever rather than time sleep #309

Closed trajano closed 5 months ago

trajano commented 5 months ago

https://stackoverflow.com/questions/78465203/internally-is-asyncio-run-forever-basically-a-while-true-loop/78465221#78465221

https://stackoverflow.com/a/78463084/242042

spyoungtech commented 5 months ago

Thanks for raising this. However, all code in the _sync directory is automatically generated. Changes to _sync/ must originate from _async/ changes.

(to avoid the code rewriting, you can also extract to the _utils module in the root of the package)

Sorry for you to run into this. I should probably get around to writing a contribution guide that explains all of this soon 😅

trajano commented 5 months ago

Thanks for raising this. However, all code in the _sync directory is automatically generated. Changes to _sync/ must originate from _async/ changes.

Oof that's probably why when I use the requirements.txt to point to my git repo my changes are not being reflected and I was wondering WTF... because this is the second one I am doing patch work for my weekend project https://github.com/jath03/openrgb-python/pull/72 was the first and it seemed to work.

coveralls commented 5 months ago

Coverage Status

coverage: 77.477%. remained the same when pulling cdb20ba1208724698329cab8181eeeb8d799929a on trajano:patch-1 into de90e941e50a8d7e5ff60cba60d299043d3353fa on spyoungtech:main.

trajano commented 5 months ago

BTW if _sync is generated why is the source present in the repo?

spyoungtech commented 5 months ago

It perhaps doesn't have to be committed, and I've gone back and forth on whether it should be or not, but ultimately it made it easier for linting tools, mypy, sphinx/readthedocs, etc. to all work correctly and allows someone to see the source online like, say, if they're investigating a stacktrace that points to a line in the _sync code.

trajano commented 5 months ago

I yield. I am not familiar with Python enough to convert what I have to an async def when there's no await in the body.