jpayne@68
|
1 Metadata-Version: 2.1
|
jpayne@68
|
2 Name: sniffio
|
jpayne@68
|
3 Version: 1.3.1
|
jpayne@68
|
4 Summary: Sniff out which async library your code is running under
|
jpayne@68
|
5 Author-email: "Nathaniel J. Smith" <njs@pobox.com>
|
jpayne@68
|
6 License: MIT OR Apache-2.0
|
jpayne@68
|
7 Project-URL: Homepage, https://github.com/python-trio/sniffio
|
jpayne@68
|
8 Project-URL: Documentation, https://sniffio.readthedocs.io/
|
jpayne@68
|
9 Project-URL: Changelog, https://sniffio.readthedocs.io/en/latest/history.html
|
jpayne@68
|
10 Keywords: async,trio,asyncio
|
jpayne@68
|
11 Classifier: License :: OSI Approved :: MIT License
|
jpayne@68
|
12 Classifier: License :: OSI Approved :: Apache Software License
|
jpayne@68
|
13 Classifier: Framework :: Trio
|
jpayne@68
|
14 Classifier: Framework :: AsyncIO
|
jpayne@68
|
15 Classifier: Operating System :: POSIX :: Linux
|
jpayne@68
|
16 Classifier: Operating System :: MacOS :: MacOS X
|
jpayne@68
|
17 Classifier: Operating System :: Microsoft :: Windows
|
jpayne@68
|
18 Classifier: Programming Language :: Python :: 3 :: Only
|
jpayne@68
|
19 Classifier: Programming Language :: Python :: Implementation :: CPython
|
jpayne@68
|
20 Classifier: Programming Language :: Python :: Implementation :: PyPy
|
jpayne@68
|
21 Classifier: Intended Audience :: Developers
|
jpayne@68
|
22 Classifier: Development Status :: 5 - Production/Stable
|
jpayne@68
|
23 Requires-Python: >=3.7
|
jpayne@68
|
24 Description-Content-Type: text/x-rst
|
jpayne@68
|
25 License-File: LICENSE
|
jpayne@68
|
26 License-File: LICENSE.APACHE2
|
jpayne@68
|
27 License-File: LICENSE.MIT
|
jpayne@68
|
28
|
jpayne@68
|
29 .. image:: https://img.shields.io/badge/chat-join%20now-blue.svg
|
jpayne@68
|
30 :target: https://gitter.im/python-trio/general
|
jpayne@68
|
31 :alt: Join chatroom
|
jpayne@68
|
32
|
jpayne@68
|
33 .. image:: https://img.shields.io/badge/docs-read%20now-blue.svg
|
jpayne@68
|
34 :target: https://sniffio.readthedocs.io/en/latest/?badge=latest
|
jpayne@68
|
35 :alt: Documentation Status
|
jpayne@68
|
36
|
jpayne@68
|
37 .. image:: https://img.shields.io/pypi/v/sniffio.svg
|
jpayne@68
|
38 :target: https://pypi.org/project/sniffio
|
jpayne@68
|
39 :alt: Latest PyPi version
|
jpayne@68
|
40
|
jpayne@68
|
41 .. image:: https://img.shields.io/conda/vn/conda-forge/sniffio.svg
|
jpayne@68
|
42 :target: https://anaconda.org/conda-forge/sniffio
|
jpayne@68
|
43 :alt: Latest conda-forge version
|
jpayne@68
|
44
|
jpayne@68
|
45 .. image:: https://travis-ci.org/python-trio/sniffio.svg?branch=master
|
jpayne@68
|
46 :target: https://travis-ci.org/python-trio/sniffio
|
jpayne@68
|
47 :alt: Automated test status
|
jpayne@68
|
48
|
jpayne@68
|
49 .. image:: https://codecov.io/gh/python-trio/sniffio/branch/master/graph/badge.svg
|
jpayne@68
|
50 :target: https://codecov.io/gh/python-trio/sniffio
|
jpayne@68
|
51 :alt: Test coverage
|
jpayne@68
|
52
|
jpayne@68
|
53 =================================================================
|
jpayne@68
|
54 sniffio: Sniff out which async library your code is running under
|
jpayne@68
|
55 =================================================================
|
jpayne@68
|
56
|
jpayne@68
|
57 You're writing a library. You've decided to be ambitious, and support
|
jpayne@68
|
58 multiple async I/O packages, like `Trio
|
jpayne@68
|
59 <https://trio.readthedocs.io>`__, and `asyncio
|
jpayne@68
|
60 <https://docs.python.org/3/library/asyncio.html>`__, and ... You've
|
jpayne@68
|
61 written a bunch of clever code to handle all the differences. But...
|
jpayne@68
|
62 how do you know *which* piece of clever code to run?
|
jpayne@68
|
63
|
jpayne@68
|
64 This is a tiny package whose only purpose is to let you detect which
|
jpayne@68
|
65 async library your code is running under.
|
jpayne@68
|
66
|
jpayne@68
|
67 * Documentation: https://sniffio.readthedocs.io
|
jpayne@68
|
68
|
jpayne@68
|
69 * Bug tracker and source code: https://github.com/python-trio/sniffio
|
jpayne@68
|
70
|
jpayne@68
|
71 * License: MIT or Apache License 2.0, your choice
|
jpayne@68
|
72
|
jpayne@68
|
73 * Contributor guide: https://trio.readthedocs.io/en/latest/contributing.html
|
jpayne@68
|
74
|
jpayne@68
|
75 * Code of conduct: Contributors are requested to follow our `code of
|
jpayne@68
|
76 conduct
|
jpayne@68
|
77 <https://trio.readthedocs.io/en/latest/code-of-conduct.html>`_
|
jpayne@68
|
78 in all project spaces.
|
jpayne@68
|
79
|
jpayne@68
|
80 This library is maintained by the Trio project, as a service to the
|
jpayne@68
|
81 async Python community as a whole.
|
jpayne@68
|
82
|
jpayne@68
|
83
|
jpayne@68
|
84 Quickstart
|
jpayne@68
|
85 ----------
|
jpayne@68
|
86
|
jpayne@68
|
87 .. code-block:: python3
|
jpayne@68
|
88
|
jpayne@68
|
89 from sniffio import current_async_library
|
jpayne@68
|
90 import trio
|
jpayne@68
|
91 import asyncio
|
jpayne@68
|
92
|
jpayne@68
|
93 async def print_library():
|
jpayne@68
|
94 library = current_async_library()
|
jpayne@68
|
95 print("This is:", library)
|
jpayne@68
|
96
|
jpayne@68
|
97 # Prints "This is trio"
|
jpayne@68
|
98 trio.run(print_library)
|
jpayne@68
|
99
|
jpayne@68
|
100 # Prints "This is asyncio"
|
jpayne@68
|
101 asyncio.run(print_library())
|
jpayne@68
|
102
|
jpayne@68
|
103 For more details, including how to add support to new async libraries,
|
jpayne@68
|
104 `please peruse our fine manual <https://sniffio.readthedocs.io>`__.
|