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.
Documentation: https://sniffio.readthedocs.io
Bug tracker and source code: https://github.com/python-trio/sniffio
License: MIT or Apache License 2.0, your choice
Contributor guide: https://trio.readthedocs.io/en/latest/contributing.html
Code of conduct: Contributors are requested to follow our code of conduct in all project spaces.
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.
Release files for sniffio 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sniffio-1.2.0.tar.gz | 17.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sniffio-1.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.2 kB
Release files / sniffio-1.2.0.tar.gz
| Download URL | sniffio-1.2.0.tar.gz |
|---|---|
| Size | 17.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c4666eecec1d3f50960c6bdf61ab7bc350648da6c126e3cf6898d8cd4ddcd3de
|
|
BLAKE2b-256 checksum How to use checksums |
a6ae44ed7978bcb1f6337a3e2bef19c941de750d73243fc9389140d62853b686
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5
|
Release files / sniffio-1.2.0-py3-none-any.whl
| Download URL | sniffio-1.2.0-py3-none-any.whl |
|---|---|
| Size | 10.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
471b71698eac1c2112a40ce2752bb2f4a4814c22a54a3eed3676bc0f5ca9f663
|
|
BLAKE2b-256 checksum How to use checksums |
52b07b2e028b63d092804b6794595871f936aafa5e9322dcaaad50ebf67445b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5
|