Evolution of Modern Python

 

 

Keynote, 2021-01-30

Alexander Hultnér, BelPy Online 2021

@ahultner

Alexander Hultnér

Founder of Hultnér Technologies

 

 

@ahultner

Introduction

Focus forward on Modern Python's (3) evolution, not the transition from Python 2

 

Timeline

  • Python 3 release, December 3, 2008

  • Python 2.7 release, June 2009

  • Python 2 EoL, January 1, 2020

@ahultner

Where it all started

2015-2016

 

Heliospectra

  • LED Grow Lights
  • Smart control systems for commercial greenhouses
  • Even worked with ESA (European Space Agency) in the Eden-ISS project
    Anyone seen "The Martian"?

@ahultner

@ahultner

Where it all started

Next generation control systems

 

Old software

  • Desktop app in Python 2 aimed towards researchers.

New system

  • Adapted for commercial greenhouses.
  • Requires industrial scale, in-facility hardware, remote control, third party integration.

So can we use Modern Python, i.e. Python 3?

@ahultner

Where it all started

Next generation control systems

 

New system

  • Modular architecture
  • Inter-process communication
    enables multiple versions, and languages
  • Python 3.4, and then 3.5
  • Python 2 was never needed

@ahultner

I'm fully convinced, Python 3 is great!

Python 3.4

Release Date: March 17, 2014

 

Significant features

@ahultner

 

And many more in the release notes

Python 3.5

Release Date: Sept. 13, 2015

 

Significant features

  • PEP 448, additional unpacking generalizations,
    Splat operators: *[…], **{…}

  • PEP 492, coroutines with async and await syntax
  • PEP 484, the typing module, a new standard for type annotations
  • PEP 441, improved Python zip application support

@ahultner

 

And many more in the release notes

Time to level up!

2017–2018

  • Prototyping new application
    Great opportunity to utilise new features
    • f-strings
    • type-annotations
    • dataclasses
  • Weekend project
    • dataclasses with run-time type-checker and JSON parsing/formatting
  • GothPy
  • PyCon SE

@ahultner

Python 3.6

@ahultner

Release Date: Dec. 23, 2016

 

Significant features

  • PEP 498, Literal String Formatting, f-strings
  • PEP 468, Preserving Keyword Argument Order
  • PEP 530, Asynchronous Comprehensions
  • Ordered dicts (de-facto standard)

  • dataclasses ("backport" via pip install)

  • math.tau = 2π 😉

 

And many more in the release notes

Python 3.7

 

@ahultner

Release Date: June 27, 2018

 

Significant features

  • Ordered dicts (official standard)
  • PEP 557, Data Classes (built-in)
  • Two-way iso format for date-times
  • Significant speedups 

 

And many more in the release notes

A new dawn

@ahultner

2019-present

 

Reincorporated my business
Hultnér Technologies AB

  • Python 3.8 Walrus Operator ":=" article
    • More popular than I'd ever imagined
    • Ranks 1-2 on Google for "walrus operator"
    • Passed 100 000 views some time back
    • Featured by medium curators, newsletters,
      Python Bytes Podcast, various news sites, etc.
  • Property Based Testing, Foss-North & PyCon SE

A new dawn

@ahultner

2020, covid hits

 

Some good things

  • Python 2 EoL, hence this talk
  • Remote conferences increase accessibility, I've been able to talk at conferences every month.
    (But I still miss the social aspect)
  • Python 3.9 is out
  • Lots of interesting things in the Python world like Schemathesis and Pyston2
  • Less time commuting => more time to experiment

Schemathesis

@ahultner

A better way to handle API testing

 

  • Uses OpenAPI to automatically generate tests
  • Easy to use!
  • Based on randomised, property based testing
  • EuroPython Talk on YouTube
  • GitHub Repo, Docs
  • Test more with less!

Papero.io

@ahultner

About experimenting more, with Magnus Junghard

 

  • Backend in Python 3.8 & 3.9
  • Async I/O, FastAPI Starlette, async task workers
  • Type annotations everywhere, mypy
    • Automatically generated TypeScript API interfaces based on backend types & schemas
    • Pydantic runtime type-checking
  • Randomised, property based testing
  • Deliver better results faster!

Papero.io

@ahultner

About experimenting more, with Magnus Junghard

 

Okay, so what is Papero.io?

Create beautiful PDFs using dynamic HTML, CSS and JavaScript, or why not Django, maybe Flask?

 

Turn-key API as a service, or on premise.

Closed beta list opened recently.

Papero.io/beta for waitlist

Python 3.8

 

@ahultner

Release Date: Oct. 14, 2019

 

First release with Steering Council

 

Significant features

  • PEP 572, Assignment expressions, "Walrus operator"
  • PEP 570, Positional-only arguments
  • Stabilize

 

More in the release notes

Python 3.9

 

@ahultner

Release Date: Oct. 5, 2020

 

Significant features

  • PEP 602, Stable annual releases
  • PEP 584, Union Operators in dict
    • Merge dicts with a|b, instead of {**a, **b}
  • PEP 585, Type Hinting Generics In Standard Collections
    • Use "list" instead of "typing.List", etc
  • PEP 617, New PEG parser for CPython

 

More in the release notes

What does the future hold?

 

@ahultner

Near Future

  • Python 3.10
    • PEP 634 - Structural Pattern Matching: Specification
  • MyPy constantly evolving
    • New type checkers popping up
  • Community is growing at an ever increasing pace!

Further ahead

  • Python 4, will it be another 2->3 transition?
    • No, everyone's learned since last time

Questions

Contact me if you have any further

questions.

 

Want to learn more?

Available for training, workshops and freelance consulting.
 

 

Papero.io/beta

Previous talks on YouTube

Links

@ahultner

BelPy 2021, Keynote: Evolution of Modern Python

By Alexander Hultnér

BelPy 2021, Keynote: Evolution of Modern Python

Keynote presentation for BelPy 2021

  • 1,117