GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - pytest-dev/pluggy: A minimalist production ready plugin system

BranchesTags
Open more actions menu

Latest commit

 

History

1,144 Commits
1,144 Commits

Folders and files

NameName
Last commit message
Last commit date
.claude
.claude
 
 
.github
.github
 
 
changelog
changelog
 
 
docs
docs
 
 
downstream
downstream
 
 
scripts
scripts
 
 
src/pluggy
src/pluggy
 
 
testing
testing
 
 
.coveragerc
.coveragerc
 
 
.git_archival.txt
.git_archival.txt
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
.pre-commit-config.yaml
.pre-commit-config.yaml
 
 
.readthedocs.yml
.readthedocs.yml
 
 
AGENTS.md
AGENTS.md
 
 
CHANGELOG.rst
CHANGELOG.rst
 
 
CLAUDE.md
CLAUDE.md
 
 
LICENSE
LICENSE
 
 
MANIFEST.in
MANIFEST.in
 
 
README.rst
README.rst
 
 
RELEASING.rst
RELEASING.rst
 
 
SECURITY.md
SECURITY.md
 
 
TIDELIFT.rst
TIDELIFT.rst
 
 
codecov.yml
codecov.yml
 
 
pyproject.toml
pyproject.toml
 
 
tox.ini
tox.ini
 
 
uv.lock
uv.lock
 
 

Repository files navigation

pluggy - A minimalist production ready plugin system

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]

Support pluggy

Open Collective is an online funding platform for open and transparent communities. It provides tools to raise money and share your finances in full transparency.

It is the platform of choice for individuals and companies that want to make one-time or monthly donations directly to the project.

pluggy is part of the pytest-dev project, see more details in the pytest collective.

About

A minimalist production ready plugin system

pluggy.readthedocs.io/en/latest/

Topics

hookspython

Resources

Readme
MIT license

Security policy

Security policy
Activity
Custom properties

Stars

1.7k stars

Watchers

19 watching

Forks

198 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.