Using and Creating Global Variables in Your Python Functions
A global variable is a variable that you can use from any part of a program, including within functions. Using global variables inside your Python functions can be tricky. You’ll need to differentiate between accessing and changing the values of the target global variable if you want your code to work correctly. Global variables can play a fundamental role in many software projects because they enable data sharing across an entire program. However, you should use them judiciously to avoid […]
Read morePython News: What’s New From April 2023
Spring is in bloom, bringing new and exciting developments in the Python world. The last preview release of Python 3.12 before the feature freeze, a new major version of pandas, pip and PyPI improvements, and PyCon US 2023 are a few of them. Grab a cup of your favorite beverage, sit back comfortably in your chair, and enjoy a fresh dose of Python news from the past month! Python 3.12.0 Alpha 7 Is Now Available Python 3.12.0 alpha 7 became […]
Read moreGetting the Most Out of the Python Standard REPL
The Python standard shell, or REPL (Read-Eval-Print Loop), allows you to run Python code interactively while working on a project or learning the language. This tool is available in every Python installation, so you can use it at any moment. As a Python developer, you’ll spend a considerable part of your coding time in a REPL session because this tool allows you to test new ideas, explore and experiment with new tools and libraries, refactor and debug your code, and […]
Read moreBuild Robust Continuous Integration With Docker and Friends
Continuous integration (CI) has become essential to software development, allowing teams to merge code changes frequently and catch errors early. Docker containers help facilitate the continuous integration process by providing a consistent environment where you can test and ship code on each commit. In this tutorial, you’ll learn how to use Docker to create a robust continuous integration pipeline for a Flask web application. You’ll go through the steps of developing and testing the application locally, containerizing it, orchestrating containers […]
Read more“Externally managed environments”: when PEP 668 breaks pip
You’re on a new version of Linux, you try a pip install, and it errors out, talking about “externally managed environments” and “PEP 668”. What’s going on? How do you solve this? Let’s see: What the problem looks like, and what causes it. The places you are likely to encounter it. A variety of solutions, depending on your use case. Symptoms: failed installs Consider the following Dockerfile, using a pre-release of Debian “Bookworm” 12, which will be released in June […]
Read more