Learn coding in Python, Go and Rust from Serdar Yegulalp, software dev specialist and senior writer at InfoWorld.
The "wheel" format in Python lets you bundle up and redistribute a Python package you've created. Others can then use the "pip" tool to install your program from your wheel file, which can include binary components (like Python extension modules written in C). This video walks through the basics of how to build wheels with a "pip install"-able project.
It's not hard to write a Python package that can be installed into an interpreter or virtual environment with pip. This video shows a simple example of how to lay out a project's source code and set up its pyproject.toml file to allow pip to use it as an installation source. (In future videos we'll explore actions like creating Python wheels or uploading such projects to PyPi, too.)
If you use Python for accessing API endpoints or web scraping, odds are you're using either Python's native http libraries or a third-party module like requests. In this video, we take a look at the httpx library — an easy, powerful, and future-proof way to make HTTP requests. It provides tools for everything from sending form data to handling multipart file uploads, and works with both synchronous and async code.
Python can interface with C code using the built-in ctypes library, but ctypes is notoriously clunky. The third-party CFFI project offers a more streamlined way to build interfaces between Python programs and C libraries. This video shows the basics of using CFFI, including how talking to a C library can be as easy as copying and pasting a C library header into your Python code.
Everyone uses the .zip archive format to compress and store files, but sometimes you need more flexibility and power than a command-line or GUI archiving tool gives you — or you want to create archives programmatically. Python's got built-in functions for creating and working with zip files, by way of its standard library's zipfile module. This video walks through the basics of using zipfile to create new archives, load files into them, extract files from them, and do other operations.
In software development, there's the concept of a "mode" – a distinct set of behaviors for a program that changes the way it receives user input. In this video we'll demonstrate a simple video game (using the PyGame framework) that uses three distinct modes of behavior, and use it as an example for how to implement modal behaviors in a program. The code shown in this video is available at https://gist.github.com/syegulalp/ab5ccf257381344ea6c3f29bf36936bc - you are free to use it as you see fit.
Python's "ast" module transforms the text of Python source code into an object stream. It's a more powerful way to walk through Python code, analyze its components, and make changes than working manually with code as text. This video shows some basic "ast" techniques, like selectively replacing imports and performing other targeted modifications to code.
The \\\"enum\\\" type in Python lets you create variables constrained to a predefined range of values. Learn how this built-in Python type can be used to express the state of something, whether as a string, an integer, or some other type – and how to ensure the values you create remain consistent both inside and outside your program.
Python comes with many things, but by default it does not have tools for manipulating images. The third-party Pillow library, formerly known as PIL (the Python Imaging Library), provides a slew of modules for reading various image formats, processing image data, performing common manipulations like thumbnailing, and saving images back to files. In this video we'll walk through the basics of using Pillow, and also single out some of the caveats of working with it, such as its internal inconsistencies and quirks.
Sometimes with a program you just need a quick and dirty way to persist values across to disk. The dbm module in Python provides a native way to do this across platforms, with no more effort than you'd need to save values in a dictionary. Learn in this video the basics of how it works, and how it's been updated to use SQLite as a storage backend.
Python's type hinting system makes it easier to check your programs for correctness and consistency, but adding type hints to an existing code base can be grueling work. MonkeyType, created by Instagram, runs your code and automatically generates type hints for code, which you can apply directly to your source or list alongside it as type stubs. This video shows a simple example of MonkeyType in action, along with some use cases and caveats.
Python programs can use a web frontend with HTML to create GUIs conveniently. In many cases you don't even have to know HTML, CSS, or JS: you can use a Python framework that generates your interactive frontend programmatically. With NiceGUI, HTML apps with complex web controls aren't hard to implement in a few lines of Python. This video walks through the basics of how NiceGUI apps work, and compares and contrasts with similar frameworks like Streamlit.
Python 3.13 provides early access to some groundbreaking new features in CPython, the default Python interpreter. A new JIT can enable speedups in "hot spots" in Python code, by selectively replacing generic instructions with specialized versions and by using a new second-stage bytecode – without having to rewrite any existing Python code. And the new "free-threaded", or "no-GIL" build, lets Python threads run with true parallelism. However, none of these features are enabled by default yet. To use them, you need to build a custom edition of the Python interpreter. In this video, we've done just that, and we show some examples of where both of these new features add real value to Python. Twitter: @syegulalp LinkedIn: https://www.linkedin.com/in/serdar-yegulalp-136a483/
In previous videos we covered Cython (for translating Python into C for speed), Numpy (for working with numerical arrays at scale), and parallelism in Cython (for doing work in multiple threads). In this video we look at how all three of these things can be used at once: writing Cython that runs in parallel for operating on Numpy arrays. We'll also cover how to ensure Cython uses Numpy arrays correclty, and why parallelism with Numpy arrays doesn't always result in linear speedups.
Many different data libraries in Python work with dataframes – Polars, Pandas, DuckDB, and so on. But they all sport highly dissimilar APIs and feature sets, and some have features the others don't. Ibis provides a common, unified front end for over a dozen Python dataframe libraries – a common way to read data, query it, pass dataframes between different processing engines, and report the results. This video shows an example of how this works using a single common dataframe derived from a CSV, using DuckDB, Polars, and Ibis's native dataframe processing.
Asynchronous programming in any language can be tricky, and Python is no exception. The AnyIO library simplifies many common patterns in async programming in Python, such as how to start async tasks or manage them. AsyncIO also adds many behaviors and features for async not found in Python's standard library, like performing asynchronous work with files.
Analytics databases, or column-oriented DBs, speed up analytics jobs on big datasets. But most such DBs are big products with a lot of setup and management overhead. DuckDB bucks that trend: it's a single, self-contained executable and library that brings SQL-query-powered analytics DB functionality to most any programming language, workflow, or data trove. This video shows how you can use DuckDB with Python to work with big, multi-megabyte JSON or CSV datasets, and query the data using conventional SQL syntax.
As WebAssembly gains in popularity, one possible application is to embed a WASM runtime into applications to extend the app's functionality. Extism lets you write WASM extensions for your own applications, creating in effect a WASM-powered plugin system for your apps without the overhead of embedding a full language runtime like Lua. This video shows the basics of how to write a WASM add-on in AssemblyScript, and add it to a Python application, all in a few lines of code.
Cython's used to take existing Python code and translate it to C for speed. It can also be used to make some operations on C types faster by performing them in parallel, and without using the overhead of Python's threading or multiprocessing mechanisms. Instead, you can write Cython code that makes use of the industry-standard OpenMP interface for writing parallel-processing code. This video goes through the basics of using OpenMP in Cython, using the "prange" object, and gives you an idea of what's involved to make operations parallel.
If you've ever needed to compile something from C/C++ source in Microsoft Windows, odds are you've also been aggravated by how complex it can be to set up the Visual Studio C++ Build Tools. Turns out there's a simple, one-command way to do it using the Winget package manager, with minimal babysitting and fuss. Watch this video to learn how to install the Build Tools from the command line, and how to customize the setup to include more than the basic components if needed.