Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sphinx docs #39

Merged
merged 5 commits into from
Feb 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,15 @@ Plugin registration and hook calling for Python
.. image:: https://img.shields.io/appveyor/ci/pytestbot/pluggy/master.svg
:target: https://ci.appveyor.com/project/pytestbot/pluggy

This is the plugin manager as used by [pytest](http://pytest.org), [tox](https://tox.readthedocs.org), [devpi](http://doc.devpi.net) and probably other projects.
This is the core plugin system used by the `pytest`_, `tox`_, and `devpi`_ projects.
Please `read the docs`_ to learn more!

During the 0.x series this plugin does not have much documentation
except extensive docstrings in the pluggy.py module.
.. links
.. _pytest:
http://pytest.org
.. _tox:
https://tox.readthedocs.org
.. _devpi:
http://doc.devpi.net
.. _read the docs:
https://pluggy.readthedocs.io/en/latest/
Binary file added docs/_static/img/plug.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 0 additions & 4 deletions docs/api_reference.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@


Api Reference
=============

.. automodule:: pluggy
:members:
:undoc-members:
:show-inheritance:


12 changes: 12 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,19 @@
language = None

pygments_style = 'sphinx'
html_logo = '_static/img/plug.png'
html_theme = 'alabaster'
html_theme_options = {
# 'logo': 'img/plug.png',
# 'logo_name': 'true',
'description': 'The `pytest` plugin system',
'github_user': 'pytest-dev',
'github_repo': 'pluggy',
'github_button': 'true',
'github_banner': 'true',
'page_width': '1080px',
'fixed_sidebar': 'false',
}
html_static_path = ['_static']

# One entry per manual page. List of tuples
Expand Down
44 changes: 44 additions & 0 deletions docs/examples/firstexample.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
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)
Loading