2017-04-25 36 views
0

我不知道車輪。我有require.txt文件。還有一件事 - 輪子。我對wheel和require.txt感到困惑。我想用wheel來打包我的項目。如何使用wheel打包我的項目,這樣我就可以使用一次簡單的方式安裝所有的項目依賴項。如何在python中使用滾輪打包項目

回答

1

你可以用我的git,使與setup.py文件一個新的項目,並且運行後

pip install -e . 

,使你的項目的新版本

https://github.com/adouani/create_template

編輯

例如:

# -*- coding: utf-8 -*- 
import os 

from setuptools import setup, find_packages 

here = os.path.abspath(os.path.dirname(__file__)) 
with open(os.path.join(here, 'README.txt')) as f: 
    README = f.read() 
with open(os.path.join(here, 'CHANGES.txt')) as f: 
    CHANGES = f.read() 
with open(os.path.join(here, 'external_requirements.txt')) as f: 
    requires = f.readlines() 

# on sépare la définition des dépendances internes des dépendances externes 

requires.extend([ 
    ...... 
]) 
setup(
    name='..........', 
    version='0.1.0.dev0', 
    description='', 
    long_description=README + '\n\n' + CHANGES, 
    classifiers=[ 
     "Programming Language :: Python", 
     "Framework :: Pyramid", 
     "Topic :: Internet :: WWW/HTTP", 
     "Topic :: Internet :: WWW/HTTP :: WSGI :: Application", 
    ], 
    author='............', 
    author_email='', 
    url='', 
    keywords='web wsgi bfg pylons pyramid', 
    packages=find_packages(), 
    include_package_data=True, 
    zip_safe=False, 
    install_requires=requires, 
    message_extractors={'.': [ 
     ('ihm/**.py', 'lingua_python', None), 
     ('ihm/**.pt', 'lingua_xml', None), 
     ('ihm/**.html', 'html', None), 
     ('ihm/**.py', 'python', None), 
     ('ihm/**.js', 'js', None), 
    ]}, 
    dependency_links=[ 
     '............', 
     '.............', 
     'git+http://............#egg=ihm-0.7.0', 
    ], 
) 
+0

它正在創建一個虛擬項目。我想要我所有的項目依賴關係。 – lucy

+0

是的,你把所有的文件放到項目和你的依賴文件中,然後運行命令pip install -e。 for internal package use dependency_links = [..] in setup.py並添加require.extend([...]) –

+0

它是好的,但我需要輪子的實現。我有要求使用輪子來打包項目。 – lucy

相關問題