蠎加载 171

原文: Import Python Weekly Newsletter - Issue No 171 欢迎, 来 PyChina/weekly 共同翻译/增订/推荐 周刊 蠎消息 ;-) 该读 ~ 文章, Blog, 教程… 最好的 Python:从2017年到2018年收藏的一系列文章(到目前为止) 2017, python articles In this article, I’d like to share with you the articles I found most interesting and insightful (inspiring) last year and this year (so far). My other goal was to create a comprehensive list of the most valuable pieces for my Python students. (是也乎: 老司机的私人体验, 应该就是 Py 自身真正的好物了… ) Python 3.7: 介绍数据类 pycharm, data classes Python 3.7 is set to be released this summer, let’s have a sneak peek at some of the new features! If you’d like to play along at home with PyCharm, make sure you get PyCharm 2018.1 (or later if you’re reading this from the future). There are many new things in Python 3.7: various character set improvements, postponed evaluation of annotations, and more. One of the most exciting new features is support for the dataclass decorator. (是也乎: 怀疑哪, Py3 这么多激荡的变化, 是否有 IDE 厂商的嗯哼? ) Qt 让 Python 令计算贴近你 - Qt Blog pyside PySide2 – the bindings from Python to Qt – changes skin this spring. We have re-branded it as Qt for Python on a solution level, as we wanted the name to reflect the use of Qt in Python applications. Under the hood it is still PySide2 – just better. (是也乎: Qt 开源后走的一直不错, 只是太慢, 就连 IDE 都一直非常不嗯哼…这种广告都没有 subl 来的多…可想… ) 转换 Python ASTs 来优化 AST tl;dr Python comprehensions can have duplicate function calls (e.g. [foo(x) for x in … if foo(x)]). If these function calls are expensive, we need to rewrite our comprehensions to avoid the cost of calling them multiple times. In this post, we solve this by writing a decorator that converts a function in to AST, optimizes away duplicate function calls and compiles it at runtime in ~200 lines of code. (是也乎: 不过,这种机械优化, 永远没有人工介入后, 经验加成的效果好… ) Cgo 和 Python go, cpython If you look at the new Datadog Agent, you might notice most of the codebase is written in Go, although the checks we use to gather metrics are still written in Python. This is possible because the Datadog Agent, a regular Go binary, embeds a CPython interpreter that can be called whenever it needs to execute Python code. This process can be made transparent using an abstraction layer so that you can still write idiomatic Go code even when there’s Python running under the hood. (是也乎: 通过 C , go 和 python 一直灵魂相通的… ) 用 Python 进行机器学习的一些基本技巧和窍门 machine learning We describe some essential hacks and tricks for practicing machine learning with Python. 在 Kubernetes 中部署深度学习 GPU 运算模型 deep learning, GPU In this tutorial, we provide step-by-step instructions to go from loading a pre-trained Convolutional Neural Network model to creating a containerized web application that is hosted on Kubernetes cluster with GPUs on Azure Container Service (AKS). AKS makes it quick and easy to deploy and manage containerized applications without much expertise in managing Kubernetes environment. It eliminates complexity and operational overhead of maintaining the cluster by provisioning, upgrading, and scaling resources on demand, without taking the applications offline. AKS reduces the cost and complexity of using a Kubernetes cluster by managing the master nodes for which the user does no incur a cost. (是也乎: 这类工具一定会越来越方便的, 问题在 GPU 本身是硬件, 有固定成本, 这就是门槛了… ) Python 3 cheatsheet cheatsheet (是也乎: 叕一则作弊条…但是, 最靠谱的还是多用… ) Python 3 到 ES6 Javascript 转译器 js (是也乎: 没毛病, 问题只是, 这种转换的使用场景在哪儿? ) 用 PySpark 进行单元测试 – CambridgeSpark testing I don’t particularly enjoy writing tests, but having a proper testing suite is one of the fundamental building blocks that differentiate hacking from software engineering. Sort of like sending your application to the gym, if you do it right, it might not be a pleasant experience, but you’ll reap the benefits continuously. At work we are especially big fans of the testing pyramid, and having dozens of unit tests give us the support that we need to deliver high quality software with rapid delivery to production. (是也乎: 叕一个单元测试框架, ) 好物 ~ 包/模块/库/片段… ...

2018-04-22 · 4 min · 1979 words · ZoomQuiet

蠎加载 170

