将会按时间倒序, 不定期更新一些周报里读到的好东西, 并加入一点简评. 每次修改会顺带更新日期, 所以会跑到列表最前面.

2022年8月6日

taichi-dev/taichi: Productive & portable high-performance programming in Python.

  1. 著名的太极项目, 太极图形团队也是非常专业的一群人, 最近因为很多推广文提到百倍提速 Python 代码而再次出圈

2022年7月3日

Python 程序调试分析大杀器合集

  1. 很早之前看到的调试工具合集, 主要是
    1. wooparadog/pystack: Tool to dump python thread and greenlet stacks.
      1. The pystack is to python as jstack is to java.
      2. 能直接找到 block 到哪一行
    2. kmaork/hypno: A tool/library allowing to inject python code into a running python process.
      1. 注入正在运行的 python 进程里去, 顺便跑点别的代码
    3. benfred/py-spy: Sampling profiler for Python programs
      1. 还能看火焰图, 主要是监控性能的
    4. P403n1x87/austin:用于 CPython 的 Python 帧堆栈采样器
      1. 一般配合 TUI 或者 VSCODE 插件使用, 很强大的性能问题排查工具
    5. 之前比较火的几个流行的类似库, 这三个比较相似
      1. joerick/pyinstrument: 🚴 Call stack profiler for Python. Shows you why your code is slow!
      2. cool-RR/PySnooper: Never use print for debugging again
      3. gruns/icecream: 🍦 Never use print() to debug again.

2022年3月28日

cosmic_python

  1. Python 图书 Architecture Patterns with Python 在线版

  2. 主要从 DDD(领域驱动设计) 角度讲架构设计方式, 避免软件设计中走弯路

2022年1月31日

Textualize/textual: Textual is a TUI (Text User Interface) framework for Python inspired by modern web development.

  1. Textual is a TUI (Text User Interface) framework for Python inspired by modern web development.

  2. Windows 支持在路上了

KurtBestor/Hitomi-Downloader: Desktop utility to download images/videos/music/text from various websites, and more.

  1. 下载各种视频网站的视频, 还带一定管理功能, 监控剪切板功能

  2. 去年我曾自己做过功能几乎一样的, 然后发现所有我有的它都有了… 确实好用

benfred/py-spy: Sampling profiler for Python programs

  1. 又一个 Python 代码 profiler

plasma-umass/scalene: Scalene: a high-performance, high-precision CPU, GPU, and memory profiler for Python

  1. Scalene: a high-performance, high-precision CPU, GPU, and memory profiler for Python

2022年1月2日

Writing fast async HTTP requests in Python | JonLuca’s Blog

  1. 主要看了 aiohttp 参数调优

    1. conn = aiohttp.TCPConnector(limit=None, ttl_dns_cache=300)

      1. 延长 dns 缓存7有效期
    2. http.cookies._is_legal_key = lambda _: True

      1. 貌似可以解决总是在 stderr 里提示 illegal Cookie key 的问题, 这东西很烦

LibreTranslate

  1. 完全离线自托管的翻译服务, 平时偶尔用一下应该没有问题, 底层是 Argos Translate

GitHub - Nuitka/Nuitka: Nuitka is a Python compiler written in Python..

  1. 打包编译突然火起来的选项, 打包速度不如 pyinstaller, 但是它是转 C 以后打包的, 性能有些情况比较有优势

    1. 内置数据类型的优势不明显, 毕竟原生 Python 本来就是 C 优化过的

    2. 协程程序有可能反向优化, 高并发协程测试了一下反而变慢了

    3. 纯计算有递归或多迭代的场景, 执行速度比原生快一倍以上

sqlmodel

  1. 早期用过 encode 出品的 databases, 现在又出了这么个东西… 这作者似乎很喜欢 encode 的东西并且在上面打包新东西

[组合优于继承](The Composition Over Inheritance Principle)

  1. 设计模式相关, 子类地狱是堪比回调地狱的可怕现象, 更何况现在还有很多人连 MRO 都没搞明白, 无疑增加了心智负担

  2. 好比 golang 那边为了解决这个问题, 所以更倾向于接口代替派生

异步 Python 并不快

  1. 澄清了两个事情

    1. 协程并不会使程序变快

    2. 有些网站的 Benchmark 由于作者对某些库不熟悉, 导致数据倾斜不公正

  2. 虽然实际没什么有用的…

zanellia/prometeo:用于嵌入式高性能计算的实验性 Python-to-C 转译器和领域特定语言

  1. 看起来不怎么更新了…

pywebio/PyWebIO:以脚本方式编写交互式 Web 应用程序。

  1. 有点像 streamlit, 不过似乎更简洁一些