PythonEggs

http://peak.telecommunity.com/DevCenter/PythonEggs

概览

Eggs 之于 python,就像jar 之于Java

python eggs 将python工程和相关的信息进行打包,有一些二进制格式代表eggs,更常见的是.egg压缩格式.所有的格式都支持包含package-specific data, project-wide metadata, C extensions, and Python code.

最简单安装egg的方法是使用Easy Install.可以通过setuptools来创建egg.

egg的优点有:
1.通过easy install来安装
2..egg文件是0安装格式,只要把他们放在PYTHONPATH或者sys.path中即可
3.可以包含包信息,比如其他的依赖
4.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.)
5.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.
6.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).

使用Eggs

Automatic Discovery

Building Eggs

Declaring Dependencies

Developing with Eggs

Running Eggs from Source

Accessing Package Resources

使用__file____path__来定位包的路径,比如一个模块需要读取foo.config:
foo_config = open(os.path.join(os.path.dirname(__file__),'foo.conf').read()

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值