Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #92684

Re: Pyitect - Plugin architectural system for Python 3.0+ (feedback?)

Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'skip:[ 20': 0.03; 'url:pypi': 0.03; 'subject:Python': 0.05; 'defaults': 0.05; 'attributes': 0.07; 'dependency': 0.07; 'prefix': 0.07; 'pypi': 0.07; 'versions.': 0.07; '###': 0.09; 'cleaned': 0.09; 'imports': 0.09; 'namespace': 0.09; 'subject:skip:a 10': 0.09; 'url:github': 0.09; 'python': 0.11; 'python.': 0.11; 'package,': 0.13; 'read.': 0.13; 'def': 0.14; '__init__.py': 0.16; 'another?': 0.16; 'distinction': 0.16; 'instantiate': 0.16; 'mine.': 0.16; 'otherwise:': 0.16; 'relatives': 0.16; 'subject:?)': 0.16; 'sys.modules': 0.16; 'sys.path': 0.16; 'url:display': 0.16; 'developer': 0.16; 'wrote:': 0.16; 'example.': 0.18; 'input': 0.18; 'runs': 0.18; 'load': 0.20; 'versions': 0.20; 'class,': 0.22; 'libraries': 0.22; '2015': 0.23; 'module': 0.23; 'absolute': 0.23; 'component': 0.23; 'errors': 0.23; 'for?': 0.23; 'normally': 0.23; 'sets': 0.23; "i've": 0.24; 'import': 0.24; 'header:In- Reply-To:1': 0.24; 'written': 0.24; 'mon,': 0.24; 'requests': 0.26; 'earlier': 0.27; 'not.': 0.27; 'opposed': 0.27; 'package.': 0.27; 'message-id:@mail.gmail.com': 0.28; "i'm": 0.29; 'appear': 0.29; '(optional)': 0.29; 'enabled': 0.29; 'thinks': 0.29; 'function': 0.30; 'work.': 0.30; 'folder': 0.31; 'mode': 0.31; 'relative': 0.31; 'run': 0.32; "can't": 0.32; 'url:python': 0.33; 'class': 0.33; 'open': 0.33; 'file': 0.34; 'received:google.com': 0.34; 'gives': 0.35; 'drop': 0.35; 'to:addr:python-list': 0.35; 'mapping': 0.35; 'path': 0.35; 'url:action': 0.35; "isn't": 0.35; 'but': 0.36; 'url:org': 0.36; 'project': 0.36; 'there': 0.36; 'thanks': 0.36; 'cases': 0.36; 'loaded': 0.36; 'modules': 0.36; 'quite': 0.37; 'two': 0.37; 'subject:: ': 0.37; 'difference': 0.38; 'version': 0.38; 'feedback': 0.38; 'names': 0.38; 'self': 0.38; 'pm,': 0.39; 'to:addr:python.org': 0.39; 'system.': 0.39; 'where': 0.40; 'your': 0.60; 'even': 0.61; 'simple': 0.61; 'temporarily': 0.61; 'providing': 0.61; 'more': 0.62; 'fire': 0.63; 'course': 0.64; 'different': 0.64; 'forward': 0.65; 'between': 0.65; 'decided': 0.65; 'else.': 0.66; 'day': 0.70; 'useful.': 0.72; 'special': 0.72; 'directly.': 0.76; 'demand': 0.79; '3.4': 0.84; 'plugins': 0.84; 'subject:system': 0.84; 'to:name:python': 0.84; 'won': 0.96
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=1QsqsXReujqxdEIZDbOn50VWh8zkKU+94WCMIgx+KIs=; b=rFIPsDFZYfKEOLy8kti01kRJnjV2vZB1tWwUtdL7I9yiX134S7useiBPtnbOt+0Ad7 waYuksr9RletnqsuHpqq1y5PIqnYuoYw6DZMPFsRUND4v6tlxrFaNaExLbrtMayKL5vJ oVQmkcQAkZPxvbaUGP/llqX9LFbItCRws3mVCXTZF7LQOmIrAN3lszmzFdGTw+fI4Eo3 /BvaASEF+Hi3o4FZMJCd/XxEg7/ma+Mc9E45BFcPpA0JWuIpNf/0R1SrBLjFemfpkdSu b4mwcv0ZA6ZSYEGJb8t+BD15l5vZGxTEzyqxZl9m3bj109IiW3EzU99orinXkmRG4mgC pasg==
X-Received by 10.170.188.206 with SMTP id f197mr1217645yke.63.1434469808156; Tue, 16 Jun 2015 08:50:08 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <CAO-rxQsTP8k_nmaV80Zg2OZnbun040jpYG7_tLQpb-q22V3jSw@mail.gmail.com>
References <CAO-rxQsTP8k_nmaV80Zg2OZnbun040jpYG7_tLQpb-q22V3jSw@mail.gmail.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Tue, 16 Jun 2015 09:49:27 -0600
Subject Re: Pyitect - Plugin architectural system for Python 3.0+ (feedback?)
To Python <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.516.1434469811.13271.python-list@python.org> (permalink)
Lines 94
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1434469811 news.xs4all.nl 2932 [2001:888:2000:d::a6]:54827
X-Complaints-To abuse@xs4all.nl
Path csiph.com!usenet.pasdenom.info!news.stben.net!border1.nntp.ams1.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Xref csiph.com comp.lang.python:92684

