首页 > 解决方案 > 如何在制作模块时在 python setup.py 中附加 Readme.md 之类的文件

问题描述

我正在尝试升级一个名为 computerpeak 的模块,我想将 Readme.md 附加到我的模块但我无法附加它
我尝试使用

Long_Description: file: 'Readme.md',

但我没有工作,我只是展示了

Readme.md

在详细描述区域

标签: python

解决方案


这应该工作

from setuptools import setup

# read the contents of your README file
from pathlib import Path
this_directory = Path(__file__).parent
long_description = (this_directory / "README.md").read_text()

setup(
    name='an_example_package',
    # other arguments omitted
    long_description=long_description,
    long_description_content_type='text/markdown'
)

来源:https ://packaging.python.org/guides/making-a-pypi-friendly-readme/


推荐阅读