METADATA 3.5 KB

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