Twine: Twine cant read "long_description_content_type" from setup.py

Created on 8 Sep 2019  路  4Comments  路  Source: pypa/twine

Your Environment

1) Your operating system:
Windows 10

2) Version of python you are running:
python 3.7.3

3) How did you install twine? Did you use your operating system's package manager or pip or something else?
pip install twine

4) Version of twine you have installed (include complete output of):
twine version 1.14.0 (pkginfo: 1.5.0.1, requests: 2.22.0, setuptools: 41.2.0,
requests-toolbelt: 0.9.1, tqdm: 4.32.1)

5) Which package repository are you targeting?
test.pypi.org

6) Other packages

readme-renderer==24.0
wheel==0.33.6
setuptools==41.2.0

The Issue

twine check cant read "long_description_content_type"
Error -

Checking distribution dist\jup2py-0.1-py3-none-any.whl: warning: `long_description_content_type` missing.  defaulting to `text/x-rst`.
Passed
Checking distribution dist\jup2py-0.1.tar.gz: warning: `long_description_content_type` missing.  defaulting to `text/x-rst`.
Failed
The project's long_description has invalid markup which will not be rendered on PyPI. The following syntax errors were detected:
line 31: Warning: Inline literal start-string without end-string.

Steps to Reproduce

setup.py -

setup(name='jup2py',
      version=jup2py.__version__,
      description='Convert jupyter notebook to .py file',
      long_description_content_type="text/markdown",
      long_description=long_description,
}

Command to run -

twine check dist/*

Project Test Pypi Link - https://test.pypi.org/project/jup2py/
GitHub link - https://github.com/shivam-kotwalia/jup2py
PKG-INFO File PKG-INFO.txt

Thanks a lot
Shivam

support

Most helpful comment

I'm not able to reproduce this on macOS.

  1. I cloned the project,
  2. removed 'import jup2py' from setup.py because I don't have nbconvert installed,
  3. hardcoded the version number,
  4. ran python setup.py sdist bdist_wheel
  5. ran twine check dist/* and everything passed.

When a problem appears on Windows but not Unix, that often means line-terminator issues, especially when CRLF (\r\n, standard Windows) and simple CR (\n, standard Unix) are mixed in a file. And sure enough, if I look at the PKG-INFO.txt provided:

$ file PKG-INFO.txt
PKG-INFO.txt: ASCII text, with CRLF, CR line terminators

I suggest checking to make sure all your files (especially README.md; all the LF characters appear in that portion of PKG-INFO) have consistent line endings and/or are treated as text by git.

(Also, I noticed that the version= argument in setup is coming from a number (jup2py.version = 0.1) but it's meant to be a string; versions in non-released version control are often something like '0.1.dev0'.)

All 4 comments

I have already read multiple answers -

  1. Upgrade you packages
  2. LICENSE issue in setup.py

But still, somehow I am missing something.

I'm not able to reproduce this on macOS.

  1. I cloned the project,
  2. removed 'import jup2py' from setup.py because I don't have nbconvert installed,
  3. hardcoded the version number,
  4. ran python setup.py sdist bdist_wheel
  5. ran twine check dist/* and everything passed.

When a problem appears on Windows but not Unix, that often means line-terminator issues, especially when CRLF (\r\n, standard Windows) and simple CR (\n, standard Unix) are mixed in a file. And sure enough, if I look at the PKG-INFO.txt provided:

$ file PKG-INFO.txt
PKG-INFO.txt: ASCII text, with CRLF, CR line terminators

I suggest checking to make sure all your files (especially README.md; all the LF characters appear in that portion of PKG-INFO) have consistent line endings and/or are treated as text by git.

(Also, I noticed that the version= argument in setup is coming from a number (jup2py.version = 0.1) but it's meant to be a string; versions in non-released version control are often something like '0.1.dev0'.)

@jamadden - You are an awesome guy, why couldn't I figure this out - this was "CRLF - CR" issue like always. And thanks again for the version advice too. 馃憤

@jamadden - thank you so much! it worked!!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brainwane picture brainwane  路  6Comments

sigmavirus24 picture sigmavirus24  路  8Comments

sigmavirus24 picture sigmavirus24  路  3Comments

monocongo picture monocongo  路  3Comments

reinout picture reinout  路  6Comments