我最近开始用SetupTools打包我的第一个项目,并且大部分都取得了成功。setuptools与pip的依赖关系解决方案之间的差异
不幸的是,我遇到了一个令人困惑的情况 - 我的项目依赖于PyPI上没有的单个文件模块。我已经能够使用dependency_links选项很容易地配置setup.py以便依赖那个模块,并且一切正常......只要我使用setup.py来安装它即可。如果我尝试使用pip来安装项目蛋,它在尝试安装模块时失败,假设它必须是预制的蛋存档。相比之下,setup.py检测到它是一个简单的源文件,并从中产生一个蛋。
我的目标是让我的项目在PyPI上可用,因此使用pip安装它是很重要的;所以我的问题是...我做错了什么?
我的理解是,setuptools本质上是达到目的的一种手段,最终是pip和PyPI,所以我觉得这两个工具应该表现得如此不同。
setup.py和输出的来自各工具相关部分如下:
setup(
name='particle-fish',
version='0.1.0',
description='Python Boilerplate contains all the boilerplate you need to create a Python package.',
long_description=readme + '\n\n' + history,
author='Lachlan Pease',
author_email='[email protected]',
url='https://github.com/predakanga/particle-fish',
packages=[
'particle.plugins'
],
include_package_data=True,
install_requires=['particle', 'irccrypt', 'pycrypto'],
dependency_links=['http://www.bjrn.se/code/irccrypt/irccrypt.py#egg=irccrypt-1.0'],
license="BSD",
zip_safe=False,
keywords='particle-fish',
classifiers=[
'Development Status :: 2 - Pre-Alpha',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Natural Language :: English',
"Programming Language :: Python :: 2",
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
],
test_suite='tests',
tests_require=['pytest', 'mock', 'coverage', 'pytest-cov'],
cmdclass = {'test': PyTest},
)
从setup.py输出安装:
Installed /Users/lachlan/.virtualenvs/particle-fish/lib/python2.7/site-packages/particle_fish-0.1.0-py2.7.egg
Processing dependencies for particle-fish==0.1.0
Searching for irccrypt
Best match: irccrypt 1.0
Downloading http://www.bjrn.se/code/irccrypt/irccrypt.py#egg=irccrypt-1.0
Processing irccrypt.py
Writing /var/tmp/easy_install-svPfHF/setup.cfg
Running setup.py -q bdist_egg --dist-dir /var/tmp/easy_install-svPfHF/egg-dist-tmp-Xq3OCt
zip_safe flag not set; analyzing archive contents...
Adding irccrypt 1.0 to easy-install.pth file
从PIP输出安装:
Downloading/unpacking irccrypt (from particle-fish==0.1.0)
Downloading irccrypt.py
Cannot unpack file /private/var/tmp/pip-mCc6La-unpack/irccrypt.py (downloaded from /Users/lachlan/.virtualenvs/particle-staging/build/irccrypt, content-type: text/plain); cannot detect archive format
Cleaning up...
Cannot determine archive format of /Users/lachlan/.virtualenvs/particle-staging/build/irccrypt
+0
你有什么版本的pip和setuptools? –
+0
Pip版本1.4.1和setuptools版本0.9.8分别 –
+0
升级到setuptools 1.1然后重新运行使sdist结果得到相同的结果 –