Skip to content

Commit 92a368f

Browse files
committed
📝 Add PyPI digital attestations
1 parent 98a5096 commit 92a368f

File tree

2 files changed

+59
-11
lines changed

2 files changed

+59
-11
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ emergencies when we need to start branches for older versions.
1919
Added
2020
~~~~~
2121

22+
* 📝 Add PyPI digital attestations
2223
* 📝 Add What’s new?
2324
* 📝 Add conversion to reST
2425

docs/packs/upload-install.rst

Lines changed: 58 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,8 @@ Finally, you can publish your package on PyPI:
190190
* `PyPI Release Checklist
191191
<https://cookiecutter-namespace-template.readthedocs.io/en/latest/pypi-release-checklist.html>`_
192192

193+
.. _pypi_github_action:
194+
193195
GitHub Action
194196
-------------
195197

@@ -198,6 +200,7 @@ PyPI at every time a release is created. Such a
198200
:file:`.github/workflows/pypi.yml` file could look like this:
199201

200202
.. code-block:: yaml
203+
:caption: .github/workflows/pypi.yml
201204
:linenos:
202205
:emphasize-lines: 3-5, 12, 31, 36, 38-
203206
@@ -261,6 +264,8 @@ Lines 38–41
261264

262265
* `GitHub Actions <https://docs.github.com/en/actions>`_
263266

267+
.. _trusted_publishers:
268+
264269
Trusted Publishers
265270
------------------
266271

@@ -305,6 +310,7 @@ requires neither a password nor a token. Only the following steps are required:
305310
our repository:
306311

307312
.. code-block:: diff
313+
:caption: .github/workflows/pypi.yml
308314
:lineno-start: 10
309315
:emphasize-lines: 3, 4-5
310316
@@ -322,16 +328,57 @@ requires neither a password nor a token. Only the following steps are required:
322328
Lines 13–14
323329
The ``write`` authorisation is required for *Trusted Publishing*.
324330

325-
.. code-block:: diff
326-
:lineno-start: 40
327-
:emphasize-lines: 3-
331+
Zeilen 42–44
332+
``username`` and ``password`` are no longer required for the GitHub
333+
action ``pypa/gh-action-pypi-publish``.
328334

329-
- name: Publish package distributions to PyPI
330-
uses: pypa/gh-action-pypi-publish@release/v1
331-
- with:
332-
- username: __token__
333-
- password: ${{ secrets.PYPI_TOKEN }}
335+
.. code-block:: diff
336+
:lineno-start: 40
337+
:emphasize-lines: 3-
334338
335-
Zeilen 42–44
336-
``username`` und ``password`` werden für die GitHub-Aktion
337-
``pypa/gh-action-pypi-publish`` nicht mehr benötigt.
339+
- name: Publish package distributions to PyPI
340+
uses: pypa/gh-action-pypi-publish@release/v1
341+
- with:
342+
- username: __token__
343+
- password: ${{ secrets.PYPI_TOKEN }}
344+
345+
.. _digital-attestations:
346+
347+
Digital Attestations
348+
--------------------
349+
350+
Since 14 November 2024, :term:`PyPI` also supports :pep:`740` with `Digital
351+
Attestations <https://docs.pypi.org/attestations/>`_. PyPI uses the
352+
`in-toto Attestation Framework <https://github.com/in-toto/attestation>`_ to
353+
generate the Digital Attestations `SLSA Provenance
354+
<https://slsa.dev/spec/v1.0/provenance>`_ and `PyPI Publish Attestation (v1)
355+
<https://docs.pypi.org/attestations/publish/v1/>`_.
356+
357+
The creation and publication takes place by default, provided that
358+
:ref:`Trusted Publishing <trusted_publishers>` and the GitHub action
359+
`pypa/gh-action-pypi-publish <https://github.com/pypa/gh-action-pypi-publish>`_
360+
are used for publishing:
361+
362+
.. code-block:: yaml
363+
:caption: .github/workflows/pypi.yml
364+
365+
jobs:
366+
pypi-publish:
367+
name: Upload release to PyPI
368+
runs-on: ubuntu-latest
369+
environment:
370+
name: pypi
371+
url: https://pypi.org/p/{YOUR-PYPI-PROJECT-NAME}
372+
permissions:
373+
id-token: write
374+
steps:
375+
- name: Publish package distributions to PyPI
376+
uses: pypa/gh-action-pypi-publish@release/v1
377+
378+
.. note::
379+
Support for the automatic creation of digital attestations and publishing
380+
from other Trusted Publisher environments is planned.
381+
382+
.. seealso::
383+
`PyPI now supports digital attestations
384+
<https://blog.pypi.org/posts/2024-11-14-pypi-now-supports-digital-attestations/>`_

0 commit comments

Comments
 (0)