Skip to content

Commit 257b36f

Browse files
authored
fix: typo in blog and fonts (#587)
* fix: typo in blog and fonts * Update 2025-03-13-python-packaging-security-pypi.md
1 parent 4b2d292 commit 257b36f

File tree

4 files changed

+921
-909
lines changed

4 files changed

+921
-909
lines changed

_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ kramdown:
209209
auto_ids: true
210210
footnote_nr: 1
211211
entity_output: as_char
212-
toc_levels: 1..3
212+
toc_levels: 1..2
213213
smart_quotes: lsquo,rsquo,ldquo,rdquo
214214
enable_coderay: false
215215

_posts/2025-03-13-python-packaging-security-pypi.md

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ The Ultralytics breach highlights the need for us all to follow and understand s
6161
<i class="fa-solid fa-circle-info"></i> [PyPA provides a great overview of using actions to publish your Python package.](https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/)
6262
{: .notice }
6363

64-
## 1. Create a dedicated GitHub environment for publishing actions
64+
## <i class="fa-solid fa-box"></i> 1. Create a dedicated GitHub environment for publishing actions
6565

6666
First, make sure that your PyPI publish GitHub Action uses an isolated GitHub environment. Isolated environments ensure your publishing process remains secure even if other parts of your CI pipeline are compromised. This is because you can lock an environment down by ensuring that only specific users can authorize this environment to run.
6767

@@ -96,23 +96,23 @@ To lock down a GitHub environment:
9696
*Optionally, you can click <kbd>prevent self-review</kbd>, preventing someone from triggering a release or a build and then running it!*
9797
9898
<figure>
99-
<img src="/images/python-packaging/create-github-environment.gif" alt="Animated gif file that shows the GitHub interface where you can click on settings and go to the environment setting to create or edit a GitHub environment">
99+
<img src="{{ post.url | relative_url }}/images/python-packaging/create-github-environment.gif" alt="Animated gif file that shows the GitHub interface where you can click on settings and go to the environment setting to create or edit a GitHub environment">
100100
<figcaption>
101101
To create a new environment to use in a GitHub Action, 1) go to your repo's settings; 2) click <kbd>environment</kbd>; 3) add a new environment. In this screenshot, we already have a <kbd>pypi</kbd> environment created. Note that you can name your environment whatever you want, however, PyPI suggests that you use the name <kbd>pypi</kbd> for a Trusted Publisher workflow.
102102
</figcaption>
103103
</figure>
104104
105105
106106
<figure>
107-
<source srcset="/images/python-packaging/github-action-environment-pypi.webp" type="image/webp">
108-
<img src="/images/python-packaging/github-action-environment-pypi.png" alt="Screenshot of the GitHub settings interface showing the ‘Environments’ section with configuration options for ‘pypi.’ The ‘Deployment protection rules’ section is visible, with ‘Required reviewers’ enabled and two reviewers listed: ‘lwasser’ and ‘willingc.’ Other options such as ‘Prevent self-review’ and ‘Wait timer’ are present but not enabled.">
107+
<source srcset="{{ post.url | relative_url }}/images/python-packaging/github-action-environment-pypi.webp" type="image/webp">
108+
<img src="{{ post.url | relative_url }}/images/python-packaging/github-action-environment-pypi.png" alt="Screenshot of the GitHub settings interface showing the ‘Environments’ section with configuration options for ‘pypi.’ The ‘Deployment protection rules’ section is visible, with ‘Required reviewers’ enabled and two reviewers listed: ‘lwasser’ and ‘willingc.’ Other options such as ‘Prevent self-review’ and ‘Wait timer’ are present but not enabled.">
109109
<figcaption>
110110
GitHub environment settings for “pypi,” displaying deployment protection rules with required reviewers configured for workflow approvals.
111111
</figcaption>
112112
</figure>
113113
114114
115-
## 2. 🔑 Use Trusted Publisher for PyPI
115+
## <i class="fa-solid fa-key"></i> 2. Use Trusted Publisher for PyPI
116116
117117
Now that you have a GitHub environment setup, you can set up Trusted Publisher in your PyPI account.
118118
@@ -123,8 +123,8 @@ A Trusted Publisher setup creates a secure link between PyPI and your repository
123123
Using a Trusted Publisher combined with a locked-down environment eliminates the need to store sensitive tokens as GitHub secrets. It also removes the need to refresh and update tokens periodically to avoid token leaks or theft issues.
124124
125125
<figure>
126-
<source srcset="/images/python-packaging/trusted-publisher-pypi-github.webp" type="image/webp">
127-
<img src="/images/python-packaging/trusted-publisher-pypi-github.png" alt="A workflow diagram showing GitHub Actions building distribution files (sdist and wheel), publishing them securely to PyPI, represented as a warehouse. The diagram includes a lock icon emphasizing security, with the pyOpenSci logo in the top-left corner.">
126+
<source srcset="{{ post.url | relative_url }}/images/python-packaging/trusted-publisher-pypi-github.webp" type="image/webp">
127+
<img src="{{ post.url | relative_url }}/images/python-packaging/trusted-publisher-pypi-github.png" alt="A workflow diagram showing GitHub Actions building distribution files (sdist and wheel), publishing them securely to PyPI, represented as a warehouse. The diagram includes a lock icon emphasizing security, with the pyOpenSci logo in the top-left corner.">
128128
<figcaption>
129129
Example of the PyPI Trusted Publisher form, used to securely link a GitHub repository with PyPI for publishing Python packages. Trusted Publisher reduces the risk of token theft and improves overall security.
130130
</figcaption>
@@ -149,8 +149,8 @@ The steps for setting up Trusted Publisher are:
149149
150150
<figure>
151151
<picture>
152-
<source srcset="/images/python-packaging/trusted-publisher-form.webp" type="image/webp">
153-
<img src="/images/python-packaging/trusted-publisher-form.png" alt="PyPI Trusted Publisher form example showing settings for linking a GitHub repository with PyPI for secure publishing." loading="lazy">
152+
<source srcset="{{ post.url | relative_url }}/images/python-packaging/trusted-publisher-form.webp" type="image/webp">
153+
<img src="{{ post.url | relative_url }}/images/python-packaging/trusted-publisher-form.png" alt="PyPI Trusted Publisher form example showing settings for linking a GitHub repository with PyPI for secure publishing." loading="lazy">
154154
</picture>
155155
<figcaption>
156156
Example of the PyPI Trusted Publisher form, used to securely link a GitHub repository with PyPI for publishing Python packages. Trusted Publisher reduces the risk of token theft and improves overall security.
@@ -162,8 +162,8 @@ For an example of a GitHub workflow that uses Trusted Publishing, check out our
162162
163163
<figure>
164164
<picture>
165-
<source srcset="/images/python-packaging/trusted-publisher-manage.webp" type="image/webp">
166-
<img src="/images/python-packaging/trusted-publisher-manage.png" alt="PyPI Trusted Publisher manage settings showing what the Trusted Publisher setup looks like after you've created it in PyPI. It shows all of the items that you filled out in the form and has a remove button if you want to remove it from PyPI. " loading="lazy">
165+
<source srcset="{{ post.url | relative_url }}/images/python-packaging/trusted-publisher-manage.webp" type="image/webp">
166+
<img src="{{ post.url | relative_url }}/images/python-packaging/trusted-publisher-manage.png" alt="PyPI Trusted Publisher manage settings showing what the Trusted Publisher setup looks like after you've created it in PyPI. It shows all of the items that you filled out in the form and has a remove button if you want to remove it from PyPI. " loading="lazy">
167167
</picture>
168168
<figcaption>
169169
Example of the PyPI Trusted Publisher setup in PyPI once you've created the Trusted PuUblisher link by filling the form out above.
@@ -174,13 +174,11 @@ For an example of a GitHub workflow that uses Trusted Publishing, check out our
174174
**Note:** Read more here about [support for publishing to GitLab](https://docs.pypi.org/trusted-publishers/adding-a-publisher/#gitlab-cicd) using trusted publishing.
175175
{: .notice }
176176
177-
## 3. Add `zizmor` to your CI workflows
177+
## <i class="fa-solid fa-check-double"></i> 3. Add `zizmor` to your CI workflows
178178

179-
Finally, consider adding [Zizmor](https://woodruffw.github.io/zizmor/) to your CI and pre-commit checks.
179+
Finally, consider adding [Zizmor](https://woodruffw.github.io/zizmor/) to your [Continuous Integration (CI)](https://www.pyopensci.org/python-package-guide/continuous-integration/ci.html#what-is-continuous-integration) and [pre-commit checks](https://www.pyopensci.org/python-package-guide/package-structure-code/code-style-linting-format.html#use-pre-commit-hooks-to-run-code-formatters-and-linters-on-commits).
180180

181-
Zizmor is a static analysis tool designed to help identify GitHub Action security issues. Zizmor scans your workflows and highlights common vulnerabilities, ensuring your (continuous integration / continuous deployment) pipelines remain secure and efficient.
182-
183-
**TODO: link to packaging guide page on CI when it's published friday**
181+
Zizmor is a static analysis tool designed to help identify GitHub Action security issues. Zizmor scans your workflows and highlights common vulnerabilities, ensuring your continuous integration / continuous deployment pipelines remain secure and efficient.
184182

185183
Named as a playful nod to Dr. Zizmor’s famous “clear skin” ads, zizmor aims to give you “beautiful clean workflows.”
186184

0 commit comments

Comments
 (0)