Is asyncio supported?
- Dominant language
- Python
- Stars
- 1.9k
- Forks
- 114
- PR merge metrics
- No merged PRs in 30d
Description
Hi, I am trying to use shiv to deploy an executable for an asyncio based app using poetry as the build tool and I am running into a coroutine not awaited error that I can't see where it stems from; can you point me in the right direction? is this something you have seen before?. I have the following project **tree**:
```
Project-name
src
build.sh
project_name
__init__.py
__main__.py
app.py
**.py
```
**build.sh**
```
shiv -p "$interpreter" -e bacnet_client.app:main --site-packages "$site_path" -o dist/project_name.pyz
python3.10 dist/project_name.pyz
```
**__main__.py**
```
import asyncio
import bacnet_client as app
async def main():
await app.main()
if __name__ == "__main__":
asyncio.run(main())
```
**app.py**
```
import asyncio
import logging
import queue
import json
import re
from logging.handlers import QueueHandler
async def main():
"""
Run or schedule all your services from this entry-point script.
"""
try:
loop = asyncio.get_running_loop()
logQ = queue.Queue()
logProducer = QueueHandler(logQ)
logProducer.setFormatter(JsonFormatter(datefmt=ISO8601))
logger = logging.getLogger('ClientLog')
logger.addHandler(logProducer)
logger.setLevel(logging.DEBUG)
logger_task = loop.create_task(log(logQ))
await logger_task
finally:
logger.info("Client application stopping:")
logger.info(None)
logger_task.cancel()
if __name__ == "__main__":
asyncio.run(main())
```
Ultimately the error output after running build.sh is as follows:
_
sys:1: RuntimeWarning: coroutine 'main' was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback_
PS.
I did import the tracemalloc and wired some functions into the app.py's main function and `__main__.py` but it failed with the same error and tracemalloc did not provide any output.
Thank you so much.
Contributor guide
Research direction
Start by reviewing build.sh and the entry points in __main__.py and app.py, then reproduce the warning with the shown Poetry-based project tree. Determine whether the behavior comes from shiv's -e entry point handling or the application's coroutine usage; done means documenting a minimal reproducible case and a confirmed supported behavior or required change.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100