[cmake] Produce python .dist-info metadata#22688
Open
jase231 wants to merge 1 commit into
Open
Conversation
siliataider
requested changes
Jun 24, 2026
Contributor
There was a problem hiding this comment.
Very nice work! I have a couple of comments:
- We would require a follow-up PR as the
try/exceptblock we added for thePackageNotFoundErrorshould in principle no longer be needed here thanks to your addition in this PR - I have a small doubt about how to handle the synchronization between the metadata in this
METADATA.intemplate and thepyproject.tomlsince it's hard coded here, say for exampleRequires-Distevolves to not only includenumpy, there is no mechanism that enforces applying changes in both files, thus metadata could quietly diverge, do we want to document that changes should be always applied to both files? Do we want to think of a way to generate the template by parsingpyproject.toml? ...
| @@ -0,0 +1,12 @@ | |||
| # Installs Python METADATA and INSTALLER files for compatability with importlib.metadata | |||
Contributor
There was a problem hiding this comment.
Suggested change
| # Installs Python METADATA and INSTALLER files for compatability with importlib.metadata | |
| # Installs Python METADATA and INSTALLER files for compatibility with importlib.metadata |
| # See: https://packaging.python.org/en/latest/specifications/recording-installed-packages/ | ||
|
|
||
| # scikit-build-core handles metadata so only do this for non-wheel builds to avoid conflict | ||
| IF(NOT SKBUILD) |
Contributor
There was a problem hiding this comment.
Suggested change
| IF(NOT SKBUILD) | |
| if(NOT SKBUILD) |
since you're ending the block with endif() lower case
| Name: root | ||
| Version: @ROOT_VERSION@ | ||
| Summary: Analyzing petabytes of data, scientifically. | ||
| Maintainer-Email: Vincenzo Eduardo Padulano <vincenzo.eduardo.padulano@cern.ch> |
Contributor
There was a problem hiding this comment.
Suggested change
| Maintainer-Email: Vincenzo Eduardo Padulano <vincenzo.eduardo.padulano@cern.ch> | |
| Maintainer-email: Vincenzo Eduardo Padulano <vincenzo.eduardo.padulano@cern.ch> |
see spec https://packaging.python.org/en/latest/specifications/core-metadata/#maintainer-email
Test Results 21 files 21 suites 3d 8h 21m 25s ⏱️ Results for commit 017eba2. |
9764475 to
e1ae3cc
Compare
e1ae3cc to
8eebeba
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This Pull request:
Makes the ROOT Python import package compatible with
importlib.metadata's metadata system.Changes or fixes:
Adds a cmake module that places a METADATA and INSTALLER files inside a
root-<version>.dist-infofolder on thePYTHONPATH, which importlib.metadata can access to query e.g. distribution package version.This metadata is already present in the wheel distribution courtesy of the build backend, but is absent in all other ROOT distributions.
importlib.metadata.version()will throw an exception if called on a ROOT source build, but works just fine for wheels. This PR's change standardizes this behavior.See https://packaging.python.org/en/latest/specifications/recording-installed-packages/ for python's official spec.
Checklist: