All Projects → python-trio → sniffio

python-trio / sniffio

Licence: Unknown and 2 other licenses found Licenses found Unknown LICENSE Apache-2.0 LICENSE.APACHE2 MIT LICENSE.MIT
Sniff out which async library your code is running under

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to sniffio

python-socks
Core proxy client (SOCKS4, SOCKS5, HTTP) functionality for Python
Stars: ✭ 40 (-46.67%)
Mutual labels:  asyncio, trio
asyncer
Asyncer, async and await, focused on developer experience.
Stars: ✭ 572 (+662.67%)
Mutual labels:  asyncio, trio
fastapi-azure-auth
Easy and secure implementation of Azure AD for your FastAPI APIs 🔒 B2C, single- and multi-tenant support.
Stars: ✭ 174 (+132%)
Mutual labels:  asyncio, trio
Httpx
A next generation HTTP client for Python. 🦋
Stars: ✭ 8,052 (+10636%)
Mutual labels:  asyncio, trio
hypercorn-fastapi-docker
Docker image with Hypercorn for FastAPI apps in Python 3.7, 3.8, 3.9. Ready for HTTP2 and HTTPS
Stars: ✭ 18 (-76%)
Mutual labels:  asyncio, trio
Dnspython
a powerful DNS toolkit for python
Stars: ✭ 1,838 (+2350.67%)
Mutual labels:  asyncio, trio
asyncstdlib
the missing toolbox for an async world
Stars: ✭ 145 (+93.33%)
Mutual labels:  trio
MicroExpress
A micro web server framework on top of Swift NIO
Stars: ✭ 125 (+66.67%)
Mutual labels:  asyncio
Async Lru
Simple lru cache for asyncio
Stars: ✭ 248 (+230.67%)
Mutual labels:  asyncio
Odmantic
Async ODM (Object Document Mapper) for MongoDB based on python type hints
Stars: ✭ 240 (+220%)
Mutual labels:  asyncio
yutto
🧊 一个可爱且任性的 B 站视频下载器(bilili V2)
Stars: ✭ 383 (+410.67%)
Mutual labels:  asyncio
aioneo4j
asyncio client for neo4j
Stars: ✭ 29 (-61.33%)
Mutual labels:  asyncio
socketwrapper
Async/Sync networking library including UDP, TCP and TLS/TCP socket classes written in C++ 17.
Stars: ✭ 33 (-56%)
Mutual labels:  asyncio
sphinxcontrib-trio
Make Sphinx better at documenting Python functions and methods
Stars: ✭ 26 (-65.33%)
Mutual labels:  trio
async cron
crontab for python,with asyncio
Stars: ✭ 23 (-69.33%)
Mutual labels:  asyncio
Opcua Asyncio
OPC UA library for python > 3.6 asyncio
Stars: ✭ 251 (+234.67%)
Mutual labels:  asyncio
trellio
Python3 asyncio based microframework for microservice architecture
Stars: ✭ 19 (-74.67%)
Mutual labels:  asyncio
Uvicorn Gunicorn Docker
Docker image with Uvicorn managed by Gunicorn for high-performance web applications in Python 3.6 with performance auto-tuning. Optionally with Alpine Linux.
Stars: ✭ 244 (+225.33%)
Mutual labels:  asyncio
tinkoff-api
Python Tinkoff API client for asyncio and humans
Stars: ✭ 60 (-20%)
Mutual labels:  asyncio
prometheus-async
Async helpers for prometheus_client.
Stars: ✭ 136 (+81.33%)
Mutual labels:  asyncio
Join chatroom Documentation Status Latest PyPi version Latest conda-forge version Automated test status Test coverage

sniffio: Sniff out which async library your code is running under

You're writing a library. You've decided to be ambitious, and support multiple async I/O packages, like Trio, and asyncio, and ... You've written a bunch of clever code to handle all the differences. But... how do you know which piece of clever code to run?

This is a tiny package whose only purpose is to let you detect which async library your code is running under.

This library is maintained by the Trio project, as a service to the async Python community as a whole.

Quickstart

from sniffio import current_async_library
import trio
import asyncio

async def print_library():
    library = current_async_library()
    print("This is:", library)

# Prints "This is trio"
trio.run(print_library)

# Prints "This is asyncio"
asyncio.run(print_library())

For more details, including how to add support to new async libraries, please peruse our fine manual.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].