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

#104: API Evolution the Right Way

Published Sat, Nov 17, 2018, recorded Thu, Nov 15, 2018

Python Bytes 104

Sponsored by DigitalOcean: pythonbytes.fm/digitalocean

Michael #0.1: Chapters and play at

  • Chapters are now in the mp3 file
  • Play at button on the website (doesn’t work on iOS unless you click the play to start it)

Michael #0.2: Become a friend of the show

Brian #1: wily: A Python application for tracking, reporting on timing and complexity in tests and applications.

  • Anthony Shaw (aka “Friend of the Show”, aka “Ant”)
  • (if listing 2 “aliases, do you just put one “aka” or one per alias?)
  • I should cover this on Test & Code for the content of the package. But it’s the actual packaging that I want to talk about today.
  • Wily is a code base that can be used as an example of embracing pyproject.toml (pyproject.toml discussed on PB 100 and T&C 52)
  • A real nice clean project using newer packaging tools that also has some frequently used bells and whistles
  • NO setup.py file
  • wily’s pyproject.toml includes
    • flit packaging, metadata, scripts
    • tox configuration
    • black configuration
  • project also has
    • testing done on TravisCI
    • rst based docs and readthedocs updates
    • code coverage
    • black pre-commit for wily
    • pre-commit hook for your project to run wily
    • CONTRIBUTING.md that includes code of conduct
    • HISTORY.md with a nice format
    • tests using pytest

Michael #2: Latest VS Code has Juypter support

  • In this release, closed a total of 49 issues, including:
    • Jupyter support: import notebooks and run code cells in a Python Interactive window
    • Use new virtual environments without having to restart Visual Studio Code
    • Code completions in the debug console window
    • Improved completions in language server, including recognition of namedtuple, and generic types
  • The extension now contains new editor-centric interactive programming capabilities built on top of Jupyter.
  • have Jupyter installed in your environment (e.g. set your environment to Anaconda) and type #%% into a Python file to define a Cell. You will notice a “Run Cell” code lens will appear above the #%% line:
  • Cells in the Jupyter Notebook will be converted to cells in a Python file by adding #%% lines. You can run the cells to view the notebook output in Visual Studio code, including plots

Brian #3: API Evolution the Right Way

  • A. Jesse Jiryu Davis
  • adding features
  • removing features
  • adding parameters
  • changing behavior

Michael #4: PySimpleGUI now on Qt

  • Project by Mike B
  • Covered back on https://pythonbytes.fm/episodes/show/90/a-django-async-roadmap
  • Simple declarative UI “builder”
  • Looking to take your Python code from the world of command lines and into the convenience of a GUI?
  • Have a Raspberry Pi with a touchscreen that's going to waste because you don't have the time to learn a GUI SDK?
  • Look no further, you've found your GUI package.
  • Now supports Qt
  • Modern Python only
  • More frameworks likely coming

Brian #5: Comparison of the 7 governance PEPs

  • Started by Victor Stinner
  • The different PEPs are compared by:
    • hierarchy
    • number of people involved
    • requirements for candidates to be considered for certain positions
    • elections: who votes, and how
    • term limits
    • no confidence vote
    • teams/experts
    • PEP process
    • core dev promotion and ejection
    • how governance will be updated
    • code of conduct
  • PEP 8000, Python Language Governance Proposal Overview:
    • PEP 8010 - The Technical Leader Governance Model
    • continue status quo (ish)
    • PEP 8011 - Python Governance Model Lead by Trio of Pythonistas
    • like status quo but with 3 co-leaders
    • PEP 8012 - The Community Governance Model
    • no central authority
    • PEP 8013 - The External Governance Model
    • non-core oversight
    • PEP 8014 - The Commons Governance Model
    • core oversight
    • PEP 8015 - Organization of the Python community
    • push most decision-making to teams
    • PEP 8016 - The Steering Council Model
    • bootstrap iterating on governance

Michael #6: Shiboken (from Qt for Python project)

  • From PySide2 (AKA Qt for Python) project
  • Generate Python bindings from arbitrary C/C++ code
  • Has a Typesystem (based on XML) which allows modifying the obtained information to properly represent and manipulate the C++ classes into the Python World.
  • Can remove and add methods to certain classes, and even modify the arguments of each function, which is really necessary when both C++ and Python collide and a decision needs to be made to properly handle the data structures or types.
  • Qt for Python: under the hood
  • Write your own Python bindings
  • Other options include:

Extras:


Want to go deeper? Check our projects