List of videos

When to refactor your code into generators and how - presented by Jan-Hein Bührman
EuroPython 2022 - When to refactor your code into generators and how - presented by Jan-Hein Bührman [Liffey A on 2022-07-13] Have you ever found yourself coding variations of a loop construct where fragments of the loop code were exactly the same between the variations? Or, in an attempt to factor out these common parts, you ended up with a loop construct containing a lot of conditional code for varying start, stop, or selection criteria? You might have felt that the end result just didn't look right. Because of the duplicated parts in your code, you noticed that the code didn't conform to the DRY (_Don't Repeat Yourself_) principle. Or, after an attempt to combine the variations into a single loop, with consequently a lot of conditional code, your inner voice told you that the resulting code had become too complex and difficult to maintain. This talk will show you a way out of this situation. It demonstrates how you can create a *generator function* that implements only the common parts of your loop construct. Subsequently you will learn how you can combine this generator function with distinct hand-crafted functions or building blocks from the standard library `itertools` module or the `more-itertools` package. As an example, imagine you'd need to implement some varying functionality based on the Fibonacci sequence. This talk shows you how it would look like before and after you've refactored it into a *pipeline of generators*. After having seen this pattern, you will recognize more quickly when this kind of refactoring helps you to create more maintainable and more Pythonic code. This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License http://creativecommons.org/licenses/by-nc-sa/4.0/
Watch
HPy: a better C API for Python - presented by Ronan Lamy
EuroPython 2022 - HPy: a better C API for Python - presented by Ronan Lamy [Liffey A on 2022-07-13] The official Python C API is specific to the current implementation of CPython. It has served us well and forms the basis upon which our entire extension ecosystem rests. However, it exposes a lot of internal details which makes it hard to implement it for other Python implementations (e.g. PyPy, GraalPython, Jython, IronPython, etc.), and prevents major evolutions of CPython itself, such as using a GC instead of refcounting, or removing the GIL. This is where HPy comes in. It's a new C API designed from the ground up according to the following goals: * running much faster on alternate implementations, and at native speed on CPython * making it possible to compile a single binary which runs unmodified on all supported Python implementations and versions * being simpler and more manageable than the Python/C API * providing an improved debugging experience. We'll discuss its current status and show how existing extensions can be gradually ported to it. This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License http://creativecommons.org/licenses/by-nc-sa/4.0/
Watch
PySnooper: Never use print for debugging again - presented by Ram Rachum
EuroPython 2022 - PySnooper: Never use print for debugging again - presented by Ram Rachum [Liffey A on 2022-07-13] I had an idea for a debugging solution for Python that doesn't require complicated configuration like PyCharm. I released PySnooper as a cute little open-source project that does that, and to my surprise, it became a huge hit overnight, hitting the top of Hacker News, r/python and GitHub trending. In this talk I'll go into: * How PySnooper can help you debug your code. * How you can write your own debugging / code intelligence tools. * How to make your open-source project go viral. * How to use PuDB, another debugging solution, to find bugs in your code." This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License http://creativecommons.org/licenses/by-nc-sa/4.0/
Watch
Raise better errors with Exception Groups - presented by Or Chen
EuroPython 2022 - Raise better errors with Exception Groups - presented by Or Chen [Liffey A on 2022-07-13] New to python 3.11, Exception Groups help you raise and handle errors more robustly than ever before - you will delve deep into the current gaps in python's exception handling mechanisms, and get to know Error Groups, and a new python keyword except*, that can be used to overcome those issues and to write cleaner code. This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License http://creativecommons.org/licenses/by-nc-sa/4.0/
Watch
Taking charge of your race conditions - presented by Borjan Tchakaloff
EuroPython 2022 - Taking charge of your race conditions - presented by Borjan Tchakaloff [Liffey A on 2022-07-13] Anybody working with concurrency (threads, processes, or more abstractly workers) eventually encounters a _race condition_. This kind of hair-pulling problem is a staple in computer science. Sometimes you can offload the problem to a lower layer, usually to the database engine, bundling it with atomic transactions. But there are times when you have to take charge of worst-case concurrency scenarios, when your architecture and constraints do not leave room for implicit concurrency management. Then, you need to carefully craft the paths in and out of the critical section, avoiding deadlocks along the way. In this talk, we will focus on how to test your program with a manufactured race condition. If you know it can happen, you'd better cover it in your test suite. We will define a server program called in parallel by multiple clients to illustrate the problem at hand. Then, we will manually set-up a race condition during testing to explore broken behaviour and problematic code. The Python standard library offers all the tools we need to cater for race conditions. We hope the tour we will give allows you to exercise your own race conditions more easily. Why, we even think you will have all the cards in hand to counter them! This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License http://creativecommons.org/licenses/by-nc-sa/4.0/
Watch
Python & Visual Studio Code - Revolutionizing the way you do data science - presented by Jeffrey Mew
EuroPython 2022 - Python & Visual Studio Code - Revolutionizing the way you do data science - presented by Jeffrey Mew [Liffey A on 2022-07-13] Visual Studio Code along with GitHub, Codespaces, and Azure Machine Learning have been investing substantially into tools and platforms to make the lives of Python data scientists easier, and we want to share why VS Code is now the #1 tool for Python Data Scientists according to the 2021 Python Software Foundation Developer Survey, and how you can leverage VS Code to take your data science productivity to the next level. This talk will walk through several common Python data science scenarios, showcasing all the productive tooling VS Code has to offer along the way. As a sneak peek, we will be demoing a best in class Jupyter Notebooks experience with VS Code Notebooks, a revolutionary new data cleaning / preparation experience with Data Wrangler in VS Code, collaboration features with GitHub and Codespaces, Azure Machine Learning for deployment, and more! This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License http://creativecommons.org/licenses/by-nc-sa/4.0/
Watch
Code coverage through unit tests running in sub-processes/threads - presented by Saransh Chopra
EuroPython 2022 - Code coverage through unit tests running in sub-processes/threads: Locally and automated on GitHub - presented by Saransh Chopra [Liffey A on 2022-07-13] The *“Code coverage”* value of a codebase depicts how much of the production/development code is covered by the running unit tests. In the world of open-source, all the maintainers try their best to keep this percentage high, and this process is often automated through tools like `GitHub Actions` and `Codecov`. Hence, code coverage becomes a good metric (not always) to check if a particular codebase is well tested and reliable. Open source maintainers often prefer to run these unit tests in sub-processes or threads as it allows them to run in parallel and reduce the `CI` (continuous integration) run time on pull requests. They also make it easier to stop the tests midway if they are taking too much time (probabilistic tests). In this talk, we will first try to use `coverage.py` in the default mode on the unit tests running in a sub-process or a thread. After going through the results, we will build a solution to cover the “un-covered” code in the local repository. As a final step, we will also configure a `CI` (continuous integration) pipeline using `GitHub Actions` and `Codecov` to automate this process in our remote repository. This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License http://creativecommons.org/licenses/by-nc-sa/4.0/
Watch
Using Python to manage Software Bill of Materials - presented by Anthony Harrison
EuroPython 2022 - Using Python to manage Software Bill of Materials - presented by Anthony Harrison [Wicklow Hall 1 on 2022-07-13] Software has become increasingly complex as it is constructed from a multitude of software components. In many cases the identification of these components are hidden as they are included through implicit dependencies. Without fully understanding the dependencies of your product it is not possible to understand the current vulnerability status of your software product or system. In the past 12 months, there has been an increasing focus on the use Software Bill of Materials (SBOMs) as a key artefact to be delivered with a software product; it will be mandated for all software products in some markets later in 2022. SBOMs which were initially developed to capture the inter-dependencies between components (the focus was on capturing the different types of open source licences used within a product) but with the latest evolution, tracking of vulnerabilities within a product can now be performed. This talk will introduce the SBOM concept and show how Python and its ecosystem can be used to create, manage and use SBOMs as part of your development pipeline. This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License http://creativecommons.org/licenses/by-nc-sa/4.0/
Watch
My journey using Docker as a development tool - presented by Haseeb Majid
EuroPython 2022 - My journey using Docker as a development tool - presented by Haseeb Majid [Wicklow Hall 1 on 2022-07-13] Docker is a prevalent tool in our industry today, it is widely used for several proposes. In this talk, I would like to describe the journey I have taken with Docker and how I have learnt to use it with Python for local development. The talk will mostly focus on how we can use Docker to run all of our development tasks, so we hardly need to have anything installed locally. To the point where you can work on almost any project with nothing more than an editor, your terminal and Docker. We will look at how we can take a simple FastAPI web service and dockerise it. The talk will be a step by step guide, starting of with a simple Docker image and improving it iteratively. - Firstly use a simple Docker image - Then add docker-compose to dockerise its dependencies such as database - Then see how we can run tests (and other tasks) directly in our Docker container - How to use this with Github Action - Then look at multistage builds - Then split this into development and production image - How can we handle git dependencies that require an SSH key to be injected into the Docker image at build time I’d be a little more specific. Like, how we handle private pip packages in our docker images. This talk is for you if you are a casual user of Docker and know a few of its features but want to improve your Docker skills. This is NOT a talk for you if you are an expert in Docker and know most of its features. Code: https://gitlab.com/haseeb-slides/docker-as-a-dev-tool Slides: https://docker-as-a-dev-tool.haseebmajid.dev This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License http://creativecommons.org/licenses/by-nc-sa/4.0/
Watch