简单的pypi包
simpypi的Python项目详细描述
简单的python包索引
simpypi的工作原理
simpypi的核心是simpypi.wsgi.SimPyPI,一个简单的 WSGIWeb应用程序 接受上载的 python package 分发并根据其名称和版本元数据放置 适合于 simple index protocol。
为了安全起见,SimPyPI直接返回 HTTP 400s页 对于无效请求。这可能会得到改善。
SimPyPI本身不提供此目录。目录 应该由生成目录索引的文件服务器提供服务 (适当地 http://guide.python-distribute.org/contributing.html#the-simple-index-protocol )例如apache或 FileServer。 simpypi.factory.factory确实提供了制作wsgi应用程序的工厂 在中间件中包装FileServer,并提供简单索引 在/index/和SimPyPI应用程序下的/。此外,a simpypi命令行程序提供了前端。
目前simpypi只适用于源发行版(即, 用python setup.py sdist制作的包。
示例
我在的http://k0s.org:8080安装了simpypi的实例 使用位于http://k0s.org:8080/index/的包索引进行演示。 为了测试,我做了一个脚本, upload_mobase.py 上传 mozbase包到 simpypi。所以 index现在已经填充了它们。
你可以用 curl
> wget http://pypi.python.org/packages/source/P/PyYAML/PyYAML-3.10.tar.gz > curl -F 'package=@PyYAML-3.10.tar.gz' http://k0s.org:8080/
您可以从http://k0s.org:8080/index/中easy_installmozbase。 如果可以从simpypi包中找到包的依赖项 索引,它们也将从索引安装:
> virtualenv.py tmp New python executable in tmp/bin/python Installing setuptools............done. Installing pip...............done. > cd tmp/ (tmp)│easy_install -i http://k0s.org:8080/index/ mozrunner Searching for mozrunner Reading http://k0s.org:8080/index/mozrunner/ Best match: mozrunner 5.1 Downloading http://k0s.org:8080/index/mozrunner/mozrunner-5.1.tar.gz Processing mozrunner-5.1.tar.gz Running mozrunner-5.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-gqerOV/mozrunner-5.1/egg-dist-tmp-Qyx3Cr Adding mozrunner 5.1 to easy-install.pth file Installing mozrunner script to /home/jhammel/tmp/bin Installed /home/jhammel/tmp/lib/python2.7/site-packages/mozrunner-5.1-py2.7.egg Processing dependencies for mozrunner Searching for mozprofile>=0.1 Reading http://k0s.org:8080/index/mozprofile/ Best match: mozprofile 0.1 Downloading http://k0s.org:8080/index/mozprofile/mozprofile-0.1.tar.gz Processing mozprofile-0.1.tar.gz Running mozprofile-0.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-4Im6x0/mozprofile-0.1/egg-dist-tmp-9Jp5TR Adding mozprofile 0.1 to easy-install.pth file Installing mozprofile script to /home/jhammel/tmp/bin Installed /home/jhammel/tmp/lib/python2.7/site-packages/mozprofile-0.1-py2.7.egg Searching for mozprocess Reading http://k0s.org:8080/index/mozprocess/ Best match: mozprocess 0.1b2 Downloading http://k0s.org:8080/index/mozprocess/mozprocess-0.1b2.tar.gz Processing mozprocess-0.1b2.tar.gz Running mozprocess-0.1b2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-KU6AiF/mozprocess-0.1b2/egg-dist-tmp-4j5CMP Adding mozprocess 0.1b2 to easy-install.pth file Installed /home/jhammel/tmp/lib/python2.7/site-packages/mozprocess-0.1b2-py2.7.egg Searching for mozinfo Reading http://k0s.org:8080/index/mozinfo/ Best match: mozinfo 0.3.3 Downloading http://k0s.org:8080/index/mozinfo/mozinfo-0.3.3.tar.gz Processing mozinfo-0.3.3.tar.gz Running mozinfo-0.3.3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-JaKeaz/mozinfo-0.3.3/egg-dist-tmp-xWojez Adding mozinfo 0.3.3 to easy-install.pth file Installing mozinfo script to /home/jhammel/tmp/bin Installed /home/jhammel/tmp/lib/python2.7/site-packages/mozinfo-0.3.3-py2.7.egg Searching for ManifestDestiny>=0.5.4 Reading http://k0s.org:8080/index/ManifestDestiny/ Best match: ManifestDestiny 0.5.4 Downloading http://k0s.org:8080/index/ManifestDestiny/ManifestDestiny-0.5.4.tar.gz Processing ManifestDestiny-0.5.4.tar.gz Running ManifestDestiny-0.5.4/setup.py -q bdist_egg --dist-dir /tmp/easy_install-2blF3S/ManifestDestiny-0.5.4/egg-dist-tmp-R3KZde Adding ManifestDestiny 0.5.4 to easy-install.pth file Installing manifestparser script to /home/jhammel/tmp/bin Installed /home/jhammel/tmp/lib/python2.7/site-packages/ManifestDestiny-0.5.4-py2.7.egg Finished processing dependencies for mozrunner
注意,所有的包都来自k0s.org安装和 不是来自http://pypi.python.org/。
运行测试
那个 tests directory 包含 doctests和 试飞员, test.py。 这些测试说明了基本的功能并保护 如果在提交代码之前运行回归。 tests-require.txt包含应安装的依赖项 运行测试。 PasteTestApp, 虽然这可以转换为 WebTest。 virtualenv 用于隔离python环境。
要运行测试,请执行:
python test.py
待办事项
虽然simpypi很简单,但它只有100行 代码并不意味着它是right100行代码。这个 可以解决以下问题:
- the temporary package should be dealt with entirely in memory, ideally. Currently we write to a file and move it.
- ^{tt9}$ use ^{tt18}$ to read the data from a source distribution. Instead, the uploaded package should probably be unpacked and ^{tt11}$ run and the resulting package put in the appropriate place. This will allow archives without ^{tt20}$ (e.g. http://hg.mozilla.org/build/talos/archive/tip.tar.gz ) to be uploaded as well as at least partially correct for the fact that currently ^{tt9}$ only works for uploaded source distributions.
–