December 2026
Every post published in December 2026, newest first. Pick a day to jump straight to it.
- Posts
- 410
- Topics
- 77
- Reading time
- 40 h
- Active days
- 3
Posts 301–330 of 410 · December 1–2, 2026
Page 11 of 14
Wednesday, December 2, 2026
13 of 81 posts
How to Add Up Numbers in Python with sum()
Add up the numbers in a list, the values of a dictionary, and a count of matching items with Python's built-in sum(), and see why it refuses strings. Real output from Python 3.15.2.
3 min readHow to Build a Dictionary with a Dictionary Comprehension in Python
Build a Python dictionary in one line with a dictionary comprehension: a key and a value for every item of a list, with an if clause that keeps only some items. Real output from Python 3.15.2.
4 min readHow to Set an Environment Variable in Python with os.environ
Set an environment variable from inside a Python program by assigning to os.environ, read it back with os.environ and os.getenv, and see how long the change lasts. Real output from Python 3.15.2.
4 min readHow to See Which LangChain Packages Are Installed with langchain_core.sys_info
Print a report of your system and the LangChain packages in a Python project, with their versions, using python -m langchain_core.sys_info. What each section of the report means, and the two mistakes that stop it running. Real output from LangChain 1.5.2 with uv.
6 min readHow to Draw a LangChain Agent as a Mermaid Diagram in Python
Draw the structure of a LangChain agent as a Mermaid diagram in Python with get_graph().draw_mermaid(): its model node, its tools node and the loop between them. No API key needed, because drawing the graph never calls the model. Real output from LangChain 1.5.2.
9 min readHow to Get the Token Usage and Cost of a LangChain Agent Run in Python
Read how many tokens a LangChain agent run used in Python, call by call with usage_metadata and for the whole run with get_usage_metadata_callback(), then turn them into US dollars. Real output from a small agent on Claude Opus 5.5: 823 input and 66 output tokens, $0.004612.
10 min readHow to See Every Message in a LangChain Agent Run in Python
Print every message a LangChain agent run produced in Python with pretty_print(): your question, the model's tool calls and their arguments, the tools' results and the final answer. See what really happened between the question and the answer, with a small letter-counting agent on Claude.
10 min readHow to Run a Python Module as a Script with python -m
Run a Python module by its name with python -m, both a standard library module like calendar and a file of your own. Real output from Python 3.15.2 with uv, plus the errors for adding .py to the name and for a name Python can't find.
5 min readHow to Write Large Numbers with Underscores in Python
Group the digits of a large number with underscores, such as 1_000_000, so it's easy to read in your code. Real output from Python 3.15.2: the value equals 1000000, plus the SyntaxError for a misplaced underscore and how to print a number with separators.
3 min readHow to Add, Subtract, Multiply and Divide Numbers in Python
Add, subtract, multiply and divide numbers in Python with +, -, * and /. Real output from Python 3.15.2: 7 / 2 gave 3.5, 2 + 3 * 4 gave 14, and the mistakes behind 3.0, ZeroDivisionError and the TypeError for adding a number to text.
4 min readHow to Count How Many Times Text Appears in a String in Python with count()
Count how many times a letter or a piece of text appears in a Python string with str.count(). Real output from Python 3.15.2, including why matches don't overlap, how to start counting later in the string, and how to count without caring about capital letters.
3 min readHow to Make a String Lowercase in Python with lower()
Turn every letter of a Python string into lowercase with str.lower(), and compare text without caring about capital letters. Real output from Python 3.15.2, plus casefold() for letters like ß and the mistake of leaving off the parentheses.
3 min readHow to Load a .env File in Python with python-dotenv
Read settings such as API keys from a .env file into os.environ with load_dotenv() from python-dotenv. Real output from python-dotenv 1.2.4 on Python 3.15.2, including why a variable already set in your terminal wins and how override=True changes that.
6 min read
Tuesday, December 1, 2026
17 of 97 posts
Apache Airflow® Tutorial for Data Pipelines in Python — Part 1: Install Airflow and Run Your First Dag
Install Apache Airflow® 3.4 with uv on Python 3.14, start it on your own computer with airflow standalone, and write and run a first Dag that counts yesterday's earthquakes from the free USGS API. Part 1 of a hands-on data pipeline series.
19 min readFixed: "The HMAC key is 24 bytes long, which is below the minimum recommended length of 64 bytes for SHA512" in Apache Airflow®
Apache Airflow® 3.4.0 warned The HMAC key is 24 bytes long on every sign-in and task run, because its generated [api_auth] jwt_secret is shorter than HS512 needs. A 64-byte secret from secrets.token_urlsafe ends the warnings.
7 min readFixed: "Bundle 'dags-folder' path does not exist … This may cause DAG loading issues" in Apache Airflow®
Apache Airflow® 3.4.0 started, then warned Bundle 'dags-folder' path does not exist and found 0 Dag files. The dags folder was never created: Airflow warns but doesn't make it. Create it, add a Dag, and the warning is gone.
6 min readHow to Keep Apache Airflow® Files Out of Git with .gitignore
Apache Airflow® writes its settings with generated secrets, a database, logs and the admin password into your project folder. Keep them out of Git with a short .gitignore, and check it with git status --ignored. Real output from Airflow 3.4.0.
5 min readHow to Query the USGS Earthquake API with curl
Count and list earthquakes from the free USGS earthquake API with curl: the count and query methods, a date range in UTC, a minimum magnitude, plain-text output, and the quoting your shell needs. Real output, no API key.
6 min readHow to Check the Health of Apache Airflow® with the Health Endpoint
Check whether the Apache Airflow® metadata database, scheduler, triggerer and Dag processor are healthy with one request to /api/v2/monitor/health, and read every field of its answer. Real output from Airflow 3.4.0.
4 min readHow to Get an Access Token for the Apache Airflow® REST API
Get a JWT access token from Apache Airflow® 3 with a POST to /auth/token, see what the REST API answers without it, and call an endpoint with the Authorization: Bearer header. Real output from Airflow 3.4.0 with the simple auth manager.
5 min readHow to Pause and Unpause a Dag in Apache Airflow®
Pause and unpause an Apache Airflow® Dag with the toggle on its page in the UI, know why every new Dag starts paused, and what a paused Dag still does. Screenshots from Airflow 3.4.0.
3 min readHow to Read a Task Log in the Apache Airflow® UI
Open a task's log in the Apache Airflow® 3 UI, read its numbered lines and collapsed groups, find where print() output goes, and filter the log by level. Screenshots from Airflow 3.4.0.
5 min readHow to Trigger a Dag from the Command Line with airflow dags trigger
Start an Apache Airflow® Dag run from the terminal with airflow dags trigger, make sure the Dag is unpaused so the run doesn't wait, and check the result with airflow dags list-runs. Real output from Airflow 3.4.0.
4 min readHow to Trigger a Dag from the Apache Airflow® UI
Run an Apache Airflow® 3 Dag by hand from the UI: the Trigger button, every option of the Trigger Dag dialog, what Unpause, Drain and Keep paused do for a paused Dag, and how to see that the run succeeded. Screenshots from Airflow 3.4.0.
5 min readHow to Write a Dag with the TaskFlow API in Apache Airflow®
Write an Apache Airflow® 3 Dag as plain Python functions with @dag and @task from airflow.sdk, pass one task's return value to the next, and see the graph and the log of the run. Real code and screenshots from Airflow 3.4.0.
7 min readHow to Read an Apache Airflow® Setting with airflow config get-value
Print the value Apache Airflow® actually uses for any setting with airflow config get-value: its syntax, environment variable overrides, and what it does with a name that doesn't exist. Real output from Airflow 3.4.0.
6 min readHow to Turn Off the Example Dags in Apache Airflow®
Hide the 119 example Dags that Apache Airflow® 3.4.0 loads by default: set [core] load_examples to False, restart, and see what happens to examples that were already loaded. Real output and screenshots.
5 min readHow to Change the Port and Host of the Apache Airflow® API Server
Move the Apache Airflow® UI and REST API off port 8080 and limit it to your own computer by changing [api] port and host in airflow.cfg, or with AIRFLOW__API__PORT, and check the result. Real output from Airflow 3.4.0.
5 min readHow to Set AIRFLOW_HOME for Apache Airflow®
Choose the folder where Apache Airflow® keeps its settings, database and logs with the AIRFLOW_HOME environment variable: what happens without it, how to set it, and why every new terminal needs it again. Real output from Airflow 3.4.0.
5 min readHow to Find the Admin Password for Apache Airflow® standalone
Find the generated admin password of Apache Airflow® standalone: where the first start prints it, why later starts don't, and how to read it from simple_auth_manager_passwords.json.generated. Real output from Airflow 3.4.0.
5 min read