Learn coding in Python, Go and Rust from Serdar Yegulalp, software dev specialist and senior writer at InfoWorld.
Ever committed sensitive information to a git repository and realized it all too late? You can always erase the repo and start over, but there are other, more elegant solutions. In this video we explore a few options for deleting confidential data from git repositories, both built into the git tool and available as third-party solutions.
Testing web apps is tedious, time-consuming work, even when you have an automation framework to handle the heaviest of the lifting. Playwright, a web app test system originally developed by folks at Microsoft, simplifies many common web-app testing tasks by way of its intuitive syntax and object model. This video demonstrates using Playwright in Python to test a simple web app (although many other languages are supported for test suites, too).
Cython converts ordinary Python programs into C by way of type hints and other special syntax. In this video we'll show how the newest version in development, Cython 3.1, offers some powerful new type hinting features for declaring pointers or working with "volatile" values, and adds forward compatibility for Python's forthcoming free-threaded or "no-GIL" bulds.
A common problem: you have a directory full of files and want to take some action every time something changes in it. The "Watchdog" library for Python gives you tools to observe changes in a directory structure and take action based on any generated events. Learn how to set up and work with Watchdog in this simple demonstration.
Python's "abstract base class" system gives you a way to create types that serve as the abstract foundation for another, more concrete type. This example shows how an abstract base class from the Python standard library can be used as the basis for a custom dictionary type, one where the entries expire after a given length of time, and where the implementation is less clumsy and unpredictable than just subclassing the built-in dict type.
Python's Pillow library, for image manipulation, has features above and beyond merely resizing, rotating, cropping, or recoloring images. In this video we'll see how Pillow can be used to add text captions to image, take snapshots of the screen, or work with image data copied to the system clipboard.
Python packages are typically things you pip install and run by importing into your code. But you can make packages runnable from the Python command line using the \"-m\" option — and by configuring your package with a \"__main__\" module. This video steps you through the basics of using \"__main__\" in a package, and how it differs from \"__init__\" in a package (and elsewhere, too).
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/
Sponsored Links