jpayne@68: Metadata-Version: 2.1 jpayne@68: Name: sniffio jpayne@68: Version: 1.3.1 jpayne@68: Summary: Sniff out which async library your code is running under jpayne@68: Author-email: "Nathaniel J. Smith" jpayne@68: License: MIT OR Apache-2.0 jpayne@68: Project-URL: Homepage, https://github.com/python-trio/sniffio jpayne@68: Project-URL: Documentation, https://sniffio.readthedocs.io/ jpayne@68: Project-URL: Changelog, https://sniffio.readthedocs.io/en/latest/history.html jpayne@68: Keywords: async,trio,asyncio jpayne@68: Classifier: License :: OSI Approved :: MIT License jpayne@68: Classifier: License :: OSI Approved :: Apache Software License jpayne@68: Classifier: Framework :: Trio jpayne@68: Classifier: Framework :: AsyncIO jpayne@68: Classifier: Operating System :: POSIX :: Linux jpayne@68: Classifier: Operating System :: MacOS :: MacOS X jpayne@68: Classifier: Operating System :: Microsoft :: Windows jpayne@68: Classifier: Programming Language :: Python :: 3 :: Only jpayne@68: Classifier: Programming Language :: Python :: Implementation :: CPython jpayne@68: Classifier: Programming Language :: Python :: Implementation :: PyPy jpayne@68: Classifier: Intended Audience :: Developers jpayne@68: Classifier: Development Status :: 5 - Production/Stable jpayne@68: Requires-Python: >=3.7 jpayne@68: Description-Content-Type: text/x-rst jpayne@68: License-File: LICENSE jpayne@68: License-File: LICENSE.APACHE2 jpayne@68: License-File: LICENSE.MIT jpayne@68: jpayne@68: .. image:: https://img.shields.io/badge/chat-join%20now-blue.svg jpayne@68: :target: https://gitter.im/python-trio/general jpayne@68: :alt: Join chatroom jpayne@68: jpayne@68: .. image:: https://img.shields.io/badge/docs-read%20now-blue.svg jpayne@68: :target: https://sniffio.readthedocs.io/en/latest/?badge=latest jpayne@68: :alt: Documentation Status jpayne@68: jpayne@68: .. image:: https://img.shields.io/pypi/v/sniffio.svg jpayne@68: :target: https://pypi.org/project/sniffio jpayne@68: :alt: Latest PyPi version jpayne@68: jpayne@68: .. image:: https://img.shields.io/conda/vn/conda-forge/sniffio.svg jpayne@68: :target: https://anaconda.org/conda-forge/sniffio jpayne@68: :alt: Latest conda-forge version jpayne@68: jpayne@68: .. image:: https://travis-ci.org/python-trio/sniffio.svg?branch=master jpayne@68: :target: https://travis-ci.org/python-trio/sniffio jpayne@68: :alt: Automated test status jpayne@68: jpayne@68: .. image:: https://codecov.io/gh/python-trio/sniffio/branch/master/graph/badge.svg jpayne@68: :target: https://codecov.io/gh/python-trio/sniffio jpayne@68: :alt: Test coverage jpayne@68: jpayne@68: ================================================================= jpayne@68: sniffio: Sniff out which async library your code is running under jpayne@68: ================================================================= jpayne@68: jpayne@68: You're writing a library. You've decided to be ambitious, and support jpayne@68: multiple async I/O packages, like `Trio jpayne@68: `__, and `asyncio jpayne@68: `__, and ... You've jpayne@68: written a bunch of clever code to handle all the differences. But... jpayne@68: how do you know *which* piece of clever code to run? jpayne@68: jpayne@68: This is a tiny package whose only purpose is to let you detect which jpayne@68: async library your code is running under. jpayne@68: jpayne@68: * Documentation: https://sniffio.readthedocs.io jpayne@68: jpayne@68: * Bug tracker and source code: https://github.com/python-trio/sniffio jpayne@68: jpayne@68: * License: MIT or Apache License 2.0, your choice jpayne@68: jpayne@68: * Contributor guide: https://trio.readthedocs.io/en/latest/contributing.html jpayne@68: jpayne@68: * Code of conduct: Contributors are requested to follow our `code of jpayne@68: conduct jpayne@68: `_ jpayne@68: in all project spaces. jpayne@68: jpayne@68: This library is maintained by the Trio project, as a service to the jpayne@68: async Python community as a whole. jpayne@68: jpayne@68: jpayne@68: Quickstart jpayne@68: ---------- jpayne@68: jpayne@68: .. code-block:: python3 jpayne@68: jpayne@68: from sniffio import current_async_library jpayne@68: import trio jpayne@68: import asyncio jpayne@68: jpayne@68: async def print_library(): jpayne@68: library = current_async_library() jpayne@68: print("This is:", library) jpayne@68: jpayne@68: # Prints "This is trio" jpayne@68: trio.run(print_library) jpayne@68: jpayne@68: # Prints "This is asyncio" jpayne@68: asyncio.run(print_library()) jpayne@68: jpayne@68: For more details, including how to add support to new async libraries, jpayne@68: `please peruse our fine manual `__.