Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 

104 Zeilen
3.5 KiB

  1. Metadata-Version: 2.1
  2. Name: sniffio
  3. Version: 1.2.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 License 2.0
  9. Keywords: async,trio,asyncio
  10. Platform: UNKNOWN
  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.5
  24. Requires-Dist: contextvars (>=2.1) ; python_version < '3.7'
  25. .. image:: https://img.shields.io/badge/chat-join%20now-blue.svg
  26. :target: https://gitter.im/python-trio/general
  27. :alt: Join chatroom
  28. .. image:: https://img.shields.io/badge/docs-read%20now-blue.svg
  29. :target: https://sniffio.readthedocs.io/en/latest/?badge=latest
  30. :alt: Documentation Status
  31. .. image:: https://img.shields.io/pypi/v/sniffio.svg
  32. :target: https://pypi.org/project/sniffio
  33. :alt: Latest PyPi version
  34. .. image:: https://img.shields.io/conda/vn/conda-forge/sniffio.svg
  35. :target: https://anaconda.org/conda-forge/sniffio
  36. :alt: Latest conda-forge version
  37. .. image:: https://travis-ci.org/python-trio/sniffio.svg?branch=master
  38. :target: https://travis-ci.org/python-trio/sniffio
  39. :alt: Automated test status
  40. .. image:: https://codecov.io/gh/python-trio/sniffio/branch/master/graph/badge.svg
  41. :target: https://codecov.io/gh/python-trio/sniffio
  42. :alt: Test coverage
  43. =================================================================
  44. sniffio: Sniff out which async library your code is running under
  45. =================================================================
  46. You're writing a library. You've decided to be ambitious, and support
  47. multiple async I/O packages, like `Trio
  48. <https://trio.readthedocs.io>`__, and `asyncio
  49. <https://docs.python.org/3/library/asyncio.html>`__, and ... You've
  50. written a bunch of clever code to handle all the differences. But...
  51. how do you know *which* piece of clever code to run?
  52. This is a tiny package whose only purpose is to let you detect which
  53. async library your code is running under.
  54. * Documentation: https://sniffio.readthedocs.io
  55. * Bug tracker and source code: https://github.com/python-trio/sniffio
  56. * License: MIT or Apache License 2.0, your choice
  57. * Contributor guide: https://trio.readthedocs.io/en/latest/contributing.html
  58. * Code of conduct: Contributors are requested to follow our `code of
  59. conduct
  60. <https://trio.readthedocs.io/en/latest/code-of-conduct.html>`_
  61. in all project spaces.
  62. This library is maintained by the Trio project, as a service to the
  63. async Python community as a whole.
  64. Quickstart
  65. ----------
  66. .. code-block:: python3
  67. from sniffio import current_async_library
  68. import trio
  69. import asyncio
  70. async def print_library():
  71. library = current_async_library()
  72. print("This is:", library)
  73. # Prints "This is trio"
  74. trio.run(print_library)
  75. # Prints "This is asyncio"
  76. asyncio.run(print_library())
  77. For more details, including how to add support to new async libraries,
  78. `please peruse our fine manual <https://sniffio.readthedocs.io>`__.