首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Python开源项目中合并第三方库的首选传统方法是什么?

在Python开源项目中合并第三方库的首选传统方法是什么?
EN

Stack Overflow用户
提问于 2013-01-14 10:35:51
回答 1查看 200关注 0票数 5

我正在为WSGI框架开发一个新的Python身份验证库,并希望使用python-openid以及其他一些第三方库。我认为有两种选择:

  • 在我的库中分发带有第三方库副本的库(通过GIT子模块)
  • my库的用户自己解决对第三方库的依赖。

问题是:

开放源码项目中集成第三方库的首选传统方法是什么?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-01-14 10:38:15

预先提出的方法是使用setuptools工具/分送并为您的项目定义一个通过PyPi下载第三方库的setup.py

这是我的一个项目的摘录。注意安装/安装/测试/临时参数的使用-需要关键字参数,这就是您要寻找的

代码语言:javascript
复制
import distribute_setup
distribute_setup.use_setuptools()

import os
from setuptools import setup, find_packages

# Utility function to read the README file.
# Used for the long_description.  It's nice, because now 1) we have a top level
# README file and 2) it's easier to type in the README file than to put a raw
# string in below ...

def read(fname):
    return open(os.path.join(os.path.dirname(__file__), fname)).read()

setup(
    name='buildboticon',
    version='0.3.2',
    author='Marcus Lindblom',
    author_email='macke@yar.nu',
    description=('A buildbot monitoring utility'),
    license='GPL 3.0',
    keywords='buildbot systemtray pyqt',

    url='http://bitbucket.org/marcusl/buildboticon',
    download_url='http://packages.python.org/buildboticon',

    package_dir={'':'src'},
    packages=find_packages('src', exclude=['*.tests']),
    long_description=read('README'),

    entry_points={
        'setuptools.installation': [
            'eggsecutable = bbicon:main',
        ],
        'gui_scripts': [
            'buildboticon = bbicon:main',
        ]
    },

    setup_requires=[
        'setuptools_hg',
    ],

    tests_require=[
        'unittest2 >= 0.5',
        'mock >= 0.7.0b4',
    ],

    install_requires=[
        'pyyaml >= 0.3',
#        'pyqt >= 4.7'   # PyQt doesn't have anything useful on PyPi :(
    ],

    extras_require={
        'speech':  ['pyspeech >= 1.0'],
#        'phidgets': ['PhidgetsPython >= 2.1.7'],
    },

完整文件在这里:https://bitbucket.org/marcusl/buildboticon/src/5232de5ead73/python/setup.py

票数 6
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14316806

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档