On Saturday, September 21st, I attended PyCon China 2019 in Shanghai, the annual Python China Developer conference.

This year’s Shanghai lineup is much larger than previous years, with smooth Python author, Flask author and core maintainer, PyCharm developer and many more presenting on stage.

This article will summarize the speech I watched, but it will not be in-depth and complete. If you are interested in the topic, you can wait for the official video to be released later, and my official account will also republish it then.

The eternal beauty of Python

Luciano Ramalho, author of “Smooth Python,” was the first speaker to talk about Zen in Python (PEP 20: The Zen of Python, combining chess, Go, and even The I Ching, reinterprets The beauty of Python syntax.

He also said that Python is a great place for women to develop, noting that there are many women on the Python development team, and poking fun at Python author Guido for only answering questions from women during his talk.

Image classification through Azure

The second session was hosted by Microsoft developer Dave Glover, who introduced how to build a IoT image classification system using Python and Microsoft Azure’s free cloud service. He also demonstrated how to develop a fruit classification function. After a simple training of images of different fruits, It can be used to quickly calculate the price of different fruits at the supermarket checkout counter. .

In addition, Microsoft VS Code also announced new features in Python during the afternoon, which can be seen in the public account.

AWS Serverless one-stop development

After the first two English listening sessions, the third session will be with Hong En Hsieh from Taiwan, who is the AWS Serverless and Container Expert solution architect. He introduced the new technologies AWS has released in the Serverless space in recent years, including:

  • AWS Lambda
  • AWS SAR (Serverless Application Repository)
  • AWS CDK (Cloud Development Kit)

These techniques are used to enable Python developers to deploy in a one-stop shop without a server (and in many other languages), and they are also used in microservices frameworks.

In addition, in the afternoon, Teacher Xie also held a 3-hour AWS WorkShop, where he guided developers to complete a complete project in AWS CDK from scratch. Unfortunately, due to the time conflict, I did not choose to attend.

Flask author on debugging

Armin Ronacher, author of Flask, Werkzeug, Jinja2, Click, and many more open source projects, talks about his new perspective on Python debugging and his recent development experience with the Rust language, which shows that Python’s slower performance can actually help debugging.

Unfortunately, his English was very fast and the PPT content was few, so I didn’t understand too many details. I need to wait for the video to review again.

New implementation on debugging

The last session of the morning, by Laike9m, a Google software engineer and creator of the Snake Catcher Podcast, is also about debugging, but he brings a new idea and an implemented open source library called Cyberbrain.

The main idea is to track the target variable, through the visual interface to see the process of variables from initialization to the target line, so as to help quickly locate bugs.

Here is a sample code:

def func_f(bar):
    x = len(bar)
    return x

def func_c(baa):
    baa.append(None)
    baa.append('? ')

def func_a(foo):
    for i in range(2) :pass
    ba = [foo]
    func_c(ba)
    foo = func_f(ba)
    cyberbrain.register(foo)

import cyberbrain
cyberbrain.init()
fo = 1
func_a(fo)
Copy the code

By registering the foo variable, we can produce the following output:

It also supports persistent storage and debugging even on the server.

AIOps data center with Python

The matinees all started at the same time, so I had to listen to the ones I was interested in.

In the last two years, the concept of “Zhongtai” is quite popular, and our company already has Zhongtai, so I choose this topic of zhongtai for the first time. The guest is Ding Laiqiang from Ali Cloud log service.

The content of his speech is mainly to introduce the many AIOps platforms in the market at present, and how to build the data center through the open source AIOps to solve the data collection, algorithm processing massive logs and other problems that used to need a lot of manpower.

As for the future of Ops, he says:

According to Gartner’s report, AIOps will emerge in the next 5-10 years and unify the various Ops platforms (Dev, IT, Net, Sec).

Django uses GraphQL

GraphQL, Facebook’s publishing API query language, is designed to provide an alternative to RestFul architecture, but has never been used or even known.

The problem with RestFul apis is that the returned data structures and types are defined by the back end. As the front-end requirements change, the back end also changes. If it is a medium or large project, changing the interface will cause a lot of work.

GraphQL addresses this pain point by allowing the front end to customize the request fields and structure, and the back end to focus on request logic and database mapping. Specific no longer more introduction, can consult relevant information.

LeetCode backend architect Qiyu Li explained that In the last two years, LeetCode has replaced all interfaces composed of more than 100,000 lines of Django code with GraphQL.

The benefits of the replacement, as described above, make interface iteration more flexible. He mainly shared some problems encountered during the period and how to overcome them, such as data conversion, query performance optimization, etc.

However, he does not recommend using GraphQL for the time being if the interface performance requirements are high.

Build an automated test cluster

This session is about Yang Liu, head of netease Airtest team. The first half of the session is about Airtest, an open source automation test framework, which has advantages in cross-platform, especially in App and mobile games. The image recognition and control recognition integrated by the framework greatly increase the automation ability.

The second part is to share how netease games has gradually expanded automated testing into large-scale testing clusters, and introduced how to use 3×4 small cabinets to achieve an enterprise-level, privatized testing solution.

Build RPC in Python

Rujia Zhang, a senior engineer from Ele. me, introduces thrift, the RPC protocol, its application in the current microservices architecture, the difference between Thriftpy and ThriftPy2 implemented by Python, and their application scenarios.

He then shared the process of building an RPC protocol architecture using Thriftpy, how the different layers were designed, and how some of the communication and transport issues were resolved.

The lightning speech

The last session was a new session of PyCon. Each guest only had 5 minutes to give a speech. Unfortunately, some guests failed to finish their speech due to overtime, resulting in poor actual effect.

One impressive topic, however, is converting C/C++ code into.pyd files that Python can call directly.

The speaker is Wei Zehua of Weiner Technology in Shanghai. He implemented this feature and opened it as c2py. Compared with Swig, c2py is much easier to use, without writing interface files like Swig.

Impressions of the conference

There has been great progress compared with the previous period, mainly as follows:

  • This year, there are many famous project core developers sharing their unique insights in their respective fields.
  • The establishment of a separate venue has fully expanded the topic range of the presentation, and also met the different concerns of developers from different directions.

But there are still some regrets, such as:

  • In the middle of the first session, the AI interpreter of a sponsor inexplicably went on strike and did not restart the whole morning. As a result, our English was hard to absorb the speeches of three foreign bigwigs.
  • The WorkShop will be held in the afternoon. If I choose it, I will miss three speeches in the same time period, so I have to give up participating.

In general, this year’s harvest is still very good, the ticket price is worth more, and we also see the determination of the organizers to run PyCon China well. I hope to come again next year, see you next year!


All photos are taken by PyCon China

This article belongs to the original content, first published in the wechat public account “life oriented programming”, if you need to reprint, please leave a message in the public account background.