使用PIP安装python项目

时间:2016-12-09 17:43:23

标签: python pypi

我开发了一个chatbot项目,这是其文件夹的结构:

chatbot1:
     __init__.py
     __pycache__
     build
     chatbot_script.egg-info
     dist
     MANIFEST.in 
     package_data.dat
     README.rst
     setup.cfg
     setup.py
     stanford-postagger-full-2015-04-20
     main_chatbot.py
     Female_chatbot.py
     Male_chatbot.py
     arabic_const.py
     normalize.py
     stem_const.py
     stemming.py

这是setup.py:

from setuptools import setup, find_packages
from codecs import open
from os import path

here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
setup(name='chatbot_script',
      version='1.2.0',
      description='is a simple chatbot_script that uses simple matching ',
      long_description=long_description, 
      url='https://github.com/pypi/chatbot_script',license='MIT', classifiers=   
      ['Development Status :: 3 - Alpha','Intended Audience :: Developers',
        'Topic :: Software Development :: Build Tools',
        'License :: OSI Approved :: MIT License',
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 2.6',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.3',
        'Programming Language :: Python :: 3.4',
        'Programming Language :: Python :: 3.5',],
      keywords='sample setuptools development',
      packages=find_packages(),
      install_requires=['peppercorn'],
      extras_require={
             'dev': ['check-manifest'],
             'test': ['coverage'],},
       package_data={
             'sample': ['package_data.dat'],},
       entry_points={
             'console_scripts': [
             'sample=sample:main',],},)

我成功将chatbot_script上传到PyPi和testPyPi。但是当我下载它时,只有这些文件:

chatbot_script-1.2.0:
    chatbot_script.egg-info
    PKG-INFO
    README.rst
    setup.cfg
    setup.py

为什么我无法上传其他文件?

1 个答案:

答案 0 :(得分:1)

您的主文件应放在包装文件夹中

并在您的MANIFEST.in中,您可以包含/排除文件

例如

文件结构:

chatbot1:
    MANIFEST.in 
    setup.cfg
    setup.py
    README.rst
    chatbot1:
        <package files>

MANIFEST.in

recursive-include chatbot1 .*
graft chatbot1
prune chatbot1/unwanted_files