List of videos

TALK / Reuven M. Lerner / When is an exception not an exception? Using warnings in Python

If your code encounters a big problem, then you probably want to raise an exception. But what should your code do if it finds a small problem, one that shouldn't be ignored, but that doesn't merit an exception? Python's answer to this question is warnings. In this talk, I'll introduce Python's warnings, close cousins to exceptions but still distinct from them. We'll see how you can generate warnings, and what happens when you do. But then we'll dig deeper, looking at how you can filter and redirect warnings, telling Python which types of warnings you want to see, and which you want to hide. We'll also see how you can get truly fancy, turning some warnings into (potentially fatal) exceptions and handling certain types with custom callback functions. After this talk, you'll be able to take advantage of Python's warning system, letting your users know when something is wrong without having to choose between "print" and a full-blown exception. Slides: https://speakerdeck.com/reuven/when-is-an-exception-not-an-exception-using-pythons-warnings

Watch
TALK / Nina Zakharenko / More Fun With Hardware and CircuitPython - IoT, Wearables, and more!

Learn about programming hardware with Python and advanced uses of CircuitPython by walking through exciting demos of real-world projects in action. Advanced components like buttons, sensors, and screens bump up the fun and the interactivity of your project. Level-up your hardware skills in this fast-paced talk! CircuitPython is the education-friendly fork of MicroPython that's been steadily rising in popularity as new releases increase stability, reliability, and speed. CircuitPython allows Python enthusiasts to quickly learn about hardware projects without having to learn something completely brand new. Given the rise in popularity, the Python community is quickly becoming familiar with the basics of CircuitPython. In fact, all attendees of PyCon US in 2019 were given a CircuitPython-compatible CircuitPlayground Express device with LEDs, speakers, sensors, and more, all usable without the need of learning to solder. If you're interested in doing more with hardware, this talk will point you in the right direction of where to go next. We'll start with choosing the right device for the scope of your project. Next, we'll scratch the surface of working with electronics -- what's a circuit? What are good resources for learning to solder? Lastly, I'll cover topics such as IoT, wearables, and adding interactivity to your projects with sensors, buttons, and switches with live demos of real-world projects I've created, along with sharing the build process and code for each. Viewers will finish the talk feeling confident about continuing their hardware journey across a range of project types. Slides: https://nina.to/pycon2021

Watch
TALK / Dustin Ingram / Secure Software Supply Chains for Python

One of the most powerful parts of Python lies not within the language itself, but within the robust ecosystem of open-source Python packages available to use along with it. The Python Package Index, the canonical repository for Python code, hosts nearly 300,000 different projects. However, integrating software from so many third-parties comes at a cost: how can we be sure it's secure? In this talk, we'll explore the common Python software supply chain, various ways in which such a supply chain can be attacked, as well as protected. We'll examine some tools and methodologies that help improve supply-chain security, and discuss the challenges and benefits these tools provide. Finally, we'll look at what fundamental improvements we can make to the overall ecosystem.

Watch
TALK / Paul Everitt / Static Sites with Sphinx and Markdown

Everybody knows Sphinx for documenting projects, Python and otherwise. But few think of Sphinx for the rest of a website. Why? Because Sphinx traditionally means authoring with reStructuredText instead of Markdown. While RST is very powerful, it's a bit quirky, and nowhere near the popularity of Markdown. But with the arrival of full Markdown support MyST, and with static site generators having a renaissance, it's time to give Sphinx a second look. Sphinx is an "information-rich" static site generator, with rich linking and many other features for authoring a knowledge base. This talk introduces Sphinx for websites, shows enabling MyST for Markdown, and compares what it has to offer versus other approaches. We’ll do a light treatment of customization. All the material in this talk comes from a published tutorial.

Watch
TALK / Jonathan Striebel / Using Declarative Configs for Maintainable Reproducible Code

Wondering how to keep your application config from getting outdated? Looking for a way to future-proof it in a backwards-compatible manner, keeping previous versions reproducible? Join this talk, we’ll share how declarative configs can be leveraged to make your code maintainable and reproducible at the same time. Therefore, an overview across the application config landscape is given – from inputs as cli-args, env-vars, and config-files, to their representations in code, covering serialization & deserialization, type-safety with config-schemas and evolutions. We’ll recommend cherries to pick for a maintainable and expressive declarative config system. All code examples are available at https://github.com/jstriebel/declarative-configs 00:18 *Introduction & Problem Domain* https://scalableminds.com https://webknossos.org https://twitter.com/jostriebel 03:02 *Goals: Maintainability & Reproducability* *Declarative Configurations and their Pythonic Representations* 04:16 Toy Experiment 05:07 Declarative Configuration Exctraction 06:08 Input Formats, Representations & Deserialization https://typer.tiangolo.com https://www.attrs.org https://cattrs.readthedocs.io 08:49 Landscape Overview Blog Post comparing attrs, dataclasses & pydantic: https://stefan.sofa-rockers.org/2020/05/29/attrs-dataclasses-pydantic *Code Examples* 10:10 Toy Example 11:08 Split Configuration 13:46 Type Checking https://mypy.readthedocs.io/ https://nbqa.readthedocs.io 15:15 Complex Example with Nested Configurations 18:45 Evolution of Old Configurations *Recap & Summary* 20:15 Schema Versions & Evolutions 21:04 Experiment Tracking 21:34 Summary Slides: https://speakerdeck.com/jstriebel/declarative-configs-for-maintainable-reproducible-code

