如何做 Pylons/Pyramid 插件系统?
有谁知道为塔/金字塔制作插件系统的最佳方法是什么?或者可能是像 yapsy-pylons 这样的例子?
更新: 我写了一个 yapsy 的例子,用于在 pylons 中创建插件。我认为这种方法可以用在其他框架中。 pylons_yapsy_plugin
Does anyone have any ideas what the best way to make a plugin system for pylons/pyramid? Or may be any example like yapsy-pylons?
Upd:
I wrote an example of yapsy for creating plug-ins in the pylons. I think this approach can be used in other frameworks.
pylons_yapsy_plugin
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Pyramid 提供了 config.include('somemodule') 机制,允许插件使用您的应用程序进行自身配置。它还包含对 ZCA 注册表的访问,以便为实用程序和适配器创建插入点。
该框架本身非常非常不固执且灵活,因此如果您不喜欢我上面提到的两个选项,您可能可以使用 yapsy 之类的东西。编写任何类型的插件的关键是找出您的限制,并从那里开始寻求其中一种解决方案。
Pyramid offers the
config.include('somemodule')
mechanism for allowing addons to configure themselves with your application. It also contains access to the ZCA registry to create plug points for utilities and adapters.The framework itself is very very unopinionated and flexible and so you could probably use something like yapsy if you didn't like the 2 options I mentioned above. The key to writing any sort of plugin is to figure out your constraints and work from there toward one of those solutions.