We're sunsetting PodQuest on 2025-07-28. Thank you for your support!
Export Podcast Subscriptions
cover of episode #411 TLS Client: Hello <<guitar solo>>

#411 TLS Client: Hello >

2024/11/25
logo of podcast Python Bytes

Python Bytes

AI Deep Dive AI Chapters Transcript
People
B
Brian
Python 开发者和播客主持人,专注于测试和软件开发教育。
M
Michael
帮助医生和高收入专业人士管理财务的金融教育者和播客主持人。
Topics
Michael 重写了 TalkPython.fm 网站,将底层框架从 Flask 迁移到 Quart,以解决 Flask 缺乏更新的问题,并详细描述了这个多阶段升级过程,包括测试所有 1000 个页面。他比较了其他框架(FastAPI、Litestar、Django、Hugo)的优缺点,最终选择 Quart 是因为它流行、维护良好且与 Flask 的代码迁移成本低。 在重构过程中,他首先将同步代码迁移到 Quart,然后进行异步化改造,最终实现了五倍的性能提升。他使用网站地图测试了所有页面,并修复了用户反馈的几个小问题。 Brian 介绍了 PyPI 现在支持数字证明以增强 Python 包供应链安全性的消息。他解释了数字证明如何验证 PyPI 上的文件与上游源代码仓库、工作流程和生成文件的提交哈希之间的关联,从而增强安全性。对于使用 GitHub Actions 和受信任发布的维护者,只需更新 pypa/gh-action-pypi-publish 的版本即可。对于其他情况,则有计划支持自动生成和发布,或者可以手动生成和发布,但不推荐。 他还介绍了 PEP 639(改进许可证清晰度)现在受 PyPI 支持的消息,该 PEP 允许使用 SPDX 表达式更清晰地指定软件许可证,并提供了使用 license 和 license-files 字段的示例。

Deep Dive

Chapters
Michael discusses the reasons and process behind rewriting Talk Python in Quart, considering various frameworks and the benefits of Quart over Flask.
  • Rewrote Talk Python in Quart, considering FastAPI, Litestar, Django, Hugo, and Flask.
  • Quart chosen for its maintenance and potential to switch back to Flask with minimal changes.
  • Performance improvements and simplified asynchronous code handling.

Shownotes Transcript

Topics covered in this episode:

- **[Talk Python rewritten in Quart](https://talkpython.fm/blog/posts/talk-python-rewritten-in-quart-async-flask/?featured_on=pythonbytes))**

Watch on YouTube)

About the show

Sponsored by us! Support our work through:

Connect with the hosts

Join us on YouTube at pythonbytes.fm/live) to be part of the audience. Usually Monday at 10am PT. Older video versions available there too.

Finally, if you want an artisanal, hand-crafted digest of every week of the show notes in email form? Add your name and email to our friends of the show list), we'll never share it.

Michael #1: Talk Python rewritten in Quart)

  • Rewrote all of talkpython.fm) in Quart) (10k lines of code total, 4k changed)

  • Considered

  • FastAPI

  • Litestar

  • Django

  • Hugo Static Site + Python

  • Flask

  • Discussed the multistage upgrade / conversion process

  • Automating tests for all 1,000 pages

Brian #2: PyPI now supports digital attestations)

  • Dustin Ingram

  • Attestations provide a verifiable link to an upstream source repository: By signing with the identity of the upstream source repository, such as in the case of an upload of a project built with GitHub Actions, PyPI's support for digital attestations defines a strong and verifiable association between a file on PyPI and the source repository, workflow, and even the commit hash that produced and uploaded the file. Additionally, publishing attestations to a transparency log helps mitigate against both compromise of PyPI and compromise of the projects themselves.”

  • For maintainers

  • If using GH Actions and Trusted Publishing

  • make sure you use pypa/gh-action-pypi-publish, version v1.11.0 or newer

  • that’s it

  • If not

  • “Support for automatic attestation generation and publication from other Trusted Publisher environments is planned).”

  • “While not recommended, maintainers can also manually) generate and publish attestations).”

  • See also

  • PyPI Introduces Digital Attestations to Strengthen Python Package Security)

  • by Sarah Gooding

  • Are we PEP 740 yet?)

Michael #3: Django Rusty Templates)

  • by Lily Foote

  • An experimental reimplementation of Django's templating language in Rust.

  • Goals

  • 100% compatibility of rendered output.

  • Error reporting that is at least as useful as Django's errors.

  • Improved performance over Django's pure Python implementation.

Brian #4: PEP 639 is now supported by PYPI)

Examples license field

`[project]
license = "MIT"

[project]
license = "MIT AND (Apache-2.0 OR BSD-2-clause)"

[project]
license = "MIT OR GPL-2.0-or-later OR (FSFUL AND BSD-2-Clause)"

[project]
license = "LicenseRef-Proprietary"
`

- Examples of license-files:

`[project]
  license-files = ["LICEN[CS]E*", "AUTHORS*"]

  [project]
  license-files = ["licenses/LICENSE.MIT", "licenses/LICENSE.CC0"]

  [project]
  license-files = ["LICENSE.txt", "licenses/*"]

  [project]
  license-files = []
`

Extras

Brian:

  • Playground Wisdom: Threads Beat Async/Await - interesting read from Armin Ronacher about different language abstractions around concurrency.

  • PythonTest.com Discord community is now live

  • Launched last week, as of this morning we’ve got 89 members

  • Anyone already a pythontest community member has received an invite

  • Anyone can join through courses.pythontest.com

  • Everything at pythontest.com is 20% off through Dec with code turkeysale2024

  • “Python Testing with pytest” eBook 40% off through Dec 2, use code turkeysale2024

Michael:

Joke: curl - heavy metal style)!