Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

Fix warning that coroutine decorator is deprecated since Python 3.8 #10

Open
dhimmel opened this issue Oct 25, 2019 · 11 comments · May be fixed by #11
Open

Fix warning that coroutine decorator is deprecated since Python 3.8 #10

dhimmel opened this issue Oct 25, 2019 · 11 comments · May be fixed by #11

Comments

@dhimmel
Copy link

dhimmel commented Oct 25, 2019

Our project currently uses ratelimiter-1.2.0.post0, the latest version on PyPI.

Python 3.8 has been released and we're adding a py28 CI test for our project, which resulted in the following warning:

  /home/travis/virtualenv/python3.8.0/lib/python3.8/site-packages/ratelimiter.py:127: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
    __aexit__ = asyncio.coroutine(__exit__)

While the master branch has unreleased commits that weren't in the version we're testing, I believe the warning would still occur on the latest master commit at the following line:

__aexit__ = asyncio.coroutine(RateLimiter.__exit__)

Is it possible to update the code to no longer create the warning and release a new version to PyPI with the update?

@dhimmel
Copy link
Author

dhimmel commented Jan 31, 2020

Ping @RazerM

@RazerM
Copy link
Owner

RazerM commented Feb 1, 2020

Can you submit a PR?

@dhimmel
Copy link
Author

dhimmel commented Feb 14, 2020

Can you submit a PR?

I read a bit about the difference between @asyncio.coroutine and async def. But I'm not familiar enough with Python's async to confidently fix the warning.

@kapilt
Copy link

kapilt commented Feb 18, 2020

i'm running into the same issue. it looks like theres other issues with the async implementation here, its protecting async.Lock initialization with a the synchronous thread lock, and at the moment for exit it just calls through to baseclass exit, which is just using the thread lock not the async lock. putting an async coroutine around a blocking call doesn't make it not blocking

@kapilt
Copy link

kapilt commented Feb 18, 2020

Can you submit a PR?

I read a bit about the difference between @asyncio.coroutine and async def. But I'm not familiar enough with Python's async to confidently fix the warning.

fwiw, in the context of the usage here the delta really isn't very material afaics.

@musicinmybrain
Copy link

The deprecated asyncio.coroutine was scheduled for removal in Python 3.10, but that didn’t end up happening. However, it is removed in current development versions of Python 3.11, so this still needs to be dealt with.

@MilesCranmer
Copy link

FYI this was officially removed in Python 3.11 so dependent packages are now breaking. @RazerM

@brainysmurf
Copy link

Also seeing this. If this isn't going to be fixed is there an alternative?

@MilesCranmer
Copy link

Snakemake might switch to throttler instead: snakemake/snakemake#1958

@uburuntu

This comment was marked as off-topic.

@RazerM
Copy link
Owner

RazerM commented Nov 22, 2022

@uburuntu your project is already mentioned in this issue and in the other PR which I think is more than enough.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants