GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — bpo-43926: Cleaner metadata with PEP 566 JSON support. by jaraco · Pull Request #25565 · python/cpython

Conversation

@jaraco

@jaraco jaraco commented Apr 23, 2021 •
edited by bedevere-bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

https://bugs.python.org/issue43926

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Apr 23, 2021
@bedevere-bot bedevere-bot added the awaiting core review label Apr 23, 2021
@jaraco
jaraco force-pushed the bpo-43926/importlib-metadata-4 branch from 927b148 to 2b26539 Compare April 23, 2021 21:49
@jaraco
jaraco requested a review from rhettinger as a code owner April 23, 2021 21:49
@jaraco
jaraco force-pushed the bpo-43926/importlib-metadata-4 branch from 2b26539 to fc87e54 Compare April 23, 2021 21:50
@jaraco
jaraco removed the request for review from rhettinger April 23, 2021 22:29
@jaraco

jaraco commented Apr 23, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

Note, this change includes and should be merged after #25297.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jaraco
jaraco marked this pull request as draft April 23, 2021 22:30
tirkarthi
tirkarthi reviewed Apr 24, 2021
View reviewed changes
Comment thread Doc/library/importlib.metadata.rst
>>> wheel_metadata['Requires-Python'] # doctest: +SKIP
'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'

``PackageMetadata`` also presents a ``json`` attribute that returns

@tirkarthi tirkarthi Apr 24, 2021

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This is a Python 3.10 only feature and hence a versionadded directive can be added.

Slightly out of topic, are Distribution objects and metadata attribute immutable? Accessing json attribute from metadata objects repeats the computation though it looks like a computed once attribute so just curious if metadata attribute of Distribution, json attribute etc. can be made a cached_property.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

jaraco reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@jaraco jaraco Apr 24, 2021

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Fixed in 289665029e (also versionchanged for changes to the interpretation of the metadata).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@jaraco jaraco Apr 24, 2021

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

can be made a cached_property?

Although technically the PackageMetadata object is mutable, the protocol for it doesn't allow for mutation, so it's effectively immutable, so yes, a cached_property could be employed. Such an optimization may be premature, so I'm slightly inclined to defer that concern until a use-case presents itself. I don't feel strongly about it though and would likely accept a PR to importlib_metadata.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@jaraco jaraco mentioned this pull request Apr 24, 2021
bpo-43780: Sync with importlib_metadata 3.10 #25297
Merged
@jaraco
jaraco force-pushed the bpo-43926/importlib-metadata-4 branch from fc87e54 to a0d64c7 Compare April 24, 2021 14:19
@jaraco

jaraco commented Apr 24, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

@warsaw I note also that while we intentionally consolidated importlib.metadata into a single module (#15153), the package has since diversified and the _common module now conflicts with importlib_resources, so I've moved the modules back into a package to avoid the conflict and more clearly separate the concerns.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jaraco
jaraco marked this pull request as ready for review April 24, 2021 14:36
jaraco added 4 commits April 24, 2021 10:55
@jaraco
bpo-43926: Cleaner metadata with PEP 566 JSON support.
7a5cabf
@jaraco
Add blurb
da4fb66
@jaraco
Add versionchanged and versionadded declarations for changes to metad…
0e40702
…ata.
@jaraco
Use descriptor for PEP 566
a9463bd
@jaraco
jaraco force-pushed the bpo-43926/importlib-metadata-4 branch from 2896650 to a9463bd Compare April 24, 2021 14:56
@jaraco
jaraco requested a review from tirkarthi April 30, 2021 20:15
@jaraco

jaraco commented May 2, 2021

Copy link
Copy Markdown
Member Author

In order to ensure this change is included in the 3.10 release, I'm merging now. Happy to troubleshoot or back out specific behaviors as needed.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jaraco
jaraco merged commit 37e0c78 into master May 2, 2021
@jaraco
jaraco deleted the bpo-43926/importlib-metadata-4 branch May 2, 2021 21:03
@bedevere-bot bedevere-bot removed the awaiting core review label May 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@tirkarthi tirkarthi Awaiting requested review from tirkarthi

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@jaraco @tirkarthi @the-knights-who-say-ni @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.