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

Add Metadata 2.1 #319

Merged
merged 5 commits into from Mar 15, 2018
Merged

Add Metadata 2.1 #319

merged 5 commits into from Mar 15, 2018

Conversation

di
Copy link
Sponsor Member

@di di commented Mar 14, 2018

This PR updates twine to upload new fields defined in PEP 566.

@codecov
Copy link

codecov bot commented Mar 14, 2018

Codecov Report

Merging #319 into master will increase coverage by 0.86%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #319      +/-   ##
==========================================
+ Coverage   67.64%   68.51%   +0.86%     
==========================================
  Files          12       12              
  Lines         578      578              
  Branches       91       91              
==========================================
+ Hits          391      396       +5     
+ Misses        161      156       -5     
  Partials       26       26
Impacted Files Coverage Δ
twine/package.py 84.81% <ø> (+6.32%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fb062b7...c02a092. Read the comment docs.

Copy link
Contributor

@brainwane brainwane left a comment

Choose a reason for hiding this comment

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

@di Thank you for this work! I have a few questions and would deeply welcome clarifications (I may well be off-base in all my thinking here).

  • Could I ask you to include a test in this PR? Maybe practically copy your pkginfo merge request's tests?

  • As I was reviewing, I noticed that -- it seems to me -- our twine/wheel.py and pkginfo's wheel.py are fairly duplicative. That's not something to address in this PR but I would appreciate others' thoughts.

@@ -20,7 +20,7 @@

install_requires = [
"tqdm >= 4.14",
"pkginfo >= 1.0",
"pkginfo >= 1.4.2",
"requests >= 2.5.0, != 2.15, != 2.16",
"requests-toolbelt >= 0.8.0",
"setuptools >= 0.7.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to increase our required setuptools version to something like setuptools > v38.5.2 (the current version as far as I can tell) to ensure we capture the update in pypa/setuptools#1286 ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Or rather, even if we don't need to since the new additional metadata is optional, should we take this opportunity to do some kind of required version increase regardless?

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

The only reason we have setuptools listed in the requirements is so that we can reliably get it's version when running twine --version.

Users with older versions of setuptools will still be able to upload their distributions with twine, they just won't be able to create distributions with Metadata 2.1 fields. If they want to do that, they should upgrade their setuptools (it's not twine's responsibility to make that decision for them).

Copy link
Contributor

Choose a reason for hiding this comment

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

Totally understand. Thanks. So, if we choose to do any user-facing messaging about this feature &, for instance, Markdown support, we should indicate that such-and-such setuptools is a requirement.

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

Yes, exactly.

@@ -148,6 +148,10 @@ def metadata_dictionary(self):
"requires_dist": meta.requires_dist,
"requires_external": meta.requires_external,
"requires_python": meta.requires_python,

# Metadata 2.1
"provides_extras": meta.provides_extras,
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks right to me per the names for these attributes as provided by the class from pkginfo.

Let me make sure I've got this right: even though the field defined in the PEP is Provides-Extra, we use the "s" at the end to indicate that it might be multiple strings, as with project_urls. Right?

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

Yes, that seems to be the status quo (really, to indicate that this is a list).

Copy link
Contributor

Choose a reason for hiding this comment

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

Great, thanks.

@@ -11,7 +11,7 @@ requires-dist =
tqdm >= 4.14
requests >= 2.5.0, != 2.15, != 2.16
requests-toolbelt >= 0.8.0
pkginfo >= 1.0
pkginfo >= 1.4.2
setuptools >= 0.7.0
Copy link
Contributor

Choose a reason for hiding this comment

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

Same question here as with setup.py about setuptools versions.

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

Same answer as above.

@brainwane
Copy link
Contributor

@di Please also add a line about yourself to AUTHORS: Name <email@domain.com> (url), where the (url) portion is optional. And if you feel like putting an entry into docs/changelog.rst:

* :feature:`319` Add Metadata 2.1 for :pep:`566` compliance

that would be great -- if not, I can do it.

@di
Copy link
Sponsor Member Author

di commented Mar 15, 2018

Could I ask you to include a test in this PR?

I added a test, I'm not a huge fan of it but it should increase our coverage a bit so can't hurt.

Also addressed everything else I think.

Copy link
Contributor

@brainwane brainwane left a comment

Choose a reason for hiding this comment

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

I created a virtualenv, installed @di's branches of twine & setuptools, added a description_content_type to the setup.py, and created and uploaded a package to Test PyPI successfully. Yay!

Copy link
Contributor

@brainwane brainwane left a comment

Choose a reason for hiding this comment

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

The few things I have questions about are all in setuptools or readme_renderer. Merging. Congrats and thank you @di.

@brainwane brainwane merged commit 7f86514 into pypa:master Mar 15, 2018
@di di deleted the add-metadata-2.1 branch March 15, 2018 20:53
@brainwane
Copy link
Contributor

There's now a release candidate for the next version of Twine available containing this PR. 🎉

@brainwane brainwane mentioned this pull request Mar 16, 2018
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.

None yet

2 participants