原文: PyCoder's Weekly - Issue #360

realpython


In this step-by-step tutorial, you'll learn how to create a cross-platform graphical user interface (GUI) using Python and the wxPython toolkit. A graphical user interface is an application that has buttons, windows, and lots of other widgets that the user can use to interact with your application.

How three tools (pyenv, pipx, pipenv) make for smooth, isolated, reproducible Python developer and production environments.

(是也乎:

这,是非常重要的常用嗯哼哪...

只是, 一点儿也不简单..因为 Python 中一直就没有一个合理的工具一致性解决所有阶段的开发环境问题:

本地开发时的版本和模块依赖管理
测试时高速部署依赖模块
运行时自动化同步版本和依赖模块版本

Docker 是一把将所有阶段的环境问题用虚拟机解决了, 只是带来空间无法控制, 以及必须理解并忍受越来越多的专用工具;

所以, 先用已有工具组合为一个合理可理解的工具箱来完成是好的:

pyenv 进行本地/测试/生产 的运行时版本和模块依赖树隔离
 pyenv 之下..
    conda 负责部分大型编译型模块的预编译管理
    pipenv 进行模块的依赖/版本管理

嗯哼, 就是缺少一环:

可以高速冻结本地模块依赖树, 
并能自动化同步模块树镜像到任意指定主机上;
以便从本地安装模块,而不依赖可怜的墙外网速...

再次感叹: dh-virtualenv, 已经解决了这一环的问题...

可惜...Debain only ...

)

Learn how to prepare for crashes in advance, so when they do occur you can quickly figure out which part of the codebase caused them: The standard library's faulthandler, verbose test runs, package listing, and catchsegv on Linux.

Latest blog post from Guido, related to the recent discussion about Python getting + and - operators for merging dictionaries (PEP 584).

(是也乎:

老爹叕发声挺新嗯哼了...

)

See step-by-step what Python decorators are and how you can use them to make your own code more Pythonic and expressive.

(是也乎:

...

哈, 形式都一致...

)

Nice deep dive on comparison operators in Python.

The current Python 2.x and 3.x implementation of urllib does not encode the \r\n sequence in the query string, which allows an attacker to manipulate a HTTP header with the \r\n sequence in it, so the attacker can insert arbitrary content to the new line of the HTTP header.

(是也乎:

也就是说尽可能别用? 还是 cURL 之类老牌工具靠谱...

)

"It feels like we're starting to pass the peak of the hype cycle of microservices." Interesting counterpoint to the "everything should be broken down into microservices" hypetrain. Not Python-specific, but worth a read nonetheless.

(是也乎:

If we can't debug them, maybe we can test them

微服务这波大嗯哼, 回味一下, 非常象当年 GNU 投入所有力量来开始灵活/美好/简洁的微内核 OS , 结果统一 自由/开源软件世界的, 是名大3学生开发的巨核 OS...

)

讨论

Discussions

Google Plus is shutting down soon, so here's a final hurrah.

(是也乎:

I was asked on Twitter why Python uses 0-based indexing,...

老爹当年也很是积累使用 G+ 的, 公开回答了很多价值问题... 能看一眼少一眼了...

简单说, 就是为了切片时的语义合理性...

)

文章,教程和嗯哼

Articles, Tutorials and Talks

In this tutorial, you'll learn how to use the Python mock object library, unittest.mock, to create and use mock objects to improve your tests. Obstacles like complex logic and unpredictable dependencies make writing valuable tests difficult, but unittest.mock can help you overcome these obstacles.

(是也乎:

...

别的不说, 真蟒 的插图是非常走心的...

PS: 官网图片都是 webp 的了, 下载了根本没法直接看...

)

Does your brain short-circuit when you see a mathematical algorithm? Don't worry, you're not alone. In this post you'll see how the author worked her way through an algorithm, namely TF-IDF, and got it up and running in Python. Nice writeup!

(是也乎:

为什么不直接来 MMA ?

)

Nice overview of Python libraries that provide an easy and intuitive way to transform images and make sense of the underlying data.

(是也乎:

正如 RANA 老了, 图形图像处理这方面, 也已经很多年没什么新嗯哼了

)

Some nice tips and example code for writing scientific papers in LaTeX, with figures generated in Python.

(是也乎:

正如那位手打 1700+页课堂笔记的学生一样, 这种事儿用个可定制 Editor 来的更快...

)

How to use the Gmail API to create a Python script which will automatically search & delete the messages matching your query.

(是也乎:

Gmail 积累这么多年, 再傻的 PM 也应该掌握人类最强 SPAM 识别库了, 只是, 对于我们是不存在的嗯哼...

)

I don't know how Alex comes up with these, but that's a fun one :)

You finished up a wonderful GUI application using wxPython. How do you share it with the world? Read Mike's article to find out.

(是也乎:

wx 哪,,,很多年没见过有什么消息了, Electorn 以及 Flutter 们将统一桌面吧?

)

"How we cut a heavy admin dashboard response time in half with advanced SQL and some Django hackery."

好物

Interesting Projects, Tools and Libraries

(是也乎:

...

作弊条也可以变成流行嗯哼...

)

(是也乎:

encode/orm 这个项目名非常好哪...

支持 Postgres, MySQL, and SQLite. 非常早期, 嵌合多个成熟模块组合成的新工具.

)

(是也乎:

叕一 Scrapper

)

(是也乎:

...

可视化 AST ... Graphviz 无处不在... )

📆🐍 活动/大会

Events

indypy

DAMA

❤️ Happy Pythonic!

(大妈私人无责任播报)

是也乎

  • 190321 Zoom.Quiet(大妈) 用时 42 分钟 完成快译
  • 190321 Zoom.Quiet(大妈) 用时 17 分钟 完成格式转抄.

Comments