Watch
TALK / Kevin Kho / Large Scale Data Validation (with Spark and Dask)

Data validation is checking if data follows certain requirements needed for data pipelines to run reliably. It is used by data scientists and data engineers to preserve the integrity of existing workflows, especially as they get modified. As an example, extreme machine learning predictions can be stopped from being displayed to application users if a new model is bad. Missing data can be flagged if it has the potential to break downstream operations. As data volume continues to increase, we will examine how data validation differs between a single-machine setting and a distributed computing setting. We will show what validations become more computationally expensive in Spark and Dask. For large scale data, there is sometimes also a need to apply different validations on different partitions of data. This is currently not feasible with any single library. In this talk, we will show how we can achieve this by combining the strengths of different frameworks. To demonstrate the data validation journey, we'll go over a fictitious case study. The data will start small, and we'll apply Pandas-based validations with Pandera and Great Expectations while discussing the pros and cons of each. As data size increases, we'll go over in detail the pain points of transitioning to a distributed setting. We'll show one way to reuse the same Pandas-based validations on Spark and Dask by wrapping them with Fugue. Slides: https://drive.google.com/file/d/1x3w4pfk8PVw1dcy1717Qi-_kt67xQj-S/view?usp=sharing

Watch
TALK / Luciano Ramalho / Protocol: the keystone of type hints

The static type system supporting type hints in Python is becoming more expressive with each new PEP, but PEP 544--Protocols: Structural subtyping (static duck typing) is the most important enhancement since type hints were first introduced. The typing.Protocol special class lets you define types in terms of the interface implemented by objects, regardless of type hierarchies, in the spirit of duck typing--but in a way that can be verified by static type checkers and IDEs. Without typing.Protocol, it was impossible to correctly annotate many APIs considered Pythonic, including many functions in the standard library itself. In this talk you will learn the concepts and benefits of static duck typing, through actual examples of increasing complexity taken from type hints of standard library functions in the official typeshed project. Slides: https://speakerdeck.com/ramalho/protocol-keystone-of-python-type-hints

Watch
TALK / Maggie Moss / Gradual Typing in Practice

Type coverage in Python improves readability, finds bugs and supports tooling to improve security and improve developer efficiency. However, driving for type adoption on a rapidly changing codebase under active development can pose several challenges. This presentation will focus on how you can get meaningful results from Pyre as you move from just a few annotations to a fully typed codebase, and the guarantees we can make along the way. Then, I will discuss the approaches and tools we use to increase type coverage and “strictify” the Instagram codebase, one of the largest active Python projects. Slides: https://docs.google.com/presentation/d/1CbADIfFJhXIJxwEiQp8VOfJJBRtroQ2M9P9lVpAX0KM/edit?usp=sharing

Watch
TALK / John Belmonte / Your app is async so take advantage of it for development!

So your Python application is running under asyncio or similar framework-- congratulations! But what does that mean to you? More efficient use of compute resources? Simpler program structure and avoiding callbacks? It should mean even more. Cooperative multitasking opens new doors for inspecting the state of a program at runtime, which has valuable development uses. This talk covers how Python's async is useful for "development views"-- visualizing and interacting with the state of your running app-- and gives some working examples that run concurrently and don't require intrusive changes to program structure: remote REPL - open one or more interpreter sessions over HTTP to inspect and modify internal state of your app while it's running graphical visualizations - view custom graphical representations of state remotely from a web browser. These are written alongside the code being visualized, and have zero overhead when not observed. Keyboard and mouse input is possible too. What kind of visualizations? For a Python app embedded in a home robot, these might include a local map of obstacles; display of orientation, speed, power usage; low res. camera or depth camera feeds; representations of internal state machines deciding behavior; etc. Slides: https://docs.google.com/presentation/d/e/2PACX-1vQqzFgzYqKinBkIBMpe20Jv_6pyYN1iTkKrDrOQRlqoMSBg4SyWQRnkGc0hBgTxQN_UteHdDe_Cge5h/pub

Watch