-
Notifications
You must be signed in to change notification settings - Fork 39
Draft another CEP for PURL annotation #114
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,64 @@ | |||||||||||
| # CEP ???? - Source provenance metadata | |||||||||||
|
|
|||||||||||
| <table> | |||||||||||
| <tr><td> Title </td><td> CEP ???? - Source provenance metadata </td> | |||||||||||
| <tr><td> Status </td><td> Draft </td></tr> | |||||||||||
| <tr><td> Author(s) </td><td> Jaime Rodríguez-Guerra <jaime.rogue@gmail.com></td></tr> | |||||||||||
| <tr><td> Created </td><td> Mar 10, 2025</td></tr> | |||||||||||
| <tr><td> Updated </td><td> Mar 10, 2025</td></tr> | |||||||||||
| <tr><td> Discussion </td><td> N/A </td></tr> | |||||||||||
| <tr><td> Implementation </td><td> N/A </td></tr> | |||||||||||
| </table> | |||||||||||
|
|
|||||||||||
| ## Abstract | |||||||||||
|
|
|||||||||||
| This CEP aims to standardize how the conda ecosystem can leverage free-form | |||||||||||
| artifact metadata to annotate source and ecosystem provenance of the distributed | |||||||||||
| artifacts. | |||||||||||
|
|
|||||||||||
| We propose using the `about` field in the recipe metadata to implement | |||||||||||
| a `purl` field where one or more [Package URLs](https://github.com/package-url/purl-spec) | |||||||||||
| (PURLs) can be specified. | |||||||||||
|
|
|||||||||||
| ## Motivation | |||||||||||
|
|
|||||||||||
| Provenance metadata is useful to assess from which sources an artifact was built. | |||||||||||
| conda recipes already specify the necessary sources in their `source` section, but this field | |||||||||||
| is mostly concerned with source download and preparation for the build. In | |||||||||||
| most cases, it will contain one or more URLs or source-controlled repositories. These | |||||||||||
| URLs cannot be guaranteed to uniquely identify a project since they may change, and their | |||||||||||
| syntax might evolve across releases (e.g. different versioning schemes). | |||||||||||
|
|
|||||||||||
| Instead we propose adding a new field that _uniquely_ identifies the project being built. | |||||||||||
| The Package URL project is chosen for this endeavour. This is speciallyuseful | |||||||||||
| for efforts like dependency mapping across ecosystems. See | |||||||||||
| [PEP 725](https://peps.python.org/pep-0725/) for practical applications in the | |||||||||||
| context of PyPI <> conda interoperability. | |||||||||||
|
|
|||||||||||
| Example for `django`: | |||||||||||
|
|
|||||||||||
| ```yaml | |||||||||||
| # meta.yaml | |||||||||||
| {% set version = "1.10.1" %} | |||||||||||
| package: | |||||||||||
| name: django | |||||||||||
| version: {{ version }} | |||||||||||
| # ... | |||||||||||
| about: | |||||||||||
| # ... | |||||||||||
| purls: | |||||||||||
| - pkg:pypi/django@{{ version }} | |||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should the CEP specification mandate that PURLs have a version or do we allow versionless PURLs? I'd also be curious to know what's your opinion on the cases where we'll need to use the
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I initially thought of using versionless PURLs, but the examples in #63 (comment) made me consider adding the version because well, it has to be there anyway. That said, I don't think the version field should be required. About generic, yes and no. Some packages won't have a canonical location or ecosystem (pretty common in C/C++), so the most convenient way is to annotate them as
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I think it depends on how you want to use it. If you just want a standard way to map package names, then I guess versionless is fine. But if you want to map to a specific version, then you need the upstream version.
I have been following your work in https://github.com/jaimergp/external-metadata-mappings and the other repos, and that's great! I'm asking about generics because we already started using PURLs to map our package names to upstream packages but decided to wait before adding any kind of support for generics. It gets messy pretty quickly. But more importantly, you need to know what you want to use the PURL for. Is it to map to an exact upstream location or is it to map something to something else and you don't really care about the exact source? I don't know if we should define this in the CEP though.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Do you have some examples of the messy parts? Really interested to see other use cases.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have to say that we didn't look very deeply into generics. But I feel like where it gets tricky is that the spec says that I might also overthinking it (which is very possible).
Comment on lines
+49
to
+50
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we consider making the E.g.,
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A free-form mapping or a mapping with well defined keys? If the latter, which ones? I don't want to end up in SBOM-like territory. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Re-phrasing here from #63: if not SBOM territory, then at least SBOM cartographic terms for the "functional equivalent" and "vendor/static link" cases, covered as part of closed namespaces in the SBOM specs:
A strawman narrowing of those terms, maybe only the first needing to land initially:
|
|||||||||||
| ``` | |||||||||||
|
|
|||||||||||
| ## Specification | |||||||||||
|
|
|||||||||||
| The `about` section (top-level or output-specific) in the recipe file MAY | |||||||||||
| contain a `purls` field that takes a list of strings as specified | |||||||||||
| by the [PURL standard](https://github.com/package-url/purl-spec/blob/main/PURL-SPECIFICATION.rst). | |||||||||||
|
|
|||||||||||
| If the build tool does not support this new field in `about`, the free-form `extra` | |||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could that be changed? Or is that not feasible?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we could change that. I think we would need to change https://github.com/conda/conda-build/blob/d27c97c11e2316905cefe24deebd3e445e853ece/conda_build/metadata.py#L2619-L2626, or something like that. |
|||||||||||
| section can be used instead for backwards-compatibility. | |||||||||||
|
|
|||||||||||
| ## Copyright | |||||||||||
|
|
|||||||||||
| All CEPs are explicitly [CC0 1.0 Universal](https://creativecommons.org/publicdomain/zero/1.0/). | |||||||||||
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.