move documentation into the new standard layout
Change-Id: Id5ae008eab8e52d8943659b809ed1bcd996e0794 Signed-off-by: Doug Hellmann <doug@doughellmann.com>
@@ -1 +0,0 @@
|
|||||||
.. include:: ../../ChangeLog
|
|
||||||
@@ -12,29 +12,18 @@ for managing entry points tends to be repetitive, though, so stevedore
|
|||||||
provides manager classes for implementing common patterns for using
|
provides manager classes for implementing common patterns for using
|
||||||
dynamically loaded extensions.
|
dynamically loaded extensions.
|
||||||
|
|
||||||
Contents:
|
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:glob:
|
:glob:
|
||||||
:maxdepth: 2
|
:maxdepth: 2
|
||||||
|
|
||||||
patterns_loading
|
user/index
|
||||||
patterns_enabling
|
reference/index
|
||||||
tutorial/index
|
install/index
|
||||||
managers
|
|
||||||
sphinxext
|
|
||||||
install
|
|
||||||
essays/*
|
|
||||||
|
|
||||||
.. toctree::
|
|
||||||
:maxdepth: 1
|
|
||||||
|
|
||||||
history
|
|
||||||
|
|
||||||
.. _setuptools entry points: http://setuptools.readthedocs.io/en/latest/pkg_resources.html?#entry-points
|
.. _setuptools entry points: http://setuptools.readthedocs.io/en/latest/pkg_resources.html?#entry-points
|
||||||
|
|
||||||
Indices and tables
|
.. rubric:: Indices and tables
|
||||||
==================
|
|
||||||
|
|
||||||
* :ref:`genindex`
|
* :ref:`genindex`
|
||||||
* :ref:`search`
|
* :ref:`search`
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 92 KiB After Width: | Height: | Size: 92 KiB |
|
Before Width: | Height: | Size: 84 KiB After Width: | Height: | Size: 84 KiB |
|
Before Width: | Height: | Size: 88 KiB After Width: | Height: | Size: 88 KiB |
|
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 70 KiB |
|
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 85 KiB |
|
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 80 KiB |
|
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 76 KiB |
@@ -476,5 +476,5 @@ patterns.
|
|||||||
|
|
||||||
* PyCon 2013 Video: http://pyvideo.org/video/1789/dynamic-code-patterns-extending-your-application
|
* PyCon 2013 Video: http://pyvideo.org/video/1789/dynamic-code-patterns-extending-your-application
|
||||||
* Slides: http://www.slideshare.net/doughellmann/dynamic-codepatterns
|
* Slides: http://www.slideshare.net/doughellmann/dynamic-codepatterns
|
||||||
* :doc:`/patterns_loading`
|
* :doc:`/user/patterns_loading`
|
||||||
* :doc:`/patterns_enabling`
|
* :doc:`/user/patterns_enabling`
|
||||||
5
doc/source/user/history.rst
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
===========
|
||||||
|
ChangeLog
|
||||||
|
===========
|
||||||
|
|
||||||
|
.. include:: ../../../ChangeLog
|
||||||
14
doc/source/user/index.rst
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
======================
|
||||||
|
stevedore User Guide
|
||||||
|
======================
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:glob:
|
||||||
|
:maxdepth: 2
|
||||||
|
|
||||||
|
patterns_loading
|
||||||
|
patterns_enabling
|
||||||
|
tutorial/index
|
||||||
|
sphinxext
|
||||||
|
essays/*
|
||||||
|
history
|
||||||
@@ -35,7 +35,7 @@ A Plugin Base Class
|
|||||||
Step 1 above is to define an abstract base class for the API that
|
Step 1 above is to define an abstract base class for the API that
|
||||||
needs to be implemented by each plugin.
|
needs to be implemented by each plugin.
|
||||||
|
|
||||||
.. literalinclude:: ../../../stevedore/example/base.py
|
.. literalinclude:: ../../../../stevedore/example/base.py
|
||||||
:language: python
|
:language: python
|
||||||
:prepend: # stevedore/example/base.py
|
:prepend: # stevedore/example/base.py
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ The next step is to create a couple of plugin classes with concrete
|
|||||||
implementations of :func:`format`. A simple example formatter produces
|
implementations of :func:`format`. A simple example formatter produces
|
||||||
output with each variable name and value on a single line.
|
output with each variable name and value on a single line.
|
||||||
|
|
||||||
.. literalinclude:: ../../../stevedore/example/simple.py
|
.. literalinclude:: ../../../../stevedore/example/simple.py
|
||||||
:language: python
|
:language: python
|
||||||
:prepend: # stevedore/example/simple.py
|
:prepend: # stevedore/example/simple.py
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ plugins are formatters from the stevedore examples, so I will use the
|
|||||||
namespace "stevedore.example.formatter". Now it is possible to provide
|
namespace "stevedore.example.formatter". Now it is possible to provide
|
||||||
all of the necessary information in the packaging instructions:
|
all of the necessary information in the packaging instructions:
|
||||||
|
|
||||||
.. literalinclude:: ../../../stevedore/example/setup.py
|
.. literalinclude:: ../../../../stevedore/example/setup.py
|
||||||
:language: python
|
:language: python
|
||||||
:prepend: # stevedore/example/setup.py
|
:prepend: # stevedore/example/setup.py
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ where *name* is the user-visible name for the plugin, *module* is the
|
|||||||
Python import reference for the module, and *importable* is the name
|
Python import reference for the module, and *importable* is the name
|
||||||
of something that can be imported from inside the module.
|
of something that can be imported from inside the module.
|
||||||
|
|
||||||
.. literalinclude:: ../../../stevedore/example/setup.py
|
.. literalinclude:: ../../../../stevedore/example/setup.py
|
||||||
:language: python
|
:language: python
|
||||||
:lines: 37-43
|
:lines: 37-43
|
||||||
|
|
||||||
@@ -131,26 +131,26 @@ package the code for the plugin should live in.
|
|||||||
For example, we can add an alternate implementation of a formatter
|
For example, we can add an alternate implementation of a formatter
|
||||||
plugin that produces a reStructuredText `field list`_.
|
plugin that produces a reStructuredText `field list`_.
|
||||||
|
|
||||||
.. literalinclude:: ../../../stevedore/example2/fields.py
|
.. literalinclude:: ../../../../stevedore/example2/fields.py
|
||||||
:language: python
|
:language: python
|
||||||
:prepend: # stevedore/example2/fields.py
|
:prepend: # stevedore/example2/fields.py
|
||||||
|
|
||||||
The new plugin can then be packaged using a ``setup.py`` containing
|
The new plugin can then be packaged using a ``setup.py`` containing
|
||||||
|
|
||||||
.. literalinclude:: ../../../stevedore/example2/setup.py
|
.. literalinclude:: ../../../../stevedore/example2/setup.py
|
||||||
:language: python
|
:language: python
|
||||||
:prepend: # stevedore/example2/setup.py
|
:prepend: # stevedore/example2/setup.py
|
||||||
|
|
||||||
The new plugin is in a separate ``stevedore-examples2`` package.
|
The new plugin is in a separate ``stevedore-examples2`` package.
|
||||||
|
|
||||||
.. literalinclude:: ../../../stevedore/example2/setup.py
|
.. literalinclude:: ../../../../stevedore/example2/setup.py
|
||||||
:language: python
|
:language: python
|
||||||
:lines: 3-4
|
:lines: 3-4
|
||||||
|
|
||||||
However, the plugin is registered as part of the
|
However, the plugin is registered as part of the
|
||||||
``stevedore.example.formatter`` namespace.
|
``stevedore.example.formatter`` namespace.
|
||||||
|
|
||||||
.. literalinclude:: ../../../stevedore/example2/setup.py
|
.. literalinclude:: ../../../../stevedore/example2/setup.py
|
||||||
:language: python
|
:language: python
|
||||||
:lines: 36-40
|
:lines: 36-40
|
||||||
|
|
||||||
@@ -16,7 +16,7 @@ application.
|
|||||||
|
|
||||||
.. seealso::
|
.. seealso::
|
||||||
|
|
||||||
* :doc:`/essays/pycon2013`
|
* :doc:`../essays/pycon2013`
|
||||||
* `Using setuptools entry points`_
|
* `Using setuptools entry points`_
|
||||||
* `Package Discovery and Resource Access using pkg_resources`_
|
* `Package Discovery and Resource Access using pkg_resources`_
|
||||||
* `Using Entry Points to Write Plugins | Pylons`_
|
* `Using Entry Points to Write Plugins | Pylons`_
|
||||||
@@ -17,7 +17,7 @@ This example program uses a :class:`DriverManager` to load a formatter
|
|||||||
defined in the examples for stevedore. It then uses the formatter to
|
defined in the examples for stevedore. It then uses the formatter to
|
||||||
convert a data structure to a text format, which it can print.
|
convert a data structure to a text format, which it can print.
|
||||||
|
|
||||||
.. literalinclude:: ../../../stevedore/example/load_as_driver.py
|
.. literalinclude:: ../../../../stevedore/example/load_as_driver.py
|
||||||
:language: python
|
:language: python
|
||||||
:prepend: # stevedore/example/load_as_driver.py
|
:prepend: # stevedore/example/load_as_driver.py
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ registered as a formatter. The ``invoke_args`` are positional
|
|||||||
arguments passed to the class constructor, and are used to set the
|
arguments passed to the class constructor, and are used to set the
|
||||||
maximum width parameter.
|
maximum width parameter.
|
||||||
|
|
||||||
.. literalinclude:: ../../../stevedore/example/load_as_driver.py
|
.. literalinclude:: ../../../../stevedore/example/load_as_driver.py
|
||||||
:language: python
|
:language: python
|
||||||
:lines: 30-35
|
:lines: 30-35
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ from the plugin. The single driver can be accessed via the
|
|||||||
:attr:`driver` property of the manager, and then its methods can be
|
:attr:`driver` property of the manager, and then its methods can be
|
||||||
called directly.
|
called directly.
|
||||||
|
|
||||||
.. literalinclude:: ../../../stevedore/example/load_as_driver.py
|
.. literalinclude:: ../../../../stevedore/example/load_as_driver.py
|
||||||
:language: python
|
:language: python
|
||||||
:lines: 36-37
|
:lines: 36-37
|
||||||
|
|
||||||
@@ -57,7 +57,7 @@ support this invocation pattern, including
|
|||||||
:class:`~stevedore.named.NamedExtensionManager`, and
|
:class:`~stevedore.named.NamedExtensionManager`, and
|
||||||
:class:`~stevedore.enabled.EnabledExtensionManager`.
|
:class:`~stevedore.enabled.EnabledExtensionManager`.
|
||||||
|
|
||||||
.. literalinclude:: ../../../stevedore/example/load_as_extension.py
|
.. literalinclude:: ../../../../stevedore/example/load_as_extension.py
|
||||||
:language: python
|
:language: python
|
||||||
:prepend: # stevedore/example/load_as_extension.py
|
:prepend: # stevedore/example/load_as_extension.py
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ The :class:`ExtensionManager` is created slightly differently from the
|
|||||||
:class:`DriverManager` because it does not need to know in advance
|
:class:`DriverManager` because it does not need to know in advance
|
||||||
which plugin to load. It loads all of the plugins it finds.
|
which plugin to load. It loads all of the plugins it finds.
|
||||||
|
|
||||||
.. literalinclude:: ../../../stevedore/example/load_as_extension.py
|
.. literalinclude:: ../../../../stevedore/example/load_as_extension.py
|
||||||
:language: python
|
:language: python
|
||||||
:lines: 24-28
|
:lines: 24-28
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ with :meth:`map` in this example takes two arguments, the
|
|||||||
:class:`~stevedore.extension.Extension` and the data argument given to
|
:class:`~stevedore.extension.Extension` and the data argument given to
|
||||||
:meth:`map`.
|
:meth:`map`.
|
||||||
|
|
||||||
.. literalinclude:: ../../../stevedore/example/load_as_extension.py
|
.. literalinclude:: ../../../../stevedore/example/load_as_extension.py
|
||||||
:language: python
|
:language: python
|
||||||
:lines: 30-33
|
:lines: 30-33
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ the extension name and the iterable that produces the text to
|
|||||||
print. As the results are processed, the name of each plugin is
|
print. As the results are processed, the name of each plugin is
|
||||||
printed and then the formatted data.
|
printed and then the formatted data.
|
||||||
|
|
||||||
.. literalinclude:: ../../../stevedore/example/load_as_extension.py
|
.. literalinclude:: ../../../../stevedore/example/load_as_extension.py
|
||||||
:language: python
|
:language: python
|
||||||
:lines: 35-39
|
:lines: 35-39
|
||||||
|
|
||||||
@@ -122,5 +122,5 @@ achieve different goals.
|
|||||||
|
|
||||||
.. seealso::
|
.. seealso::
|
||||||
|
|
||||||
* :doc:`/patterns_loading`
|
* :doc:`../patterns_loading`
|
||||||
* :doc:`/patterns_enabling`
|
* :doc:`../patterns_enabling`
|
||||||