[BUG] setup.py check -r results in TypeError when package has no long_description
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
Description
setuptools version
setuptools==62.2.0
Python version
Python 3.7
OS
Windows 10
Additional environment information
No response
Description
Running the command python setup.py check -r with setuptools==62.2.0 installed causes a TypeError when the setup call in setup.py has not specified a long_description. This issue is not present in setuptools==62.1.0 .
It's kind of a silly problem, since check -r only seems to check the long_description anyways, but at least there should be a useful error message and not a cryptic TypeError. I'd probably just do nothing and let the check succeed if long_description is None. This worked before a7cfb56a7b1eaa95824d81a34e8e70b85d42f784 because the check was done on the internal string value "UNKNOWN", which turns out to be valid reStructuredText by itself.
Expected behavior
python setup.py check -r should succeed if there is no long_description.
How to Reproduce
- Start with a very bare-bones pyproject with
setup.py. Do not define along_description. pip install docutils(needed by -r option)pip install setuptools==62.2.0python setup.py check -r
Output
> type pyproject.toml
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
> type setup.py
from setuptools import setup
setup(
name='pkg',
version='0.0.1',
packages=['pkg'],
install_requires=[],
)
> python -m pip install docutils
Collecting docutils
Downloading docutils-0.18.1-py2.py3-none-any.whl (570 kB)
---------------------------------------- 570.0/570.0 kB 9.0 MB/s eta 0:00:00
Installing collected packages: docutils
Successfully installed docutils-0.18.1
> python -m pip install setuptools==62.2.0
Collecting setuptools==62.2.0
Downloading setuptools-62.2.0-py3-none-any.whl (1.1 MB)
---------------------------------------- 1.1/1.1 MB 12.1 MB/s eta 0:00:00
Installing collected packages: setuptools
Attempting uninstall: setuptools
Found existing installation: setuptools 47.1.0
Uninstalling setuptools-47.1.0:
Successfully uninstalled setuptools-47.1.0
Successfully installed setuptools-62.2.0
> python setup.py check -r
running check
Traceback (most recent call last):
File "setup.py", line 7, in <module>
install_requires=[],
File "C:\venv\lib\site-packages\setuptools\__init__.py", line 87, in setup
return distutils.core.setup(**attrs)
File "C:\venv\lib\site-packages\setuptools\_distutils\core.py", line 148, in setup
return run_commands(dist)
File "C:\venv\lib\site-packages\setuptools\_distutils\core.py", line 163, in run_commands
dist.run_commands()
File "C:\venv\lib\site-packages\setuptools\_distutils\dist.py", line 967, in run_commands
self.run_command(cmd)
File "C:\venv\lib\site-packages\setuptools\dist.py", line 1224, in run_command
super().run_command(command)
File "C:\venv\lib\site-packages\setuptools\_distutils\dist.py", line 986, in run_command
cmd_obj.run()
File "C:\venv\lib\site-packages\setuptools\_distutils\command\check.py", line 72, in run
self.check_restructuredtext()
File "C:\venv\lib\site-packages\setuptools\_distutils\command\check.py", line 102, in check_restructuredtext
for warning in self._check_rst_data(data):
File "C:\venv\lib\site-packages\setuptools\_distutils\command\check.py", line 130, in _check_rst_data
parser.parse(data, document)
File "C:\venv\lib\site-packages\docutils\parsers\rst\__init__.py", line 175, in parse
convert_whitespace=True)
File "C:\venv\lib\site-packages\docutils\statemachine.py", line 1512, in string2lines
astring = whitespace.sub(' ', astring)
TypeError: expected string or bytes-like object
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with the minimal setup.py and python setup.py check -r, then follow the traceback to the check_restructuredtext entry point and _check_rst_data. Done means the command succeeds when long_description is absent and the regression is covered by an appropriate test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100