微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

我试图测试将库升级为pypi,我只是做了一个非常简单的例子

如何解决我试图测试将库升级为pypi,我只是做了一个非常简单的例子

文件夹和文件的结构:

Immage

README.txt中的所有文本

This is a verry simple calculator.

CHANGELOG.txt中的所有文本

Change Log
==========

0.0.1 (19/10/2020)
-------------------
- First Release

LICENCE.txt中的所有文本(用------- ------删除了我的名字)

copyright 2020 ------- -----

Permission is hereby granted,free of charge,to any person obtaining a copy of this software and associated documentation files (the "Software"),to deal in the Software without restriction,including without limitation the rights to use,copy,modify,merge,publish,distribute,sublicense,and/or sell copies of the Software,and to permit persons to whom the Software is furnished to do so,subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS",WITHOUT WARRANTY OF ANY KIND,EXPRESS OR IMPLIED,INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,fitness FOR A PARTIculaR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR copYRIGHT HOLDERS BE LIABLE FOR ANY CLaim,damAGES OR OTHER LIABILITY,WHETHER IN AN ACTION OF CONTRACT,TORT OR OTHERWISE,ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

MANIFEST.in中的所有文本

global-include *.txt *.py

__init__.py中的所有文本

def add_num(num1,num2):
    return num1 + num2

def subtract_num(num1,num2):
    return num1 - num2

def multiply_num(num1,num2):
    return num1 * num2

def divide_num(num1,num2):
    return num1 / num2

def exponent_num(num1,num2):
    return num1 ** num2

setup.py中的所有测试(已删除我的电子邮件和姓名)

from setuptools import setup,find_packages

classifiers = [
    'Development Status :: 5 - Production/Stable','Intended Audience :: Education','Operating System :: Microsoft :: Windows :: Windows 10','License :: OSI Approved :: MIT License','Programming Language :: Python :: 3'
]

setup(
    name='martinsimplecalculator',version='0.0.1',description='a basic calculator',long_description_content_type='txt',long_description=open('README.txt').read() + '\n\n' + open('CHANGELOG.txt').read(),url='',author='----',author_email='----',license='MIT',classifiers=classifiers,keywords='calculator',packages=find_packages(),install_requires=['']

)

其余文件是使用以下命令制作的:

python3 setup.py sdist

在我输入后:

twine upload --repository-url https://upload.pypi.org/legacy/ dist/*

并输入我的用户名和密码,我收到此错误

HTTPError: 400 Bad Request from https://upload.pypi.org/legacy/
The description Failed to render in the default format of reStructuredText. See https://pypi.org/help/#description-content-type for more information.

请帮助我从未做过,并且我一直在关注this youtube视频

解决方法

内容类型txt不是有效的内容类型,对于纯文本,您应该使用text/plain

long_description_content_type='text/plain',

此外,您似乎在使用setuptools之前的旧版本long_description_content_type,应该升级到最新版本:

$ python3 -m pip install -U setuptools

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。