METADATA 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. Metadata-Version: 2.1
  2. Name: pluggy
  3. Version: 1.5.0
  4. Summary: plugin and hook calling mechanisms for python
  5. Home-page: https://github.com/pytest-dev/pluggy
  6. Author: Holger Krekel
  7. Author-email: holger@merlinux.eu
  8. License: MIT
  9. Platform: unix
  10. Platform: linux
  11. Platform: osx
  12. Platform: win32
  13. Classifier: Development Status :: 6 - Mature
  14. Classifier: Intended Audience :: Developers
  15. Classifier: License :: OSI Approved :: MIT License
  16. Classifier: Operating System :: POSIX
  17. Classifier: Operating System :: Microsoft :: Windows
  18. Classifier: Operating System :: MacOS :: MacOS X
  19. Classifier: Topic :: Software Development :: Testing
  20. Classifier: Topic :: Software Development :: Libraries
  21. Classifier: Topic :: Utilities
  22. Classifier: Programming Language :: Python :: Implementation :: CPython
  23. Classifier: Programming Language :: Python :: Implementation :: PyPy
  24. Classifier: Programming Language :: Python :: 3
  25. Classifier: Programming Language :: Python :: 3 :: Only
  26. Classifier: Programming Language :: Python :: 3.8
  27. Classifier: Programming Language :: Python :: 3.9
  28. Classifier: Programming Language :: Python :: 3.10
  29. Classifier: Programming Language :: Python :: 3.11
  30. Requires-Python: >=3.8
  31. Description-Content-Type: text/x-rst
  32. License-File: LICENSE
  33. Provides-Extra: dev
  34. Requires-Dist: pre-commit ; extra == 'dev'
  35. Requires-Dist: tox ; extra == 'dev'
  36. Provides-Extra: testing
  37. Requires-Dist: pytest ; extra == 'testing'
  38. Requires-Dist: pytest-benchmark ; extra == 'testing'
  39. ====================================================
  40. pluggy - A minimalist production ready plugin system
  41. ====================================================
  42. |pypi| |conda-forge| |versions| |github-actions| |gitter| |black| |codecov|
  43. This is the core framework used by the `pytest`_, `tox`_, and `devpi`_ projects.
  44. Please `read the docs`_ to learn more!
  45. A definitive example
  46. ====================
  47. .. code-block:: python
  48. import pluggy
  49. hookspec = pluggy.HookspecMarker("myproject")
  50. hookimpl = pluggy.HookimplMarker("myproject")
  51. class MySpec:
  52. """A hook specification namespace."""
  53. @hookspec
  54. def myhook(self, arg1, arg2):
  55. """My special little hook that you can customize."""
  56. class Plugin_1:
  57. """A hook implementation namespace."""
  58. @hookimpl
  59. def myhook(self, arg1, arg2):
  60. print("inside Plugin_1.myhook()")
  61. return arg1 + arg2
  62. class Plugin_2:
  63. """A 2nd hook implementation namespace."""
  64. @hookimpl
  65. def myhook(self, arg1, arg2):
  66. print("inside Plugin_2.myhook()")
  67. return arg1 - arg2
  68. # create a manager and add the spec
  69. pm = pluggy.PluginManager("myproject")
  70. pm.add_hookspecs(MySpec)
  71. # register plugins
  72. pm.register(Plugin_1())
  73. pm.register(Plugin_2())
  74. # call our ``myhook`` hook
  75. results = pm.hook.myhook(arg1=1, arg2=2)
  76. print(results)
  77. Running this directly gets us::
  78. $ python docs/examples/toy-example.py
  79. inside Plugin_2.myhook()
  80. inside Plugin_1.myhook()
  81. [-1, 3]
  82. .. badges
  83. .. |pypi| image:: https://img.shields.io/pypi/v/pluggy.svg
  84. :target: https://pypi.org/pypi/pluggy
  85. .. |versions| image:: https://img.shields.io/pypi/pyversions/pluggy.svg
  86. :target: https://pypi.org/pypi/pluggy
  87. .. |github-actions| image:: https://github.com/pytest-dev/pluggy/workflows/main/badge.svg
  88. :target: https://github.com/pytest-dev/pluggy/actions
  89. .. |conda-forge| image:: https://img.shields.io/conda/vn/conda-forge/pluggy.svg
  90. :target: https://anaconda.org/conda-forge/pytest
  91. .. |gitter| image:: https://badges.gitter.im/pytest-dev/pluggy.svg
  92. :alt: Join the chat at https://gitter.im/pytest-dev/pluggy
  93. :target: https://gitter.im/pytest-dev/pluggy?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
  94. .. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
  95. :target: https://github.com/ambv/black
  96. .. |codecov| image:: https://codecov.io/gh/pytest-dev/pluggy/branch/master/graph/badge.svg
  97. :target: https://codecov.io/gh/pytest-dev/pluggy
  98. :alt: Code coverage Status
  99. .. links
  100. .. _pytest:
  101. http://pytest.org
  102. .. _tox:
  103. https://tox.readthedocs.org
  104. .. _devpi:
  105. http://doc.devpi.net
  106. .. _read the docs:
  107. https://pluggy.readthedocs.io/en/latest/
  108. Support pluggy
  109. --------------
  110. `Open Collective`_ is an online funding platform for open and transparent communities.
  111. It provides tools to raise money and share your finances in full transparency.
  112. It is the platform of choice for individuals and companies that want to make one-time or
  113. monthly donations directly to the project.
  114. ``pluggy`` is part of the ``pytest-dev`` project, see more details in the `pytest collective`_.
  115. .. _Open Collective: https://opencollective.com
  116. .. _pytest collective: https://opencollective.com/pytest