将python库/应用程序打包为.egg文件有什么优势? [英] What are the advantages of packaging your python library/application as an .egg file?

查看:88
本文介绍了将python库/应用程序打包为.egg文件有什么优势?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读了一些有关.egg文件的信息,并且在我的lib目录中注意到了它们,但是使用then作为开发人员的优点/缺点是什么?

I've read some about .egg files and I've noticed them in my lib directory but what are the advantages/disadvantages of using then as a developer?

推荐答案

来自 Python Enterprise Application Kit社区:

鸡蛋就像Python一样,jar就像Java一样……"

Python鸡蛋是捆绑的一种方式 使用Python的其他信息 项目,允许该项目的 要检查的依赖项和 在运行时以及 允许项目提供插件 对于其他项目.有几种 包含鸡蛋的二进制格式,但是 最常见的是'.egg'压缩文件 格式,因为它是一种方便的格式 用于分发项目.全部 格式支持包括 特定于包的数据,在整个项目范围内 元数据,C扩展和Python 代码.

Python eggs are a way of bundling additional information with a Python project, that allows the project's dependencies to be checked and satisfied at runtime, as well as allowing projects to provide plugins for other projects. There are several binary formats that embody eggs, but the most common is '.egg' zipfile format, because it's a convenient one for distributing projects. All of the formats support including package-specific data, project-wide metadata, C extensions, and Python code.

Python Eggs的主要好处 是:

The primary benefits of Python Eggs are:

  • 它们启用诸如轻松安装" Python软件包管理器之类的工具

  • They enable tools like the "Easy Install" Python package manager

.egg文件是Python的零安装"格式 包裹;没有构建或安装步骤 需要,只需将它们放在PYTHONPATH上 或sys.path并使用它们(可能需要 如果安装了C扩展,则安装了运行时 或使用数据文件)

.egg files are a "zero installation" format for a Python package; no build or install step is required, just put them on PYTHONPATH or sys.path and use them (may require the runtime installed if C extensions or data files are used)

它们可以包含包元数据,例如它们依赖的其他鸡蛋

They can include package metadata, such as the other eggs they depend on

它们允许命名空间包"(仅包含其他名称的包 包)分为多个部分 分布(例如zope.,扭曲的, peak.*软件包可以按以下方式分发 分开鸡蛋,不像普通包装 必须始终放在 相同的父目录.这允许 现在是什么巨大的整体式包装 单独分发 组件.)

They allow "namespace packages" (packages that just contain other packages) to be split into separate distributions (e.g. zope., twisted., peak.* packages can be distributed as separate eggs, unlike normal packages which must always be placed under the same parent directory. This allows what are now huge monolithic packages to be distributed as separate components.)

它们允许应用程序或库指定所需的 版本的库,以便您可以 例如require("Twisted-Internet> = 2.0") 导入之前 扭曲的互联网.

They allow applications or libraries to specify the needed version of a library, so that you can e.g. require("Twisted-Internet>=2.0") before doing an import twisted.internet.

它们是将扩展程序或插件分发到的很好的格式 可扩展的应用程序和框架 (例如Trac,它使用鸡蛋作为 插件从0.9b1开始),因为鸡蛋 运行时提供了简单的API来查找 鸡蛋并找到其广告条目 点(类似于Eclipse的 扩展点"概念).

They're a great format for distributing extensions or plugins to extensible applications and frameworks (such as Trac, which uses eggs for plugins as of 0.9b1), because the egg runtime provides simple APIs to locate eggs and find their advertised entry points (similar to Eclipse's "extension point" concept).

标准化还可能带来其他好处 格式,类似的好处 Java的"jar"格式.

There are also other benefits that may come from having a standardized format, similar to the benefits of Java's "jar" format.

-亚当

这篇关于将python库/应用程序打包为.egg文件有什么优势?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