asottile/setup-cfg-fmt

`variant=CommonMark` gets stripped from `long_description_content_type`

Closed this issue · 1 comments

Minimal example:

  • setup.cfg:
[metadata]
name = example_project
long_description = file: README.md
long_description_content_type = text/markdown; charset=UTF-8; variant=CommonMark
  • README.md:
# Header

text

setup.cfg gets rewritten to:

[metadata]
name = example_project
long_description = file: README.md
long_description_content_type = text/markdown

This spec can be found here:
https://packaging.python.org/en/latest/specifications/core-metadata/#description-content-type

setup-cfg-fmt unconditionally assigns that value based on the detected content type of the readme file:

tags = identify.tags_from_filename(readme)
if 'markdown' in tags:
cfg['metadata']['long_description_content_type'] = 'text/markdown'
elif 'rst' in tags:
cfg['metadata']['long_description_content_type'] = 'text/x-rst'
else:
cfg['metadata']['long_description_content_type'] = 'text/plain'