astral-sh / rye

a Hassle-Free Python Experience
https://rye.astral.sh
MIT License
13.6k stars 466 forks source link

Cannot call an async function with rye run #1377

Open haplo opened 2 weeks ago

haplo commented 2 weeks ago

Steps to Reproduce

  1. rye init async_call
  2. cd async_call
  3. echo -e 'async def hello():\n print("Hi!")' > src/async_call/main.py
  4. echo -e '[tool.rye.scripts]\nhello = { call = "src.async_call.main:hello" }' >> pyproject.toml
  5. rye run hello

Expected Result

$ rye run hello
Hi!

Actual Result

$ rye run hello
<coroutine object hello at 0x7c7ac106cac0>
sys:1: RuntimeWarning: coroutine 'hello' was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

Version Info

rye 0.39.0
commit: 0.39.0 (bf3ccf818 2024-08-21)
platform: linux (x86_64)
self-python: cpython@3.12.5
symlink support: true
uv enabled: true

Stacktrace

No response