gituser/test_manylinux/: pluggy-1.0.0 metadata and description

Homepage Simple index

plugin and hook calling mechanisms for python

author Holger Krekel
author_email holger@merlinux.eu
classifiers
  • Development Status :: 6 - Mature
  • Intended Audience :: Developers
  • License :: OSI Approved :: MIT License
  • Operating System :: POSIX
  • Operating System :: Microsoft :: Windows
  • Operating System :: MacOS :: MacOS X
  • Topic :: Software Development :: Testing
  • Topic :: Software Development :: Libraries
  • Topic :: Utilities
  • Programming Language :: Python :: Implementation :: CPython
  • Programming Language :: Python :: Implementation :: PyPy
  • Programming Language :: Python :: 3
  • Programming Language :: Python :: 3 :: Only
  • Programming Language :: Python :: 3.6
  • Programming Language :: Python :: 3.7
  • Programming Language :: Python :: 3.8
  • Programming Language :: Python :: 3.9
description_content_type text/x-rst
license MIT
provides_extras testing
requires_dist
  • importlib-metadata (>=0.12) ; python_version < "3.8"
  • pre-commit ; extra == 'dev'
  • tox ; extra == 'dev'
  • pytest ; extra == 'testing'
  • pytest-benchmark ; extra == 'testing'
requires_python >=3.6
File Tox results History
pluggy-1.0.0-py2.py3-none-any.whl
Size
13 KB
Type
Python Wheel
Python
2.7

pypi conda-forge versions github-actions Join the chat at https://gitter.im/pytest-dev/pluggy black Code coverage Status

This is the core framework used by the pytest, tox, and devpi projects.

Please read the docs to learn more!

A definitive example

import pluggy

hookspec = pluggy.HookspecMarker("myproject")
hookimpl = pluggy.HookimplMarker("myproject")


class MySpec:
    """A hook specification namespace."""

    @hookspec
    def myhook(self, arg1, arg2):
        """My special little hook that you can customize."""


class Plugin_1:
    """A hook implementation namespace."""

    @hookimpl
    def myhook(self, arg1, arg2):
        print("inside Plugin_1.myhook()")
        return arg1 + arg2


class Plugin_2:
    """A 2nd hook implementation namespace."""

    @hookimpl
    def myhook(self, arg1, arg2):
        print("inside Plugin_2.myhook()")
        return arg1 - arg2


# create a manager and add the spec
pm = pluggy.PluginManager("myproject")
pm.add_hookspecs(MySpec)

# register plugins
pm.register(Plugin_1())
pm.register(Plugin_2())

# call our ``myhook`` hook
results = pm.hook.myhook(arg1=1, arg2=2)
print(results)

Running this directly gets us:

$ python docs/examples/toy-example.py
inside Plugin_2.myhook()
inside Plugin_1.myhook()
[-1, 3]