周刊
各种来源的…
background
世界高速变化
goal
定期 review 一周以来主要变化
trac
汇集各种渠道的周刊, 以及自己每周内省小结吧…
refer.
…TBD
各种来源的…
世界高速变化
定期 review 一周以来主要变化
汇集各种渠道的周刊, 以及自己每周内省小结吧…
…TBD
原文: Import Python Weekly Newsletter - Issue No 96 欢迎, 来 PyChina/weekly 共同翻译/增订/推荐 周刊 蠎消息 ;-) 该读 ~ 文章, Blog, 教程… 搜索所有过往文章 Import Python Newsletters. By Tag, Keywords, Issue No. importpython Hello Subscribers. If you ever want to find an article we curated and don’t rememeber the issue ?. Or you want to find all articles based on a tag/topic e.g. admin panel, PEP etc. Head to http://importpython.com/search/ . Please let us know your feedback / Bug if any. (是也乎: 蠎周刊快速积累到 96 期了,果断官方给出了关键词搜索服务 ) Python 的 iterators 和 iterables 需要相同嘛?! iterator So what are iterators and iterables, and are they distinct? They are distinct. Iterables are classes that implement the iter method, a method which returns an iterator. Iterators are classes that implement the next method (or next in Python 2), which continuously returns the next element until the end. So this begs the question, does an iterable also have to be an iterator? Or does an iterator also have to be an iterable? (是也乎: 命名是艺术也是命运,一个再好的功能,名字起错了, 除了给人留下很多的口水仗机会,对开发只能是种心碍,还是人工的… ) 检查 Django 的所有迁移点. django All of our project are setup with continuous deployment on CircleCI. An occasional source of errors has been caused by missing model migrations because the migration wasn’t committed. There’s a simple solution by adding a migration check before deploying. (是也乎: 随着 Django 的高速发展以及快速流传, 不兼容的升级行为也越来越艺术化, 得配合专门技艺…作死 ) 你有哪些不常见的心爱 projects/notebooks/modules ? opensource project Reddit Discussion where Python developers are sharing their favourite projects/modules. Lot of noise but found python-dependency-injector to be interesting. (是也乎: 挂出来的日子不长,但是 fuckit 的确值得体验…当然只是 linux/mac 党可以体验的了 ) PEP 531 – Existence checking operators PEP Inspired by PEP 505 and the related discussions, this PEP proposes the addition of two new logical operators to Python: i) Existence-checking fallback: expr1 ?else expr2 ii) Existence-checking precondition: expr1 ?and expr2. As well as the following abbreviations for common existence checking expressions and statements i) Existence-checking attribute access: obj?.attr (for obj ?and obj.attr ) ii) Existence-checking subscripting: obj?[expr] (for obj ?and obj[expr] ) iii) Existence-checking assignment: target ?= expr (是也乎: 受到动态的影响,运行时自省不足一定非常难受的, 所以,py 又接受了两种存在检验器 ) 所有 Python 包都能预安装的在线 REPL 环境 – Repl.it REPL At Repl.it, our goal is to make programming more accessible, and as part of this we aim to provide the full power of popular programming environments with no setup time. And no modern programming language is complete without third-party packages. That’s why today we’re making every Python package ever immediately available on repl.it. Just select the language (Python or Python3) and start importing packages. (是也乎: 将整个儿 PyPi 事先都加载到目录中的在线 REPL, 真心脑洞太大了… 问题是俺想基于这种零部署的环境, 发布私人应用呢!? 不过,真心是个好想法… 而且提供20+种开发语言的 REPL ) Mike Driscoll: 用Python和GooPyCharts创建图形 charts I came across an interesting plotting library called GooPyCharts which is a Python wrapper for the Google Charts API. In this article, we will spend a few minutes learning how to use this interesting package. 改进和扩展 pip 的搜索功能 pip The main reason I’m in love with Python is the elegance and beauty of the design the language holds. Why not improve a bit on pip search to match the aesthetics? That’s why I created yip. (是也乎: 已成痛点… ) Python API 客户端和 Tapioca opensource project, API Tapioca is a Python API client maker. It gathers most of the features API clients implement and puts them in an extensible core. Wrappers will then extend this core implementing only the specifics from each service (such as authentication and pagination) and get all the common API client features for free. Tapioca approach also comes in handy because regardless of the service, clients look the same in the way you interact with them. (是也乎: Tapioca 是一个致力于彻底改变 API 开发模式的服务商, 具体点,就是想接管所有互联网 API 的发布… ) 如何编写你自己的 Python 文档生成器? core python Originating from the standard library, inspect not only lets you look at lower level python frame and code objects, it also provides a number of methods for examining modules and classes, helping you find the items that may be of interest. It’s what pydoc uses to generate the help files mentioned previously. (是也乎: 给娇贵的 pydoc 生成可用文档的前置工具 ) 使用 Python Mock 来折腾你的代码 mock I want to share 2 specific use cases that I recently encountered. Case 1: Testing without calling a REST/SOAP API and Case 2: Pretend that you have imported a library. (是也乎: 很有脑洞的案例分享 ) 活动 ~ Upcoming Conference / User Group Meet ??? 进入冬歇期了? 项目 ~ 包/模块/库/片段… ...
原文: Import Python Weekly Newsletter - Issue No 95 欢迎, 来 PyChina/weekly 共同翻译/增订/推荐 周刊 蠎消息 ;-) 该读 ~ 文章, Blog, 教程… 用 Rust 修复 Python 性能 performance Excellent post from Armin Ronacher on tackling a CPython performance bottleneck with a custom Rust extension module. (是也乎: 简单的说就是将 py 伪装成 Rust 来跑 ~ 城会玩儿~.~ ) 在 Python 中如何创建只读属性和限制性值对象 core python There are different way to prevent setting attributes and make attributes read only on object in python. We can use any one of the following way to make attributes readonly. 1) Property Descriptor 2) Using descriptor methods get and set 3) Using slots (only restricts setting arbitary attributes). (是也乎: 使用内置的自省机制来防卫 ) 如何将 Django 应用部署到 Digital Ocean deployment In this tutorial we will be deploying https://github.com/sibtc/urban-train ,a empty Django project I created to illustrate the deployment process. (是也乎: 一个 Heroku 一个 Digital Ocean, 文档好到经常被搜索出来独立使用 ) 用 Python 进行异步抓取 Scraping is often an example of code that is embarrassingly parallel. With some slight changes, our tasks can be done asynchronously, allowing us to process more than one URL at a time. In version 3.2, Python introduced the concurrent.futures module, which is a joy to use for parallelizing tasks like scraping. The rest of this post will show how we can use the module to make our previously synchronous code asynchronous. (是也乎: 使用 Py3 内置的库折腾 ) 每周聊 Python: Class-Based Views in Django video Most Django programmers use function-based views, but some use class-based views. Why? Special guest Buddy Lindsey will be joining us this week to talk about how class-based views are different. 和俺聊 Python : #80 TinyDB: 轻便的文档数据库 podcast I’m excited to introduce you to Markus Siemens and TinyDb. This is a 100% pure python, embeddable, pip-installable document DB for Python. (是也乎: 无论怎么折腾, 目前看还没有一种 NoSQL 数据库可以简单的替代 MySQL ) 在 Django 处状态 django, finite state machine Whether you’re building up a CMS or a bespoke application, chances are that you will have to handle some states / statuses. Let’s discuss your options in Django. JIRA Sponsor IT Help Desk & Ticketing. Start a free trial of JIRA Service Desk and get your free Konami Code shirt. (是也乎: 其它赞助商俺是不知道的, 这个非常赞的 ) 升级 Django - Never Clever django General Guidelines when upgrading Django. (是也乎: 人艰不拆,宁可另外起用个新网站,来替换部分接口,也别… 啊,多么也痛的领悟…) Yoda on python dependency humor Check the tweet :) (是也乎: 程序猿的幽默只有翻越后感知的到 ) lptrace opensource project lptrace is strace for Python programs. It lets you see in real-time what functions a Python program is running. It’s particularly useful to debug weird issues on production. (是也乎: 又一个观察活体 Python 运行时变量情况的调试工具, 不过… ) Python 的静态类型,嚓 my(py)! mypy In this post, I’ll explain how mypy works, the benefits and pain points we’ve seen in using mypy, and share a detailed guide for adopting mypy in a large production codebase (including how to find and fix dozens of issues in a large project in the first few days of using mypy!). sanic web server Python 3.5+ web server that’s written to go fast 活动 ~ Upcoming Conference / User Group Meet Inland Empire Pyladies PyKla Monthly meetup PyCon CZ 2016 PyCon Finland 2016 PyCon Ireland 2016 PyCon Canada 2016 PyHPC 2016 PyCon Jamaica 2016 项目 ~ 包/模块/库/片段… ...
原文: Import Python Weekly Newsletter - Issue No 94 欢迎, 来 PyChina/weekly 共同翻译/增订/推荐 周刊 蠎消息 ;-) 该读 ~ 文章, Blog, 教程… 介绍 Djaneiro, 专注 Django 开发的 Sublime Text 插件. django, sublime In this review I’ll explain how Djaneiro can make your Django development workflow more productive and I’ll go over the pros and cons of the plugin as I experienced them. After that I’ll take a look at alternatives to Djaneiro in the Sublime Text plugin landscape. At the end I’ll share my final verdict and ratings. (是也乎: Djaneiro ~ 专门为 subl 用户打造的 django 环境… 由于出色的接口, subl 现在比 eclipes 当年的插件社区还要活跃… ) PyData DC 2016 –5种 Python 函式 core python Talk by Steven F. Lott. Python AST 探险家 AST Write Python code and see how the ast looks like in the browser right now. No installation needed. (是也乎: 在线实时代码编译结构观察服务 ) Python 作弊条 resource This project tries to provide a lot of piece of Python code that makes life easier. (是也乎: 其实就是 mini 版本的 Python Cookbook 使用 virtualenv 发布本地文档网站 ) pandasql: 让 Python 讲 SQL sql pandasql, a Python package we (Yhat) wrote that emulates the R package sqldf. It’s a small but mighty library comprised of just 358 lines of code. The idea of pandasql is to make Python speak SQL. For those of you who come from a SQL-first background or still “think in SQL”, pandasql is a nice way to take advantage of the strengths of both languages. (是也乎: 作为 Rodeo IDE 插件诚意之作; 只有 358 行代码! ) 用来学习二叉树的 Python 库 opensource project BinaryTree is a minimal Python library which provides you with a simple API to generate, visualize and inspect binary trees so you can skip the tedious work of mocking up test trees, and dive right into practising your algorithms! Heaps and BSTs (binary search trees) are also supported. Patat – 又一个终端上的幻灯工具,基于 Pandoc opensource project patat (Presentations And The ANSI Terminal) is a small tool that allows you to show presentations using only an ANSI terminal. It does not require ncurses. (是也乎: ) PyCon 2017 网站已上线 pycon PyCon 2017 ( US ) site is live. Note - Registration starts on Oct 17th. If you are looking to speak/attend reach out dates for talk/tutorial/paper aka Call For Proposals ( CFP ) submission. 异步 Python: 不同机制的并发 - By Abu Ashraf Masnun concurrency In this post we shall explore the different ways we can achieve concurrency and the benefits/drawbacks of them. With the advent of Python 3 the way we’re hearing a lot of buzz about “async” and “concurrency”, one might simply assume that Python recently introduced these concepts/capabilities. But that would be quite far from the truth. We have had async and concurrent operations for quite some times now. Also many beginners may think that asyncio is the only/best way to do async/concurrent operations. 功能性 Python core python Functional programming is a discipline, not a language feature. It is supported by a wide variety of languages, although those languages can make it more or less difficult to practice the discipline. Python has a number of features that support functional programming, including map/reduce functions, partial application, and decorators. (是也乎: 功能性编程,而不是函式编程,又一门新的编程学科… ) Python 旋风之旅 python3 Jake VanderPlas explains Python’s essential syntax and semantics, built-in data types and structures, function definitions, control flow statements, and more, using Python 3 syntax. (是也乎: 针对 Py3 新用户的简介 ) 介绍 Python 图像库 / Pillow pillow The Python Imaging Library or PIL allowed you to do image processing in Python. Here is a tutorial. (是也乎: 瞌睡送枕头,对于图像处理,现在都用 Pillow 了 ) 用 Python 如何构造图像间的差异 image processing, pillow For the past couple of years, I’ve been writing automated tests for my employer. One of the many types of tests that I do is comparing how an application draws. Does it draw the same way every single time? If not, then we have a serious problem. An easy way to check that it draws the same each time is to take a screenshot and then compare it to future versions of the same drawing when the application gets updated. 获得 Python 模块的所有属性名称和类型 code snippet This recipe shows how to get the names and types of all the attributes of a Python module. This can be useful when exploring new modules (either built-in or third-party), because attributes are mostly a) data elements or b) functions or methods, and for either of those, you would like to know the type of the attribute, so that, if it is a data element, you can print it, and if it is a function or method, you can print its docstring to get brief help on its arguments, processsing and outputs or return values, as a way of learning how to use it. (是也乎: 也只有 Python 这种有足够内省能力的语言,才可以随时拷问出这么丰富的信息来; 代码来自: http://jugad2.blogspot.in/2016/10/get-names-and-types-of-python-modules.html ) 活动 ~ Upcoming Conference / User Group Meet Python Northwest PyCon CZ 2016 PyCon HK 2016 PyCon Finland 2016 PyCon Ireland 2016 PyCon Canada 2016 项目 ~ 包/模块/库/片段… ...
原文: Import Python Weekly Newsletter - Issue No 93 欢迎, 来 PyChina/weekly 共同翻译/增订/推荐 周刊 蠎消息 ;-) 该读 ~ 文章, Blog, 教程… 为 Python 开发者配置 Sublime Text sublime We have been sharing Daniel’s articles and videos from this youtube channel dedicated to Python and Sublime for a while now https://www.youtube.com/channel/UCI0vQvr9aFn27yR6Ej6n5UA . Today Daniel published his book on Sublime Text for Python Developers. Have a look if you use sublime text. Here is a 30% discount for all ImportPython Subscribers. (是也乎: 价值 $29 的课程 ) 用 Flask 和 SQLAlchemy 实现 “Soft Delete” 模式 flask, SQLAlchemy You can find lots of reasons to never delete records from your database. The Soft Delete pattern is one of the available options to implement deletions without actually deleting the data. It does it by adding an extra column to your database table(s) that keeps track of the deleted state of each of its rows. This sounds straightforward to implement, and strictly speaking it is, but the complications that derive from the use of soft deletes are far from trivial. In this article I will discuss some of these issues and how I avoid them in Flask and SQLAlchemy based applications. (是也乎: 简单的说, 手写 SQL 可以轻易作的事儿,在 ORM 世界中,嗯哼… ) 通过 Python 的 Data Visualization Landscape 进行动态游历(包含 ggplot 以及 Altair) data visualization Comprehensive listing of all data visualization packages with small codesnippets. 在 Django 折腾并发数据的正确姿势 django Guilherme Caminha explores the utility of using on_commit hook available from 1.9 onwards in sequencing part of a time consuming task in django view and rest offloaded to an async process. 思考一下协程 async-io Lukasz Langa uses asyncio source code to explain the event loop, blocking calls, coroutines, tasks, futures, thread pool executors, and process pool executors. (是也乎: 这是 go 的核心竞争力,其实 py 也早已有了对应的机制,只是…. ) 自动为 click 应用生成 man 说明 opensource project Click is my go to Python package for creating command line applications. click-man will generate one man page per command of your click CLI application specified in console_scripts in your setup.py. (是也乎: http://click.pocoo.org/ 对的只出精品的 pocoo 团队的 CLI 工具包 ) 当周PyDev: Bryan Van de Ven interview Bryan is a core developer of the Bokeh project, which is a visualization package for Python. He has also helped with the development of Anaconda. (是也乎: 名字有 van 的, 都是贵族后代, 同时在 Anaconda 和 数据可视化领域都有深入的强人… ) Flashlight 是分析及解决四旋翼控制问题的轻量级 Python 库. Flashlight enables you to easily solve for minimum snap trajectories that go through a sequence of waypoints, compute the required control forces along trajectories, execute the trajectories in a physics simulator, and visualize the simulation results. (是也乎: 当然,不是 DJI 开源的 ) Church opensource project Church is a library to generate fake data. It’s very useful when you need to bootstrap your database. (是也乎: 专注自动生成徦数据的库,再也不用折腾 SQL 了… ) 5 music things and Python Raspberry and Python projects/scripts. (是也乎: ) validr A simple,fast,extensible python library for data validation. (是也乎: 简单,快速,可拓展的数据校验库; 国人作品, 仅支持 Py 3.3+; 使用 tox 管理 pytest 测试案例… 私人官网果然也关注了 “新人到底需要什么” 长线讨论: Python入门指北 ) 活动 ~ Upcoming Conference / User Group Meet Santa Cruz Python Meetup Python Brasil [12] PyCon Ireland 2016 PyCon Canada 2016 PyData Cologne 2016 GeoPython 2017 项目 ~ 包/模块/库/片段… ...