This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: distutils.core.setup does not raise TypeError when if classifiers, keywords and platforms fields are not specified as a list
Type: behavior Stage: resolved
Components: Distutils Versions: Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: TilmanKrummeck, berker.peksag, dstufft, eric.araujo, miss-islington, vstinner, xtreak
Priority: normal Keywords: patch

Created on 2018-10-19 15:41 by TilmanKrummeck, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
dist_utils_test.zip TilmanKrummeck, 2018-10-19 15:41
Pull Requests
URL Status Linked Edit
PR 10032 merged TilmanKrummeck, 2018-10-21 18:19
PR 10084 merged miss-islington, 2018-10-24 22:50
Messages (8)
msg328048 - (view) Author: Tilman Krummeck (TilmanKrummeck) * Date: 2018-10-19 15:41
The python documentation states at this point:

"Changed in version 3.7: setup now raises a TypeError if classifiers, keywords and platforms fields are not specified as a list."

https://docs.python.org/3.7/distutils/setupscript.html#additional-meta-data

I wrote a simple foo example that does show, that eigther the documentation is wrong or a bug exists in setup().

Here's what I get in my console:

(venv) D:\Workspaces\pyCharm\dist_utils_test>setup.py sdist
running sdist
running check
warning: sdist: manifest template 'MANIFEST.in' does not exist (using default file list)

writing manifest file 'MANIFEST'
creating foo-1.0
creating foo-1.0\foo
making hard links in foo-1.0...
hard linking README -> foo-1.0
hard linking setup.py -> foo-1.0
hard linking foo\__init__.py -> foo-1.0\foo
hard linking foo\foo.py -> foo-1.0\foo
creating dist
Creating tar archive
removing 'foo-1.0' (and everything under it)

(venv) D:\Workspaces\pyCharm\dist_utils_test>pip install dist/foo-1.0.tar.gz
Processing d:\workspaces\pycharm\dist_utils_test\dist\foo-1.0.tar.gz
Building wheels for collected packages: foo
  Running setup.py bdist_wheel for foo ... done
  Stored in directory: C:\Users\Tilman Krummeck\AppData\Local\pip\Cache\wheels\c3\f0\b9\c1066a85814139442fec00ee29293f0f96f0c6e0d6c24ed149
Successfully built foo
Installing collected packages: foo
Successfully installed foo-1.0

I'm doing this on Python 3.7 (32bit) with pip 18.1 and setuptools 40.4.3.
msg328062 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2018-10-19 20:36
Thanks for the report. It was made as a TypeError in https://bugs.python.org/issue19610#msg306853 in the commit to check for list explicitly [0] . Then since it broke a lot of packages as seen in the discussion and now it accepts string and list later at https://bugs.python.org/issue19610#msg307622 and commit [1] . 

I think Distribution doc was changed to reflect the change and setup doc had the old one indicating TypeError . So I guess it's a documentation fix that needs to be done. Using an integer for classifier gives me a warning and also eventually a TypeError on master and Python 3.7 . I am proposing this to be an easy doc fix. Would you like to raise a PR?

The doc is at https://github.com/python/cpython/blob/master/Doc/distutils/setupscript.rst


# Using classifier=1 in setup.py gives warning and then a TypeError. String is acceptable as per the original report

../cpython/python.exe setup.py sdist
Warning: 'classifiers' should be a list, got type 'int'
Traceback (most recent call last):
  File "setup.py", line 3, in <module>
    setup(name='foo',
  File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/distutils/core.py", line 108, in setup
    _setup_distribution = dist = klass(attrs)
  File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/distutils/dist.py", line 267, in __init__
    getattr(self.metadata, "set_" + key)(val)
  File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/distutils/dist.py", line 1215, in set_classifiers
    self.classifiers = _ensure_list(value, 'classifiers')
  File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/distutils/dist.py", line 40, in _ensure_list
    value = list(value)
TypeError: 'int' object is not iterable


[0] https://github.com/python/cpython/commit/dcaed6b2d954786eb5369ec2e8dfdeefe3cdc6ae#diff-d9afd486aff62306cb23cb8be2d4458eR1218

[1] https://github.com/python/cpython/commit/8837dd092fe5ad5184889104e8036811ed839f98#diff-d9afd486aff62306cb23cb8be2d4458eR30


Hope this helps!
msg328129 - (view) Author: Tilman Krummeck (TilmanKrummeck) * Date: 2018-10-20 06:30
I guess it's now or never. Give me some time to check the developer's guide and I'll submit a doc fix for this.
msg328155 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2018-10-20 15:58
No problem, since this is a doc fix you can directly fork and edit on GitHub web UI. This requires CLA to be signed but no NEWS entry so it can be done from web UI and you can take wording from the commit 8837dd092fe5ad5184889104e8036811ed839f98. I am just waiting for confirmation to make sure from my analysis is correct and this is a doc fix.

Thanks
msg328223 - (view) Author: Tilman Krummeck (TilmanKrummeck) * Date: 2018-10-21 18:21
I've submitted the PR just now: https://github.com/python/cpython/pull/10032.

The CLA is signed but most probably not processed yet.
msg328399 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-10-24 22:50
New changeset e80e77a484983ffb527ef22d336ff9500589dce3 by Victor Stinner (TilmanK) in branch 'master':
bpo-35027, distutils doc: Correct note on setup.py change in Python 3.7 (GH-10032)
https://github.com/python/cpython/commit/e80e77a484983ffb527ef22d336ff9500589dce3
msg328400 - (view) Author: miss-islington (miss-islington) Date: 2018-10-24 22:59
New changeset f2679afda06d1eeaf34852e49bbcf4fb39736d19 by Miss Islington (bot) in branch '3.7':
bpo-35027, distutils doc: Correct note on setup.py change in Python 3.7 (GH-10032)
https://github.com/python/cpython/commit/f2679afda06d1eeaf34852e49bbcf4fb39736d19
msg328563 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2018-10-26 15:42
Since the two PRs are merged as part of triaging I am closing this as fixed. Feel free to reopen this if needed.

Thanks Tilman for the PR :)
History
Date User Action Args
2022-04-11 14:59:07adminsetgithub: 79208
2018-10-26 15:42:44xtreaksetstatus: open -> closed
resolution: fixed
messages: + msg328563

stage: patch review -> resolved
2018-10-24 22:59:22miss-islingtonsetnosy: + miss-islington
messages: + msg328400
2018-10-24 22:50:40miss-islingtonsetpull_requests: + pull_request9416
2018-10-24 22:50:29vstinnersetnosy: + vstinner
messages: + msg328399
2018-10-22 13:33:06berker.peksagsetnosy: + berker.peksag
2018-10-21 18:21:40TilmanKrummecksetmessages: + msg328223
2018-10-21 18:19:33TilmanKrummecksetkeywords: + patch
stage: patch review
pull_requests: + pull_request9370
2018-10-20 15:58:40xtreaksetmessages: + msg328155
2018-10-20 06:30:57TilmanKrummecksetmessages: + msg328129
2018-10-19 20:36:48xtreaksetnosy: + xtreak
messages: + msg328062
2018-10-19 15:41:11TilmanKrummeckcreate