We're sunsetting PodQuest on 2025-07-28. Thank you for your support!
Export Podcast Subscriptions
cover of episode #422 You need 4 spaces

#422 You need 4 spaces

2025/3/3
logo of podcast Python Bytes

Python Bytes

AI Deep Dive AI Chapters Transcript
People
B
Brian
Python 开发者和播客主持人,专注于测试和软件开发教育。
M
Michael
帮助医生和高收入专业人士管理财务的金融教育者和播客主持人。
Topics
Brian: 我推荐使用Hynek Schlawack提出的基于`uv`的Python项目布局,它使用简单的`pyproject.toml`文件和`uv.lock`文件来管理依赖,替代传统的`requirements.txt`文件,并建议将`uv.lock`文件提交到版本控制中。这个方法简化了依赖管理,提高了项目可复用性。此外,我还讨论了如何使用`uv run`和`uv sync`命令来运行和同步项目依赖。在`pyproject.toml`文件中指定Python版本,并建议对于不需要版本控制的项目,将版本设置为0。最后,我还提到了`pyproject.toml`文件中依赖分组的用法,以及如何使用`uv`作为构建后端。 在Łukasz Langa的文章中,我看到了Python在浏览器端应用的未来展望,特别是SPy项目,这是一个用于在浏览器中运行Python的早期研究项目,旨在提供一种更流畅的Python在Web浏览器中的运行体验,未来可能消除前后端语言的差异。虽然目前该项目尚处于早期阶段,但其潜力巨大。 最后,我还简要介绍了我的一个个人项目:Server Hot Reload,这是一个单一的JavaScript文件,可以实现Web应用程序的模板热重载,无需IDE插件等复杂配置。 Michael: 我介绍了`aiolimiter`项目,这是一个高效的异步IO速率限制器,可以帮助开发者精确控制代码段的执行速率,避免因为过多请求而导致系统过载。它实现了漏桶算法,允许开发者设置请求速率,并通过`async with`块来限制代码段的执行速率。这个项目可以有效地解决与外部API或数据库交互时可能出现的速率限制问题。 我还介绍了Reloadium项目,这是一个热重载和性能分析工具,可以实现代码修改后浏览器页面的自动更新,并提供实时性能分析功能,提高开发效率。它支持多种框架和库,例如Flask、Django、SQLAlchemy和pandas,并具有错误处理和事务回滚等功能。

Deep Dive

Chapters
This chapter explores Hynek Schlawack's approach to Python project layout using pyproject.toml and the UV tool. It emphasizes the benefits of using UV.lock for dependency management and the simplification of the project structure.
  • UV-based project layout for production apps
  • ditch requirements.txt files
  • pyproject.toml for managing dependencies
  • UV.lock for dependency locking
  • using UV run and UV sync

Shownotes Transcript

Topics covered in this episode:

- [**My 2025 uv-based Python Project Layout for Production Apps**](https://www.youtube.com/watch?v=mFyE9xgeKcA))

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.

Brian #1: My 2025 uv-based Python Project Layout for Production Apps)

  • Hynek Schlawack

  • Discusses uv, a simple pyproject.toml, a simple project layout, and uv.lock as the modern way to ditch requirements.txt files

  • This is the starting video in a series, but it’s already very worthwhile

Michael #2: aiolimiter)

  • An efficient implementation of a rate limiter for asyncio.

  • This project implements the Leaky bucket algorithm), giving you precise control over the rate a code section can be entered.

Brian #3: A peek into a possible future of Python in the browser)

  • a.k.a “Secret SPy Stuff”

  • Łukasz Langa

  • A peek at SPy, a new language for Python on the web.

Michael #4: Reloadium)

Extras

Brian:

Michael:

Joke: py programmer walks into a bar)