Wed 20 August 2025

ASCII Moon Phases in Python and Rust

Posted by Al Sweigart in misc   

I created a program that draws ASCII art of the current phase of the moon. You can install the package with pip install ascii_moon_phase or from its project page on PyPI. The source is available in its git repo. For a compiled version, I used an LLM to port the code to Rust. This blog post details how it works and the math behind it.

https://en.wikipedia.org/wiki/Lunar_month#Synodic_month

https://en.wikipedia.org/wiki/Julian_day


Check out other books by Al Sweigart, free online or available for purchase:

...and other books as well! Or register for the online video course. You can also donate to or support the author directly.