Episode 98: Drawing Fractals With Python and Working With a Weather API
The Real Python Podcast
Feb 18, 2022 51m
Have you been wanting to explore fractals and complex numbers in Python? Would you like to practice working with APIs in Python through a new project? This week on the show, Christopher Trudeau is here, and he’s taking on the task of curating new issues of PyCoder’s Weekly going forward. He’ll be joining me as a cohost every other week and bringing a fresh batch of PyCoder’s Weekly articles and projects.
Episode Sponsor:
We discuss a Real Python article about drawing the Mandelbrot set in Python. The tutorial guides you through creating fractal art using Matplotlib and Pillow. We also share a new step-by-step project building a weather-reporting command-line interface (CLI) app.
We cover several other articles and projects from the Python community, including a news roundup, a better Pygame main loop, ways to work with static and media files in Django, and a library for pleasing console output.
Course Spotlight: Make a 2D Side-Scroller Game With Pygame
In this step-by-step course, you’ll learn how to use Pygame. This library allows you to create games and rich multimedia programs in Python. You’ll learn how to draw items on your screen, implement collision detection, handle user input, and much more!
Topics:
- 00:00:00 – Introduction
- 00:02:15 – Black, the Python Code Formatter, Is Stable
- 00:04:07 – Apple Removes Python 2.7 in macOS Monterey 12.3
- 00:06:36 – GitHub Survey on Languages and More Developer Things
- 00:10:14 – CPython 3.11.0a5 Is Available
- 00:11:48 – Django Security Releases Issued: 4.0.2, 3.2.12, and 2.2.27
- 00:12:43 – A Better Pygame Main Loop
- 00:21:22 – Sponsor: CData Software
- 00:22:04 – Draw the Mandelbrot Set in Python
- 00:29:12 – The Fastest Way to Read a CSV in Pandas
- 00:35:16 – Video Course Spotlight
- 00:36:26 – Working With Static and Media Files in Django
- 00:41:42 – Raining Outside? Build a Weather CLI App With Python
- 00:48:15 – konsole: Readable, Pleasing Console Output
- 00:50:27 – Thanks and Goodbye
News:
- Black, the Python Code Formatter, Is Stable – The popular Python autoformatter Black is finally non-beta software. Related discussion on Hacker News and Black’s stability policy doc.
- Apple Removes Python 2.7 in macOS Monterey 12.3 – “Python 2.7 was removed from macOS in this update. Developers should use Python 3 or an alternative language instead.” Also see the related discussion on Hacker News.
- GitHub Survey on Languages and More Developer Things – JavaScript retains the top spot, Python keeps second place gained in 2019 over Java, which holds in third. TypeScript continues fourth after racing up tenth in 2017 to fourth in 2020. JavaScript + TypeScript seem to put that way ahead in terms of amount of code on GitHub.
- CPython 3.11.0a5 Is Available – “We needed to tame some angry buildbots, but after a small fight, we won with just some scratches! Here you have a shiny new alpha release: Python 3.11.0a5.”
- Django Security Releases Issued: 4.0.2, 3.2.12, and 2.2.27 – Includes fixes for a possible XSS via
debug
template tag and a denial-of-service possibility in file uploads.
Articles:
- A Better Pygame Main Loop – Improving your game’s main loop for smoother gameplay that takes less battery power: “Now your players’ laptops run cool while playing, and the graphics don’t have ugly tearing artifacts any more!”
- Draw the Mandelbrot Set in Python – In this tutorial, you’ll visualize the famous Mandelbrot set using Python’s Matplotlib and Pillow libraries. You’ll learn how to draw the fractal in black and white, grayscale, and color.
- The Fastest Way to Read a CSV in Pandas – This article covers pandas’ default CSV reading, the faster and more parallel CSV reader introduced in v1.4, and a different approach that can make things even faster.
- Working With Static and Media Files in Django – A look at how to work with static and media files in a Django project, locally and in production.
Projects:
- Raining Outside? Build a Weather CLI App With Python – In this tutorial, you’ll write a nicely formatted Python CLI app that displays information about the current weather in any city that you provide the name for.
- konsole: Readable, Pleasing Console Output
Additional Links:
- Make a 2D Side-Scroller Game With Pygame – Real Python
- Using Pygame to Build an Asteroids Game in Python – Real Python
- Deciphering Glyph :: Nice Animations with Twisted and PyGame
- pygame 4000 book by pygame
- Where’s your bottleneck? CPU time vs wallclock time
- Storing Django Static and Media Files on Amazon S3 | TestDriven.io
- OpenWeatherMap API guide - OpenWeatherMap