mesonbuild / mesonbuild/meson-python

Support for PEP 770 (SBOMs)

Aperta
#763 8 commenti 2 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

enhancement
Lingua principale
Python
Stelle
180
Fork
93
Merge medio
2g 7h
PR unite (30g)
18

Descrizione

[PEP 770](https://peps.python.org/pep-0770/) is accepted, and specifies how wheels can start incorporating SBOMs as metadata under `.dist-info/sboms/`.

PEP 770 does not provide metadata in the `[project]` table for SBOMs, for reasons discussed in the PEP (static + dynamic metadata is expected to be common). An earlier version did use `[project]`, and https://github.com/pypa/pyproject-metadata/pull/225 prototyped support for that in `pyproject-metadata`. That part is no longer needed, but support in a build backend will be since `.dist-info` is generated by a build backend.

Technically it's possible to do something hacky like this today in a `meson.build` file:
```meson
install_data(
'sboms/an_sbom_filename.spdx.json',
install_dir: py.get_install_dir() / meson.project_name() + '-' + meson.project_version() + '.dist-info' / 'sboms',
)
```
But obviously that isn't recommended.

What we need instead is this in `pyproject.toml`:
```ini
# static SBOM files that go into all wheels
[tool.meson-python.sboms]
sbom-files = [
"sboms/component1.spdx.json",
"sboms/component2.spdx.json",
]
```
That's the basic support. There are also cases possible where a vendored component only gets included in wheels for say one platform, or if a particular build option is given. That's a lot harder to deal with, and could be done either in `[tool.meson-python]` or through some mechanism with data files in `meson.build` files (e.g., install_data(..., install_tag: 'sbom')` - lots of options and more limited needs, so let's leave that for the future I'd say.

It'd be nice to align this with other backends, so the mechanism looks similar.
- `scikit-build-core`: I don't see an issue yet, Cc @henryiii for thoughts
- `maturin`: open feature request at https://github.com/PyO3/maturin/issues/2554

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia con PEP 770 e la sezione proposta [tool.meson-python.sboms] in pyproject.toml, quindi confrontala con l’approccio install_data esistente di Meson in meson.build. Implementa il caso di base dei file statici in modo che i file SBOM configurati compaiano in .dist-info/sboms/ in ogni wheel; i casi specifici della piattaforma o delle opzioni sono esplicitamente rimandati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
build-system
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.