Discussion:
[PEAK] [AddOn] conceptual thinkings
c***@posteo.jp
2015-12-19 16:24:50 UTC
Permalink
I try to understand the AddOn package for Python3 and think about if
this would be a solution for my very simple problem or if it is a
little bit to much.

I have a simple script opening a zip-file an "doing something" on each
file in there. Thats it. What is done there should be specified by a
AddOn/PlugIn.

Currently I just have some functions in my code like this:
def do_X()
def do_Y()
def do_Z()
and I simply assign their names to my main-function in the same py-file.

do = do_Y
do()

I want to call my script like that

:/myscript.py file.zip --addon MyY

What would you suggest?
--
GnuPGP-Key ID 0751A8EC
PJ Eby
2015-12-19 18:39:23 UTC
Permalink
I think you would be better off with the Plugins package (
https://pypi.python.org/pypi/Plugins ) rather than the AddOns package.
Or you might find it simpler to use pkg_resources entry points
directly.

All of this assumes that your goal is to support the distribution of
*separate packages* which provide actions from your script. If all
the possible actions are distributed with the script, then there is
little point to using any of this. Entry points provide a way to
discover what plugin packages have been installed, the Plugins package
provides a framework for co-ordinating multiple hooks (e.g. a set of
plugins that add menu items to a GUI), and the AddOns package is for
attaching extra data and methods to arbitrary objects, without
namespace clashes. None of these sound like what you're looking for,
unless you wish to allow others to write plugins for your script, or
you plan to distribute your own plugins as separately-installed
packages.
Post by c***@posteo.jp
I try to understand the AddOn package for Python3 and think about if
this would be a solution for my very simple problem or if it is a
little bit to much.
I have a simple script opening a zip-file an "doing something" on each
file in there. Thats it. What is done there should be specified by a
AddOn/PlugIn.
def do_X()
def do_Y()
def do_Z()
and I simply assign their names to my main-function in the same py-file.
do = do_Y
do()
I want to call my script like that
:/myscript.py file.zip --addon MyY
What would you suggest?
--
GnuPGP-Key ID 0751A8EC
_______________________________________________
PEAK mailing list
http://www.eby-sarna.com/mailman/listinfo/peak
Loading...