Skip to main content
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.

Metadata

Release files for sniffio 1.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sniffio 1.3.1
File Size Uploaded Provenance
sniffio-1.3.1.tar.gz 20.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for sniffio 1.3.1
File Interpreter ABI Platform
sniffio-1.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 30.6 kB

Release files / sniffio-1.3.1.tar.gz

Download URL sniffio-1.3.1.tar.gz
Size 20.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc
BLAKE2b-256 checksum
How to use checksums
a287a6771e1546d97e7e041b6ae58d80074f81b7d5121207425c964ddf5cfdbd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.7

Release files / sniffio-1.3.1-py3-none-any.whl

Download URL sniffio-1.3.1-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2
BLAKE2b-256 checksum
How to use checksums
e94475a9c9421471a6c4805dbf2356f7c181a29c1879239abab1ea2cc8f38b40
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.7

Security for sniffio 1.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page