原文: Import Python Weekly Newsletter - Issue No 170 欢迎, 来 PyChina/weekly 共同翻译/增订/推荐 周刊 蠎消息 ;-) 该读 ~ 文章, Blog, 教程… Slicker: 用 Python 来移动东西的工具 | Khan Academy Engineering slicker Craig talked last post about our project to reorganize our whole Python codebase. This entails a lot of architectural challenges – deciding where to put each file, prioritizing which files and classes to split, and so on – which Carter will talk about more in the final post of this series. Today, I want to set all that aside to focus on the more mechanical process of moving: what does it take to move thousands of files, classes, and functions, each of which may be referenced by dozens or hundreds of others? We ended up writing a tool called Slicker to do it all, and the remainder of this post talks about why we needed it and how it works. (是也乎: 针对移动大量文件这一基础命题, 可汗学院嗯哼出了一大套课程… ) 嫑写 Idiomatic Python idiomatic python Write Understandable Code. There are two sides to every story :) (是也乎: 传统-反传统-约定-反约定… 好象 蠎之 Zen 中就说了相关决策原则… ) 用 Brexit 在 Python 中分析 Tweets 情感 sentimentanalysis Sentiment analysis is a method of analyzing a piece of text and deciding whether the writing is positive, negative or neutral. It is commonly used to understand how people feel about a topic. 不仅是 Python 的另一个 YOLO V3 image processing If you are interested on Computer Vision, then you have probably heard about YOLO by now. YOLO?—?“You Only Look Once” is a fast, real-time technique for object detection. (是也乎: YOLO — “You Only Look Once” 只用看一眼 ~ 物件识别模块名称, 起名学功力很够 ;-) 全新实现的: madhawav/YOLO3-4-Py: A Python wrapper on Darknet. Compatible with YOLO V3. 基本上就是大规模人流监控的基本模块了… ) Python 的多线程 multithreading This blog post is about Processes, Threads, and the GIL in Python. Because of the way that the Python GIL operates, it may be different than one initially expects, so this blog post is an attempt to discuss this in more detail. 通过 Python 了解区块链 blockchain About two weeks ago I realized why I had such an animosity towards bitcoin: I didn’t own any and I didn’t understand it. I decided to start learning about bitcoin through researching the technology behind it, aka block chain. I learned through creating a python script that builds a block chain, so I thought I would share it with others who would like to learn more about block chain. To clarify, while I was inspired by bitcoin, this post is focused on block chain. (是也乎: 其实: 区块链随想录——一种设想中的公链架构 - 简书 ) 成千上万错误配置的 Django 应用泄露敏感数据 django, debugmode The security researcher Fábio Castro discovered tens of thousands of Django apps that expose sensitive data because developers forget to disable the debug mode. (是也乎: PHP/MySQL/MongoDB/… 现在终于到了 Django, 凡是大规模嗯哼的, 必定基于默认配置暴露各种嗯哼… ) Nathaniel’s Python 从 Go 中学到的经验教训 golang Go is cool. Python type annotations with mypy are cool. Go has influenced how I write Python. (是也乎: Gopher 和 Pythonista 一直是水乳交融的 ) gopro-py-api: 非官方 Python 版 GoPro API库 gopro Unofficial GoPro API Library for Python - connect to GoPro cameras via WiFi. (是也乎: 叕一例硬件的非官方操控接口, 可想硬件的安全能力实在… ) 数据分析: Pandas 和 SQL 教俺平均值 | Opensource.com pandas Why data analysts should exercise caution when taking averages. 用高级 TensorFlow API 进行文本分类 tensorflow In this blog post we share our experience, in considerable detail, with using some of the high-level TensorFlow frameworks for a client’s text classification project. These include the Estimator framework and feature columns. (是也乎: 目测, 所谓高级都是从 Google 一生产线退役的旧功能组件 ) 好物 ~ 包/模块/库/片段… ...

2018-04-08 · 4 min · 1544 words · ZoomQuiet

蠎加载 169

原文: Import Python Weekly Newsletter - Issue No 169 欢迎, 来 PyChina/weekly 共同翻译/增订/推荐 周刊 蠎消息 ;-) 该读 ~ 文章, Blog, 教程… 用 GoCD 在 K8s 上持续交付 offtopic GoCD now integrates natively with Kubernetes! GoCD’s pipeline capability along with Kubernetes’ highly programmable platform provide you the premiere Continuous Delivery tool on modern infrastructure. (是也乎: G 字开头的一般都是… ) 用 Python分析 14 亿行代码 ngram The Google Ngram viewer is a fun/useful tool that uses Google’s vast trove of data scanned from books to plot word usage over time. (是也乎: PyTubes 的广告? ) 如何在 Pandas 中重写 SQL 查询, 等等 pandas, sql SQL was a go-to tool when you needed to get a quick-and-dirty look at some data, and draw preliminary conclusions that might, eventually, lead to a report or an application being written. This is called exploratory analysis. These days, data comes in many shapes and forms, and it’s not synonymous with “relational database” anymore. You may end up with CSV files, plain text, Parquet, HDF5, and who knows what else. This is where Pandas library shines. 用 Gensim 进行主题建模 (Python) - 实用指南 gensim Topic Modeling is a technique to extract the hidden topics from large volumes of text. Latent Dirichlet Allocation(LDA) is a popular algorithm for topic modeling with excellent implementations in the Python’s Gensim package. The challenge, however, is how to extract good quality of topics that are clear, segregated and meaningful. Tthis depends heavily on the quality of text preprocessing and the strategy of finding the optimal number of topics. This tutorial attempts to tackle both of these problems. (是也乎: 那什么, 不是 3D 建模, 是文本分析中的主题分类… ) Python Exceptions 权威性指南 exceptions Three years after my definitive guide on Python classic, static, class and abstract methods, it seems to be time for a new one. Here, I would like to dissect and discuss Python exceptions. (是也乎: Python异常的权威性指南 这种翻译, 怎么看怎么无法接受… ) ...

