warehouse: `long_description_content_type` missing. defaulting to `text/x-rst`.

It isn’t missing; checked some existing Issues, haven’t found a fix. Details below; anything unique or did I miss a solution?


Win OS, Anaconda Powershell Prompt, conda virtual env. README.md, setup.py

(viz) PS C:\see-rnn> python setup.py sdist bdist_wheel
Build logs
running sdist
running egg_info
writing see_rnn.egg-info\PKG-INFO
writing dependency_links to see_rnn.egg-info\dependency_links.txt
writing requirements to see_rnn.egg-info\requires.txt
writing top-level names to see_rnn.egg-info\top_level.txt
reading manifest file 'see_rnn.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'see_rnn.egg-info\SOURCES.txt'
running check
creating see-rnn-1.1
creating see-rnn-1.1\see_rnn
creating see-rnn-1.1\see_rnn.egg-info
copying files to see-rnn-1.1...
copying LICENSE -> see-rnn-1.1
copying MANIFEST.in -> see-rnn-1.1
copying README.md -> see-rnn-1.1
copying requirements.txt -> see-rnn-1.1
copying setup.py -> see-rnn-1.1
copying see_rnn\__init__.py -> see-rnn-1.1\see_rnn
copying see_rnn\inspect_gen.py -> see-rnn-1.1\see_rnn
copying see_rnn\inspect_rnn.py -> see-rnn-1.1\see_rnn
copying see_rnn\utils.py -> see-rnn-1.1\see_rnn
copying see_rnn\visuals_gen.py -> see-rnn-1.1\see_rnn
copying see_rnn\visuals_rnn.py -> see-rnn-1.1\see_rnn
copying see_rnn.egg-info\PKG-INFO -> see-rnn-1.1\see_rnn.egg-info
copying see_rnn.egg-info\SOURCES.txt -> see-rnn-1.1\see_rnn.egg-info
copying see_rnn.egg-info\dependency_links.txt -> see-rnn-1.1\see_rnn.egg-info
copying see_rnn.egg-info\requires.txt -> see-rnn-1.1\see_rnn.egg-info
copying see_rnn.egg-info\top_level.txt -> see-rnn-1.1\see_rnn.egg-info
copying see_rnn.egg-info\zip-safe -> see-rnn-1.1\see_rnn.egg-info
Writing see-rnn-1.1\setup.cfg
creating dist
Creating tar archive
removing 'see-rnn-1.1' (and everything under it)
running bdist_wheel
running build
running build_py
installing to build\bdist.win-amd64\wheel
running install
running install_lib
creating build\bdist.win-amd64\wheel
creating build\bdist.win-amd64\wheel\see_rnn
copying build\lib\see_rnn\inspect_gen.py -> build\bdist.win-amd64\wheel\.\see_rnn
copying build\lib\see_rnn\inspect_rnn.py -> build\bdist.win-amd64\wheel\.\see_rnn
copying build\lib\see_rnn\utils.py -> build\bdist.win-amd64\wheel\.\see_rnn
copying build\lib\see_rnn\visuals_gen.py -> build\bdist.win-amd64\wheel\.\see_rnn
copying build\lib\see_rnn\visuals_rnn.py -> build\bdist.win-amd64\wheel\.\see_rnn
copying build\lib\see_rnn\__init__.py -> build\bdist.win-amd64\wheel\.\see_rnn
running install_egg_info
Copying see_rnn.egg-info to build\bdist.win-amd64\wheel\.\see_rnn-1.1-py3.7.egg-info
running install_scripts
adding license file "LICENSE" (matched pattern "LICEN[CS]E*")
creating build\bdist.win-amd64\wheel\see_rnn-1.1.dist-info\WHEEL
creating 'dist\see_rnn-1.1-py3-none-any.whl' and adding 'build\bdist.win-amd64\wheel' to it
adding 'see_rnn/__init__.py'
adding 'see_rnn/inspect_gen.py'
adding 'see_rnn/inspect_rnn.py'
adding 'see_rnn/utils.py'
adding 'see_rnn/visuals_gen.py'
adding 'see_rnn/visuals_rnn.py'
adding 'see_rnn-1.1.dist-info/LICENSE'
adding 'see_rnn-1.1.dist-info/METADATA'
adding 'see_rnn-1.1.dist-info/WHEEL'
adding 'see_rnn-1.1.dist-info/top_level.txt'
adding 'see_rnn-1.1.dist-info/zip-safe'
adding 'see_rnn-1.1.dist-info/RECORD'
removing build\bdist.win-amd64\wheel
(viz) PS C:\see-rnn> twine check dist/*
Checking dist\see_rnn-1.1-py3-none-any.whl: PASSED, with warnings
  warning: `long_description_content_type` missing.  defaulting to `text/x-rst`.
Checking dist\see-rnn-1.1.tar.gz: FAILED
  `long_description` has syntax errors in markup and would not be rendered on PyPI.
    line 99: Warning: Inline literal start-string without end-string.
  warning: `long_description_content_type` missing.  defaulting to `text/x-rst`.
setup(...
    long_description=read_file('README.md'),
    long_description_content_type='text/markdown', ...)
wheel                     0.34.2                     py_1    conda-forge
twine                     3.1.1                    py37_0    conda-forge
setuptools                46.1.3           py37hc8dfbb8_0    conda-forge

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

@ahmadfebrianto That distribution seems old, here’s what I see in that setup.py:

from distutils.core import setup

setup(
    name='moodle-kit',
    packages=['moodle_kit'],
    version='0.1.3',
    license='GNU',
    description='A simple Python package with some functionalities to interact with moodle-based LMS.',
    author='Ahmad Febrianto',
    author_email='achmadfebryanto@gmail.com',
    url='https://github.com/ahmadfebrianto/moodle-kit',
    download_url='https://github.com/ahmadfebrianto/moodle-kit/archive/v0.1.3.tar.gz',
    keywords=['moodle'],
    install_requires=[
        'requests',
    ],
    classifiers=[
        'Development Status :: 5 - Production/Stable',
        'Intended Audience :: Developers',
        'Topic :: Software Development :: Build Tools',
        'Programming Language :: Python :: 3.6',
    ],
)

I don’t see a long_description or a long_description_content_type.

Looking at https://github.com/ahmadfebrianto/moodle-kit/blob/887ed5267ba7580cd204ec04f3d104e839ec2d07/setup.py#L1, I see that you’re using from distutils.core import setup. I would recommend using from setuptools import setup instead, as distutils is unable to support the newer metadata that description_content_type requires.

In the future I’d also recommend using https://github.com/pypa/sampleproject as a template for best practices for structuring a Python package!

Problem solved. It turned out that setup function from distutils.core was the cause. After I used setup function from setuptools, the problem went away. Thank you

@OverLordGoldDragon Github’s fenced code blocks allow you to specify the syntax highlighter, which includes languages like python and other things like diff. Here’s the “source” for that comment:

    Here's the issue:
    
    ```console
    $ file README.md
    README.md: ASCII text, with very long lines, with CRLF line terminators
    ```
    
    Those Windows-style line terminators are leaking into the metadata and causing it to be misformatted.

    ```diff
    def read_file(*parts):
    -    with codecs.open(os.path.join(current_path, *parts), 'r', 'utf8') as reader:
    +    with open(os.path.join(current_path, *parts), encoding='utf-8') as reader:
            return reader.read()
    ```

Here’s the issue:

$ file README.md
README.md: ASCII text, with very long lines, with CRLF line terminators

Those Windows-style line terminators are leaking into the metadata and causing it to be misformatted.

Can you try doing the following in your setup.py instead:

def read_file(*parts):
-    with codecs.open(os.path.join(current_path, *parts), 'r', 'utf8') as reader:
+    with open(os.path.join(current_path, *parts), encoding='utf-8') as reader:
        return reader.read()