METADATA 3.7 KB

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