2018-04-02 · 4 min · 1524 words · ZoomQuiet

蠎加载 168

原文: Import Python Weekly Newsletter - Issue No 168 欢迎, 来 PyChina/weekly 共同翻译/增订/推荐 周刊 蠎消息 ;-) 该读 ~ 文章, Blog, 教程… 2017 以及 2018 学年 Python 中重构的伟大 - Khan Academy Engineering core-python, refactor This blog post is first in a series describing the Great Khan Academy Python Refactor of 2017 And Also 2018. In this post, I’ll explain where our codebase went wrong, what we wanted to do to fix it, and why it was so difficult. It will include tips and code that others can use to avoid some of this difficulty themselves. The second post will describe Slicker, a tool we wrote which formed the backbone of our refactoring effort. The third post will describe how we used this refactoring as an opportunity to reduce inter-file dependencies within our codebase, and how that benefited us. (是也乎: Khan 学院的系列文章, 谈及 Python 开发中常见的一些问题和解决. ) 用 GeoPandas 在 Python 中创建分级统计世界地图 jupyter, geo There are different ways of creating choropleth maps in Python. In a previous notebook, I showed how you can use the Basemap library to accomplish this. More than 2 years have passed since publication and the available tools have evolved a lot. In this notebook I use the GeoPandas library to create a choropleth map. As you’ll see the code is more concise and easier to follow along. (是也乎: 用 matplotlib 来嗯哼, 其实有很多专门的图形库, 可以更加简洁的完成这种绘制了. ) Django CBV 全面指南. django Class Based Views (CBV) is one of my favourite things about Django. During my first Django projects (using Django 1.4 around 6 years ago) I was mainly using functional views — that’s what the tutorial recommended then anyway. However, slowly in my next projects I started reducing the amount of functional views and embracing CBVs, slowly understanding their usage and usefulness. Right now, I more or less only use CBVs for my views; even if sometimes it seems more work to use a CBV instead of a functional one I know that sometime in the future I’d be glad that I did it since I’ll want to re-use some view functionality and CBVs are more or less the only way to have DRY views in Django. 基于 Python DIY 自驾平台 self driving An opensource DIY self driving platform for small scale cars. RC CAR + Raspberry Pi + Python (tornado, keras, tensorflow, opencv,. 和 Python 一起艺术创作 book A book to bring the joy of programming to creative people. With step by step instructions for beginners and tiny programs, fundamental programming concepts are introduced in bite sized sketches. In later chapters, these program sketches become powerful drawing programs, capable of generating new images for 3D printing, CNC, and more. (是也乎: 可惜没有音乐类的创作介绍… ) 用 Python 装饰器进行身份验证 decorator, core-python A Refresher. 棉花糖: 简化Python的对象序列化 serialization Hacker news discussion. (是也乎: 叕一个尝试构建全新数据转换生态的核心模块 marshmallow-code/marshmallow: A lightweight library for converting complex objects to and from simple Python datatypes. 可惜… ) Twitter 分析与 Python twitter Twitter is a good ressource to collect data. We can find a few libraries (R or Python) which allow you to build your own dataset with the data generated by Twitter. This tutorial is focus on the preparation of the data and no on the collect. Throughout this analysis we are going to see how to work with the twitter’s data. (是也乎: 叕一则用 twitter 开放数据来作嗯哼的案例, 所以, Fb 要是象 twitter 一样一直公开就不会出事儿了吧… ) 为 Python 应用构建最小 Docker 容器 docker A best practice when creating Docker containers is keeping the image size to a minimum. The fewer bytes you have to shunt over the network or store on disk, the better. Keeping the size down generally means it is faster to build and deploy your container. 用 Python 构建 Google Analytics Slack Bot analytics Google Analytics is an incredibly powerful tool. All of the members of your team can see everything from which sources your web traffic comes from to what demographics frequent your site. There’s just one problem, Nobody is willing to go to the Google Analytics site and look. If these features aren’t used they may as well not exist. So, to give teammates easier access you can make a custom Slackbot to display Google Analytics. (是也乎: 面对 Slack 以及 Google 这种接口非常开放的服务平台, 用少量代码完成联接, 一直是非常简单的事儿… 可惜… ) 从 python 到 Go 又到 Rust: 自以为是的旅程 golang When looking for a new backend language, I naturally went from Python to the new cool kid: Go. But after only one week of Go, I realised that Go was only half of a progress. Better suited to my needs than Python, but too far away from the developer experience I was enjoying when doing Elm in the frontend. So I gave Rust a try. 好物 ~ 包/模块/库/片段… ...

2018-03-25 · 4 min · 1645 words · ZoomQuiet