Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-35186: Remove "built with" comment in setup.py upload #10414

Merged
merged 2 commits into from
Dec 17, 2018

Conversation

pganssle
Copy link
Member

@pganssle pganssle commented Nov 8, 2018

platform.dist() is deprecated and slated for removal in Python 3.8. The upload command itself should also not be used to upload to PyPI, but while it continues to exist it should not use deprecated functions.

This is the first option I proposed in bpo-35186. A slightly more conservative option (option 2) is easy enough to implement:

diff --git a/Lib/distutils/command/upload.py b/Lib/distutils/command/upload.py
index 32dda359ba..56ba12b1c5 100644
--- a/Lib/distutils/command/upload.py
+++ b/Lib/distutils/command/upload.py
@@ -121,12 +121,9 @@ class upload(PyPIRCCommand):
             'requires': meta.get_requires(),
             'obsoletes': meta.get_obsoletes(),
             }
+
         comment = ''
-        if command == 'bdist_rpm':
-            dist, version, id = platform.dist()
-            if dist:
-                comment = 'built for %s %s' % (dist, version)
-        elif command == 'bdist_dumb':
+        if command in ('bdist_rpm', 'bdist_dumb'):
             comment = 'built for %s' % platform.platform(terse=1)
         data['comment'] = comment

Distutils maintainers let me know how you want to go. I'll hold off on the news entry until after we decide which way to go.

https://bugs.python.org/issue35186

@pganssle
Copy link
Member Author

pganssle commented Nov 8, 2018

@di @dstufft Any chance you know if the "comment" field is used for anything in warehouse?

@di
Copy link
Member

di commented Nov 8, 2018

@pganssle Yes, the field is "used" in the sense that it's accepted and stored by PyPI. It's an optional, free-form field used to add comments to distributions. The comments are available in the API and appear as tooltips for the files in PyPI's management UI:

screen shot 2018-11-08 at 10 26 40 am

The format or contents of the comment here is not specifically used for anything in PyPI, though.

@pganssle
Copy link
Member Author

pganssle commented Nov 8, 2018

I think as long as it's only used as a free-form comment it should be fine to remove it from distutils. Anyone who runs into this problem can and should use twine -c "built for $(some_platform)" or whatever.

At worst this is going to break people who are parsing the comment field from PyPI for whatever reason, and I suspect that's both exceedingly rare and not really something anyone is eager to support.

@dstufft
Copy link
Member

dstufft commented Nov 8, 2018

Yea, what @di said. It has no semantic meaning, just a freeform whatever field.

Honestly we might even want to consider removing it, I'm not sure it really makes much sense in the modern world where almost all downloads from PyPI are automated tooling and not humans making project by project decisions on what file to download.

platform.dist() is deprecated and slated for removal in Python 3.8. The
upload command itself should also not be used to upload to PyPI, but
while it continues to exist it should not use deprecated functions.

Fixes bpo-35186
@pganssle
Copy link
Member Author

pganssle commented Nov 8, 2018

Ok, it looks like we're leaning toward removing the comment, so I've added a news entry to that effect.

pganssle added a commit to pganssle/setuptools that referenced this pull request Nov 12, 2018
This comment is not used anywhere and `platform.dist()` is deprecated.

See CPython PR #10414: python/cpython#10414
and bpo-35186: https://bugs.python.org/issue35186
@pganssle pganssle mentioned this pull request Nov 12, 2018
2 tasks
@pganssle
Copy link
Member Author

@berkerpeksag @encukou @malemburg Are y'all the ones who are moving the deprecation of platform.dist() forward? I'm not sure who should review / merge this PR.

comment = 'built for %s' % platform.platform(terse=1)
data['comment'] = comment

data['comment'] = ''
Copy link
Member

@merwok merwok Nov 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make a difference to send empty string or omit comment altogether?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old version sent an empty string by default, so I kept that behavior, but I just checked what twine does, and it does seem to send '' even when comment=None (the default), so I think that distutils should do the same.

@encukou
Copy link
Member

encukou commented Nov 13, 2018

platform.dist() was removed because it was misleading – it misidentified distros, and there was no sustainable way to keep it up to date.
Efforts to use distro names instead of proper feature detection vs. keep the identification code up to date form a vicious cycle I explained in a distro bug.

I can't see how this comment is useful (esp. if it's added automatically), so I'd be for removing it.

@pganssle
Copy link
Member Author

pganssle commented Dec 7, 2018

@encukou @berkerpeksag @merwok Anyone want to push the merge button?

Just a ping, let me know if there are any other concerns before merging.

@merwok
Copy link
Member

merwok commented Dec 16, 2018

@encukou Not sure if your last message means «+1 on this PR» or «please change something in the PR»

@encukou encukou merged commit 4e80f5c into python:master Dec 17, 2018
@encukou
Copy link
Member

encukou commented Dec 17, 2018

A +1. Thanks for the reminder!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants