如何使用 Python setuptools 加载一组已定义的 Egg 的入口点?
我想使用 setuptools 中的入口点功能。
在很多情况下,我想严格控制运行的 Egg 列表,以及有助于一组入口点的扩展:
- egg 集成测试,我想在不同的组合上运行多个测试套件蛋。
- 扫描鸡蛋/插件的单个目录,以便运行同一程序的两个不同实例,但使用不同的鸡蛋。
- 开发时间,我正在开发一个或多个鸡蛋,并希望将程序作为正常编辑运行周期的一部分来运行。
我已经浏览了 setuptools 文档,虽然它并没有说这是不可能的,但我一定错过了一些说明如何做到这一点的内容。
与默认的系统范围发现不同的部署插件的最佳方法是什么?
I would like to use the entry point functionality in setuptools.
There are a number of occasions where I would like to tightly control the list of eggs that are run, and thence the extensions that contribute to a set of entry points:
- egg integration testing, where I want to run multiple test suites on different combinations of eggs.
- scanning a single directory of eggs/plugins so as to run two different instances of the same program, but with different eggs.
- development time, where I am developing one or more egg, and would like to run the program as part of the normal edit-run cycle.
I have looked through the setuptools documentation, and while it doesn't say that this is not possible, I must have missed something saying how to do it.
What is the best way to approach deploying plugins differently to the default system-wide discovery?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我们正在解决类似的问题,如果您只是无法访问全局站点包的用户,则可以使用 setup.py 进行开发。 到目前为止,我们用virtualenv解决了这个问题。
我想说这对您的情况也有帮助:最小化系统范围的安装(或明确排除它),使用您想要的鸡蛋创建虚拟环境并在那里进行测试。
(或者,对于集成测试,创建干净的环境,安装 Egg 并测试所有依赖项是否已安装)。
对于 2,我不确定,但它也应该可以工作,可以使用多个 virtualenv。 对于 3,setup.py 开发是最佳选择。
We're solving something similar, ability to use setup.py develop if You're mere user without access to global site-packages. So far, we solved it with virtualenv.
I'd say it will help for your case too: have minimal system-wide install (or explicitly exclude it), create virtual environment with eggs you want and test there.
(Or, for integration tests, create clean environment, install egg and test all dependencies are installed).
For 2, I'm not sure, but it should work too, with multiple virtualenvs. For 3, setup.py develop is the way to go.