Brought to you by Michael and Brian - take a Talk Python course or get Brian's pytest book

#119: Assorted files as Django ORM backends with Alkali

Published Tue, Feb 26, 2019, recorded Mon, Feb 25, 2019

Sponsored by pythonbytes.fm/datadog

Special guests

Michael #1: Incrementally migrating over one million lines of code from Python 2 to Python 3

  • Weighing in at over 1 million lines of Python logic, we had a massive surface area for potential issues in our migration from Python 2 to Python 3
  • First Py3 commit, hack week 2015
    • Unfortunately, it was clear that many features were completely broken by the upgrade
  • Official start H1 2017
  • Armed with Mypy, a static type-checking tool that we had adopted in the interim year, they made substantial strides towards enabling the Python 3 migration:
    • Ported our custom fork of Python to version 3.5
    • Upgraded some Python dependencies to Python 3-compatible versions, and forked some others (e.g. babel)
    • Modified some Dropbox client code to be Python 3 compatible
    • Set up automated jobs in our continuous integration (CI) to run the existing unit tests with the Python 3 interpreter, and Mypy type-checking in Python 3 mode
  • Crucially, the automated tests meant that we could be certain that the limited Python 3 compatibility that existed would not have regressed when the project was picked up again.
  • Prerequisites
  • Before we could begin working on migrating any of our application logic, we had to ensure that we could load the Python 3 interpreter and run until the entry point of the application. In the past, we had used “freezer” scripts to do this for us. However, none of these had support for Python 3 around this time, so in late 2016, we built a custom, more native solution which we internally referred to as “Anti-freeze” (more on that in the initial Python 3 migration blog post).
  • Incrementally enabling unit tests and type-checking
  • ‘Straddling’ Python 2 and Python 3
  • Letting it bake
  • Learnings (tl;dr)
    • Unit tests and typing are invaluable.
    • String encoding in Python is hard.
    • Incrementally migrate to Python 3 for great profit.

Eric #2: Network Automation Development with Python (for fun and for profit)

Trey #3: Alkali file as DB

  • If you have structured data you want to query (like RSS feed, CSV, JSON, or any custom format of your own creation) you can use a Django ORM-like syntax to query it
  • Save it to the same format or a different format because you control both the reading and the writing
  • Kurt is at PyCascades so I got to chat with him about this

Dan #4: Carnegie Mellon Launches Undergraduate Degree in Artificial Intelligence **

  • Carnegie Mellon University's School of Computer Science will offer a new undergraduate degree in artificial intelligence beginning this fall
  • The first offered by a U.S. university
  • "Specialists in artificial intelligence have never been more important, in shorter supply or in greater demand by employers," said Andrew Moore, dean of the School of Computer Science.
  • The bachelor's degree in AI will focus more on how complex inputs — such as vision, language and huge databases — are used to make decisions or enhance human capabilities

Michael #5: asyncio + PyQt5/PySide2

Dan #6: 4 things I want to see in Python 4.0

  1. JIT as a first class feature
  2. A stable .0 release
  3. Static type hinting
  4. A GPU story for multiprocessing
  5. More community contributions

Extras:

Michael: My Python Async webcast recording is now available. Michael: PyCon Israel in the first week of June (https://il.pycon.org/2019/), and the CFP opened today: https://cfp.pycon.org.il/conference/cfp Dan: Python Basics Book

Joke:

  • Q: Why did the developer ground their kid?
  • A: They weren't telling the truthy

Want to go deeper? Check our projects