METADATA 4.7 KB

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