Skip to content

Commit

Permalink
chore: update post
Browse files Browse the repository at this point in the history
  • Loading branch information
shenxianpeng committed Dec 3, 2023
1 parent d1cecbb commit c2563fd
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions source/_posts/2023/11/python-and-slsa.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ date: 2023-11-15 14:25:39

我们如何使用 SLSA 框架来生成和验证 Python 工件的来源呢?

> 本篇文章是由我翻译、并根据我的实践和理解而形成的。英文原文在这里:https://sethmlarson.dev/python-and-slsa
## 内容

1. [构建纯净的Python包](#构建纯净的Python包)
Expand All @@ -24,23 +22,23 @@ date: 2023-11-15 14:25:39
5. [二进制Python包](#二进制Python包)
6. [文中用到的项目](#文中用到的项目)

注意:本文介绍的是针对**托管在 GitHub 上的 Python 项目**。SLSA 框架可通过 GitHub Actions 来实现开箱即用,只需最少的配置即可完成
注意:本文介绍的是针对**托管在 GitHub 上的 Python 项目**。SLSA 框架可通过 GitHub Actions 来实现开箱即用,只需较少的配置即可完成

对于托管在非 GitHub 上的项目(例如 Bitbucket)可以尝试 [Witness](https://witness.dev/),下一篇我将更新关于如何使用 Witness。

如果你对 Python 打包的术语或流程感到好奇,[Python 打包用户指南](https://packaging.python.org/en/latest/overview/#packaging-python-libraries-and-tools) 是了解更多信息的最佳场所
如果你想了解 Python 打包的流程或是术语可以参见[Python 打包用户指南](https://packaging.python.org/en/latest/overview/#packaging-python-libraries-and-tools)

下面是维护人员和用户的端到端工作流程,从构建 distributions、生成出处证明、验证出处发布到 PyPI,以及在验证其出处后安装 wheel。让我们一起完成每一步!
下面是从维护人员到用户的端到端工作流程:从构建 Wheel package -> 生成出处 -> 验证出处 -> 发布到 PyPI -> 以及用户验证出处 -> 安装 wheel。接下来让我们一起来完成这其中的每一步。

![端到端流程](python-and-slsa/workflows.svg)

<!-- more -->

## 构建纯净的Python包

Python 包通常只有两个工件:源代码 distribution 和纯 Python wheel。纯 Python 包可以使用名为 [build](https://pypi.org/project/build/) 的包从源代码构建
构建纯 Python 包通常只有两个工件:即纯 Python Wheel Package 和源代码 distribution。可以使用命令 [`python3 -m build`](https://pypi.org/project/build/) 从源代码构建

下面是 GitHub Actions job 定义,它构建纯 Python Wheel Package 和源代码 distribution,并为每个工件创建 SHA-256 哈希值:
下面是 GitHub Actions job 定义来构建 Wheel Package 和源代码 distribution,并为每个工件创建 SHA-256 哈希值:

```yaml
jobs:
Expand Down Expand Up @@ -250,6 +248,8 @@ Markupsafe 的解决方案是添加一个手动 [workflow_dispatch](https://docs
* [urllib3/urllib3](https://github.com/urllib3/urllib3/blob/main/.github/workflows/publish.yml)
* [pallets/markupsafe](https://github.com/pallets/markupsafe/blob/main/.github/workflows/publish.yaml)

> 英文原文:https://sethmlarson.dev/python-and-slsa
---

转载本站文章请注明作者和出处,请勿用于任何商业用途。欢迎关注公众号「DevOps攻城狮」

0 comments on commit c2563fd

Please sign in to comment.