Show key headers only | View raw


On Mon, Jun 8, 2015 at 10:42 PM, Ben Powers <ryexander@gmail.com> wrote:
> As importlib has been added in python 3 and up I decided to use it's
> abilities to create a plugin system for truly modular development in python.
>
> Pyitect has the ability to drop in components and resolve dependencies. Even
> load different versions of a dependency if two different libraries require
> two different versions.
>
> Pyitect gives each "plugin" it won private namespace to import the
> components it needs. and nothing else.
>
> Pyitect  organizes it self around the concept of a System. Each system can
> scan and load it's own set of plugins, in each system plugins can be enabled
> individually.
>
> Pyitect even comes with a very simple event system that it uses internal to
> fire event when plugins are found/loaded/ect for the developer to use.
>
> I've written up What I think is a quite comprehensive readme to go with it.
>
> Available on PyPi https://pypi.python.org/pypi?:action=display&name=pyitect
> and Github https://github.com/Ryex/pyitect
>
> I'm looking for feedback on what flaws the system may have and where I can
> improve. I'm always open to pull requests
>
> Looking forward to what the comunity thinks of this little project of mine.
> Thanks for your input and criticism.

You need to run your readme through a spell-check, as it's riddled
with typographical errors and quite hard to read. A grammar check and
a proofreader would also be useful.

> "on_enable": "dostuff.py", // optional, runs this file when the plugin is enabled

A path to a function would feel more Pythonic.

> mode -> (OPTIONAL) defaults to import on python 3.4 and up ecec otherwise: sets the import mode

Do the plugins need to be on the sys.path in order to be imported?

> provides -> a mapping of provided component names to prefix mappings

What are the "prefix mappings" and what are they used for?

> #file.py
> from PyitectConsumes import foo
>
> class Bar(object):
>     def __init__():
>         foo("it's a good day to be a plugin")

I don't understand this example. Is "PyitectConsumes" the name of a
component or part of Pyitect? Or is "foo" the name of the component?

> plugins = [system.plugins[n][v] for n in system.plugins for v in system.plugins[n]]

What are n and v?

> Plugins are loaded on demand when a component is loaded via
>
> System.load("<component name>")

What's the difference between this and the "PyitectConsumes" import?

> ### both in both cases relative imports DO NOT WORK. the plugin folder is temporarily added to the search path so absolute imports work but relatives will not.
>
> UNLESS the name of the file is __init__.py . In this special case the plugin folder is reconsidered as a python package and relative imports work as normal.

Isn't this just how relative imports normally work? Of course you
can't use a relative import outside of a package.

> Loaded pluginss do NOT store their module object in sys.modules

What about imports of plugin-local modules that are performed inside
the plugins? Do those also get cleaned up from sys.modules?

If I have version 1 of a plugin that imports a module from its
package, and version 2 of the same plugin that imports a module from
its package, are those imports going to conflict with one another?

> System.useing
> System.enabeled_plugins

Are these misspellings actually part of the API?

Also, earlier you appeared to instantiate the System class, but now
you appear to be just accessing attributes from the class directly.
What's the distinction between the class-level state and the
instance-level state?

> Providing multiple versions of a component from the same plugin

Is there a reason to do this as opposed to simply providing multiple components?

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Pyitect - Plugin architectural system for Python 3.0+ (feedback?) Ian Kelly <ian.g.kelly@gmail.com> - 2015-06-16 09:49 -0600

csiph-web