GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - python-trio/sniffio: Sniff out which async library your code is running under

BranchesTags
Open more actions menu

Latest commit

 

History

89 Commits
89 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
docs
docs
 
 
newsfragments
newsfragments
 
 
sniffio
sniffio
 
 
.coveragerc
.coveragerc
 
 
.gitignore
.gitignore
 
 
.mypy.ini
.mypy.ini
 
 
.readthedocs.yml
.readthedocs.yml
 
 
.style.yapf
.style.yapf
 
 
CHEATSHEET.rst
CHEATSHEET.rst
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
LICENSE.APACHE2
LICENSE.APACHE2
 
 
LICENSE.MIT
LICENSE.MIT
 
 
MANIFEST.in
MANIFEST.in
 
 
README.rst
README.rst
 
 
ci.sh
ci.sh
 
 
pyproject.toml
pyproject.toml
 
 

Repository files navigation

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.

  • 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.

About

Sniff out which async library your code is running under

sniffio.readthedocs.io

Topics

asyncasynciopythontrio

Resources

Readme

Code of conduct

Code of conduct

Contributing

Contributing
Activity
Custom properties

Stars

156 stars

Watchers

7 watching

Forks

33 forks
Report repository

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.