loongson/pypi/: sniffio-1.2.0 metadata and description

Homepage Simple index

Sniff out which async library your code is running under

author Nathaniel J. Smith
author_email njs@pobox.com
  • License :: OSI Approved :: MIT License
  • License :: OSI Approved :: Apache Software License
  • Framework :: Trio
  • Framework :: AsyncIO
  • Operating System :: POSIX :: Linux
  • Operating System :: MacOS :: MacOS X
  • Operating System :: Microsoft :: Windows
  • Programming Language :: Python :: 3 :: Only
  • Programming Language :: Python :: Implementation :: CPython
  • Programming Language :: Python :: Implementation :: PyPy
  • Intended Audience :: Developers
  • Development Status :: 5 - Production/Stable
keywords async,trio,asyncio
license MIT -or- Apache License 2.0
  • contextvars (>=2.1) ; python_version < '3.7'
requires_python >=3.5

Because this project isn't in the mirror_whitelist, no releases from root/pypi are included.

File Tox results History
10 KB
Python Wheel
  • Replaced 1 time(s)
  • Uploaded to loongson/pypi by loongson 2022-08-08 02:47:32
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.


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"

# Prints "This is asyncio"

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