Skip to content

Commit 2ad3356

Browse files
committed
WARNING: broken, partial merge with default
--HG-- branch : python3-transition rename : package/test/main.py => package/runtests.py
2 parents e8dd684 + e46d099 commit 2ad3356

33 files changed

+2165
-584
lines changed

.hgignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
# use glob syntax.
55
syntax: glob
66
_build/*
7+
.project

package/CHANGELOG.txt

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
version-1.9.2 [2012-07-15]
2+
3+
- packaging fixes and strange version bumps to workaround pypi.python.org's version handling
4+
5+
version-1.9 [2011-12-23]
6+
7+
- ability to load zipped plugins
8+
- a separate development branch has been created where the focus is on the compatibility with python3
9+
- no more SVN repository (as advertised last year it wasn't kept in sync with the Mercurial repository, and it is now officially dead)
10+
- better logging of errors and debug infos
11+
- small doc improvement, especially to show how simple it is to interactwith the plugins once they are loaded
12+
13+
version-1.8 [2010-09-26]
14+
15+
- the documentation has been refactored and should now go "straight to the point"
16+
- the source control is now performed by Mercurial
17+
- Filtering manager to filter out plugins that must not be loaded, contributed by Roger Gammans
18+
- a getAllPlugins method has been added to the PluginManager to make it easier to access plugins when only the default category is defined
19+
- code has been slightly cleaned up and should now be easy to adapt to Python3 via the 2to3 tool.
20+
21+
version-1.7 [2008-04-09]
22+
23+
- WARNING: API BREAK ! the arguments for [de]activatePluginByName and getPluginByName are now the other way round: category,name -> name,category="Default"
24+
- new AutoInstall manager for automatically installing plugins by copying them in proper place
25+
- small improvements to generic code for plugin loading
26+
27+
version-1.6 [2007-11-10]
28+
29+
- fix major bug in ConfigurablePluginManager
30+
31+
version-1.5 [2007-11-03]
32+
33+
- separation of plugin loading into locate and load contributed by Rob McMullen
34+
- package with "Easy install" framework
35+
- new forge (https://sourceforge.net/p/yapsy) and independent repo from mathbench
36+
37+
version-1.1 [2007-09-21]
38+
39+
- VersionedPlugin manager contributed by Rob McMullen
40+
41+
version-1.0 [2007-08-26]
42+
43+
- basic implementation of a PluginManager
44+
- ConfigurablePlugin manager that can store information in a ConfigParser compatible file
45+
- singleton versions of these plugin managers.

package/README.txt

+1
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ List of Contributors:
2626
- Thibauld Nion
2727
- Rob McMullen
2828
- Roger Gammans
29+
- Mathieu Havel

package/TODO.txt

+31
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,37 @@
22
TODO
33
======
44

5+
Next Release
56

67
- follow evolutions from default branch
8+
x doc: sample code for filtering plugins
9+
x code: [feature req.] Allow to locate and describe plugins without a separated file (use strategies to change the way plugins are "descried" cf contrib. mhavel)
10+
x code: [contrib. mathieu Clabaut] multiple categories per plugin (cf https://bitbucket.org/matclab/yapsy-mcl)
11+
x doc: highlight the existence of tutorial and link to these ones:
12+
* http://www.micahcarrick.com/python-gtk-plugins-with-yapsy.html
13+
* http://stackoverflow.com/questions/5333128/yapsy-minimal-example
14+
x code: [feature req.] Gather detailed information on plugin load error via a callback
15+
x code: [feature req.] Extra info to plug-in (eg add extra section or embed the ConfigParser output to the plugin_info), see also https://github.com/tintinweb/yapsy
16+
x code: [feature req.] "locatePlugins() toggle between os.walk() and absolute path"
17+
x code: [bug] Enforce a same tab convention everywhere
18+
x code: [contrib. Mark Fickett] improve logging
19+
x doc: [feature req.] Plugin installation/​management with python packages
20+
x code: [bug] No traceback hen plugin throws an exception
21+
x doc: quote more projects using yapsy:
22+
* http://gbin.github.com/err/
23+
* http://nikola.ralsina.com.ar/
24+
x doc: show the logging snippet on front page
25+
x doc: explain tricks about categorization with inheritance (if several categories: make sublcasses of IPlugin instead of using it directly)
26+
x doc: documentation tab convention in a developer's section
27+
- doc: add a CHANGELOG.txt file
728

29+
Later
30+
31+
32+
33+
Next Refactoring
34+
35+
- code: consider making the filter and versionned plugin into plugin manager child classes (instead of decorators), err or maybe strategies ?
36+
- code: find a correct design to make extending the plugin "loading" easier and chainable (policies/mixins, traits ?)
37+
- code: [feature req.] Reloadable configuration for plugins
38+
- code: [feature req.] Allow Decorators to extend gatherPluginInfo

package/doc/Advices.rst

+105
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
===================================
2+
General advices and troubleshooting
3+
===================================
4+
5+
.. contents::
6+
:local:
7+
8+
9+
Getting code samples
10+
--------------------
11+
12+
Yapsy is used enough for your favorite search provider to have good
13+
chances of finding some examples of yapsy being used in the wild.
14+
15+
However if you wonder how a specific functionality can be used, you
16+
can also look at the corresponding unit test (in the test folder
17+
packaged with yapsy's sources).
18+
19+
20+
Use the logging system
21+
----------------------
22+
23+
Yapsy uses Python's standard ``logging`` module to record most
24+
important events and especially plugin loading failures.
25+
26+
When developping an application based on yapsy, you'll benefit from
27+
looking at the 'debug' level logs, which can easily be done from your
28+
application code with the following snippet::
29+
30+
import logging
31+
logging.basicConfig(level=logging.DEBUG)
32+
33+
Also, please note that yapsy uses a named logger for all its logs, so
34+
that you can selectively activage debug logs for yapsy with the
35+
following snippet::
36+
37+
import logging
38+
logging.getLogger('yapsy').setLevel(logging.DEBUG)
39+
40+
41+
Categorization and inheritance caveat
42+
-------------------------------------
43+
44+
If your application defines various categories of plugins with the yapsy's built-in mechanism for that, please keep in mind the following facts:
45+
46+
- a plugin instance is attributed to a given category by looking if
47+
it is an instance, *even via a subclass*, of the class associated
48+
to this category;
49+
- a plugin may be attributed to several categories.
50+
51+
Considering this, and if you consider using several categories, you
52+
should consider the following tips:
53+
54+
- **don't associate any category to ``IPlugin``** (unless you want
55+
all plugins to be attributed to the corresponding category)
56+
- **design a specific subclass** of ``IPlugin`` for each category
57+
- if you want to regroup plugins of some categories into a common
58+
category: do this by attributing a subclass of ``IPlugin`` to the
59+
common category and attribute to the other categories specific
60+
subclasses to this intermediate mother class so that **the plugin
61+
class inheritance hierarchy reflects the hierarchy between
62+
categories** (and if you want something more complex that a
63+
hierarchy, you can consider using mixins).
64+
65+
66+
Plugin packaging
67+
----------------
68+
69+
When packaging plugins in a distutils installer or as parts of an
70+
application (like for instance with `py2exe`), you may want to take
71+
care about the following points:
72+
73+
- when you set specific directories where to look for plugins with a
74+
hardcoded path, be very carefully about the way you write these
75+
paths because depending on the cases **using ``__file__`` or
76+
relative paths may be unreliable**. For instance with py2exe, you
77+
may want to follow the tips from the `Where Am I FAQ`_.
78+
79+
- you'd should either **package the plugins as plain Python modules or
80+
data files** (if you want to consider you application as the only
81+
module), either using the dedicated `setup` argument for `py2exe` or
82+
using distutils' `MANIFEST.in`
83+
84+
- if you do package the plugins as data files, **make sure that their
85+
dependencies are correctly indicated as dependencies of your
86+
package** (or packaged with you application if you use `py2exe`).
87+
88+
See also a more detailed example for py2exe on `Simon on Tech's Using python plugin scripts with py2exe`_.
89+
90+
.. _`Where Am I FAQ`: http://www.py2exe.org/index.cgi/WhereAmI
91+
.. _`Simon on Tech's Using python plugin scripts with py2exe`: http://notinthestars.blogspot.com.es/2011/04/using-python-plugin-scripts-with-py2exe.html
92+
93+
94+
Code conventions
95+
----------------
96+
97+
If you intend to modify yapsy's sources and to contribute patches
98+
back, please respect the following conventions:
99+
100+
- CamelCase (upper camel case) for class names and functions
101+
- camelCase (lower camel case) for methods
102+
- UPPERCASE for global variables (with a few exceptions)
103+
- tabulations are used for indentation (and not spaces !)
104+
- unit-test each new functionality
105+

package/doc/Extensions.rst

+23-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
==========
2-
Extensions
3-
==========
1+
===================
2+
Built-in Extensions
3+
===================
44

5-
Several built-in extensions will help you getting a functional plugin
6-
system:
5+
The followig ready-to-use classes give you this exact extra
6+
functionality you need for your plugin manager:
77

88

99
.. toctree::
@@ -14,3 +14,21 @@ system:
1414
AutoInstallPluginManager
1515
FilteredPluginManager
1616

17+
18+
The following item offer customization for the way plugins are
19+
described and detected:
20+
21+
.. toctree::
22+
:maxdepth: 1
23+
24+
PluginFileLocator
25+
26+
27+
If you want to build your own extensions, have a look at the following
28+
interfaces:
29+
30+
.. toctree::
31+
:maxdepth: 1
32+
33+
IPluginLocator
34+
PluginManagerDecorator

package/doc/IPluginLocator.rst

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
IPluginLocator
2+
==============
3+
4+
.. automodule:: yapsy.IPluginLocator
5+
:members:
6+
:undoc-members:

package/doc/PluginFileLocator.rst

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
PluginFileLocator
2+
=================
3+
4+
.. automodule:: yapsy.PluginFileLocator
5+
:members:
6+
:undoc-members:

0 commit comments

Comments
 (0)