在Python程序中使用插件的库。

ZS-PluginManager的Python项目详细描述


ZS插件管理器

PluginManager在项目中使用入口点

使用

进口

from zs_pluginmanager.manager import PluginManager

加载插件(入口点)

^{pr2}$

显示加载的插件(入口点)

全部

print("print all plugins (entry-points):")
for plugin in plugins_manager:
    print("", plugin.name, plugin.plugin)

输出:

print all plugins (entry-points):
 alias <class 'setuptools.command.alias.alias'>
 bdist_egg <class 'setuptools.command.bdist_egg.bdist_egg'>
 bdist_rpm <class 'setuptools.command.bdist_rpm.bdist_rpm'>
 bdist_wininst <class 'setuptools.command.bdist_wininst.bdist_wininst'>
 build_clib <class 'setuptools.command.build_clib.build_clib'>
 build_ext <class 'setuptools.command.build_ext.build_ext'>
 build_py <class 'setuptools.command.build_py.build_py'>
 develop <class 'setuptools.command.develop.develop'>
 dist_info <class 'setuptools.command.dist_info.dist_info'>
 easy_install <class 'setuptools.command.easy_install.easy_install'>
 egg_info <class 'setuptools.command.egg_info.egg_info'>
 install <class 'setuptools.command.install.install'>
 install_egg_info <class 'setuptools.command.install_egg_info.install_egg_info'>
 install_lib <class 'setuptools.command.install_lib.install_lib'>
 install_scripts <class 'setuptools.command.install_scripts.install_scripts'>
 rotate <class 'setuptools.command.rotate.rotate'>
 saveopts <class 'setuptools.command.saveopts.saveopts'>
 sdist <class 'setuptools.command.sdist.sdist'>
 setopt <class 'setuptools.command.setopt.setopt'>
 test <class 'setuptools.command.test.test'>
 upload_docs <class 'setuptools.command.upload_docs.upload_docs'>
 bdist_wheel <class 'wheel.bdist_wheel.bdist_wheel'>
 convert_2to3_doctests <function assert_string_list at 0x000001A90BCDF160>
 dependency_links <function assert_string_list at 0x000001A90BCDF160>
 eager_resources <function assert_string_list at 0x000001A90BCDF160>
 entry_points <function check_entry_points at 0x000001A90BCDF550>
 exclude_package_data <function check_package_data at 0x000001A90BCDF670>
 extras_require <function check_extras at 0x000001A90BCDF280>
 include_package_data <function assert_bool at 0x000001A90BCDF3A0>
 install_requires <function check_requirements at 0x000001A90BCDF430>
 namespace_packages <function check_nsp at 0x000001A90BCDF1F0>
 package_data <function check_package_data at 0x000001A90BCDF670>
 packages <function check_packages at 0x000001A90BCDF700>
 python_requires <function check_specifier at 0x000001A90BCDF4C0>
 setup_requires <function check_requirements at 0x000001A90BCDF430>
 test_loader <function check_importable at 0x000001A90BCDF0D0>
 test_runner <function check_importable at 0x000001A90BCDF0D0>
 test_suite <function check_test_suite at 0x000001A90BCDF5E0>
 tests_require <function check_requirements at 0x000001A90BCDF430>
 use_2to3 <function assert_bool at 0x000001A90BCDF3A0>
 use_2to3_exclude_fixers <function assert_string_list at 0x000001A90BCDF160>
 use_2to3_fixers <function assert_string_list at 0x000001A90BCDF160>
 zip_safe <function assert_bool at 0x000001A90BCDF3A0>

仅选择

print("print selected entry-points by label:")
for plugin in plugins_manager.filter(label="commands"):
    print("", plugin.name, plugin.plugin)

输出:

print selected entry-points by label:
 alias <class 'setuptools.command.alias.alias'>
 bdist_egg <class 'setuptools.command.bdist_egg.bdist_egg'>
 bdist_rpm <class 'setuptools.command.bdist_rpm.bdist_rpm'>
 bdist_wininst <class 'setuptools.command.bdist_wininst.bdist_wininst'>
 build_clib <class 'setuptools.command.build_clib.build_clib'>
 build_ext <class 'setuptools.command.build_ext.build_ext'>
 build_py <class 'setuptools.command.build_py.build_py'>
 develop <class 'setuptools.command.develop.develop'>
 dist_info <class 'setuptools.command.dist_info.dist_info'>
 easy_install <class 'setuptools.command.easy_install.easy_install'>
 egg_info <class 'setuptools.command.egg_info.egg_info'>
 install <class 'setuptools.command.install.install'>
 install_egg_info <class 'setuptools.command.install_egg_info.install_egg_info'>
 install_lib <class 'setuptools.command.install_lib.install_lib'>
 install_scripts <class 'setuptools.command.install_scripts.install_scripts'>
 rotate <class 'setuptools.command.rotate.rotate'>
 saveopts <class 'setuptools.command.saveopts.saveopts'>
 sdist <class 'setuptools.command.sdist.sdist'>
 setopt <class 'setuptools.command.setopt.setopt'>
 test <class 'setuptools.command.test.test'>
 upload_docs <class 'setuptools.command.upload_docs.upload_docs'>
 bdist_wheel <class 'wheel.bdist_wheel.bdist_wheel'>

限制

钥匙PluginManager.plugins插件应唯一于(命名空间,项_点.名称,标签,本地)。
如果入口点的一个名称在多个不同的组中,则该名称将多次出现。
要找到准确的pligun,请使用插件_管理器.过滤器()根据不同的选项过滤插件。在

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java无法将自定义数据类型转换为字符串?   JavaLog4j和appender,这个Log4j定义正确吗?   用于换行的java Android Eclipse拆分   与某个方法关联的java启用/禁用JButton   java小部件列表视图加载视图   java国家/地区名称中的正则表达式   从Java调用Kotlin时,如何获取错误的行号?   java将视图传递给AsyncTask以访问findViewById   java SQL性能:多个绑定还是绑定到一个SQL变量以供重用?   BluetoothAdapter上的安卓 Java NullPointerException。isEnabled()   在clojure中取消引用java方法   JAVA网SocketException:IP_添加_成员身份失败(硬件筛选器不足?)   java从类对象的方法接收nullpointer异常   java使用for循环创建多个对象   java无法使用NTLM身份验证apache camel cxf   java Eclipse不喜欢@Override注释   java Spark SQL模拟红移(Oracle)“系统日期”或“当前日期”