-
Notifications
You must be signed in to change notification settings - Fork 801
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
Async context manager #535
Comments
How would that work, keeping in mind that we support all the way back to 2.6? |
Well, I didn't think about it. Sorry. |
@brian-brazil, what do you think about Python version check inside decorator to exclude support for non-async syntax. Seems like it's not gonna affect backwards support. And will come really handy |
I'm not sure how that'd work given that it's a syntax thing, and thus 2.6 would choke on it. |
Yup, actually i was thinking about depending on version import of async compatible syntax. But it looks too complex and such case may be implemented easier with context manager as well. c = Counter("errors_count")
async def foo_async():
with c.count_exceptions():
await sleep(1)
raise Exception() actually if someone really need the decorator then he can implement it by himself with a few lines of code |
The silent failure is surprising here.
I believe it's possible to do version checks inside the
Sure, but it's unexpected and causes metrics to be easily missed in a Python 3 world where 2.x is past EOL. |
Why don't just drop support for not-maintained-for-7-years Python 2.6? I vote for native asyncio support instead of ancient py2.x. |
I pulled some data for downloads over the last 6 months by python version:
I am hesitant to remove support for anything used by more than a couple percent of users, which means I think support for 2.6 could be removed but not yet 2.7. |
Also, note that 2.6 support has actually already been removed in master, but not yet in a release (#592 for reference). |
Be aware a lot of download traffic is bot driven. So downloads may not be reflective of actual user percentages as there's a fair bit of old tooling churning away at 2.7 builds that aren't used anymore. There was a similar level of traffic for 2.7 on other projects I maintain but actual users keyed on library updates for that version ended up being much smaller than initially perceived by downloads, if that helps with decision making. |
Many other popular libraries have ended support for Python 2, regardless of how many 2.x downloads were reported. ( |
I opened #717 for removing python 2 support, and enabling this feature. |
Usecase:
Quick search in project did nothing to me.
It would be cool if counter (and other objects) would handle this right out of the box, especially if we're talking about metrics for web world.
The text was updated successfully, but these errors were encountered: