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