The second edition of "Automate the Boring Stuff with Python" is almost out! You can preorder it on the No Starch Press website, where buying the print book will get you DRM-free ebooks in PDF, epub, and Kindle formats for free.
The second edition is about 100 pages longer than the first, with new chapters, programming projects, and revised editing. The third party module coverage has been updated to the latest available version (including OpenPyXL).
Like the first edition, the second edition will be released under a Creative Commons license and will be free to read online. The estimated online release is early November on the https://automatetheboringstuff.com.
Some of the new content includes:
- The Mu editor - The second edition switches from IDLE to Mu, an editor specifically designed for education and beginners. Watch Nicholas Tollervey present Mu at PyCon 2018.
- Explanation of the call stack - A description of the call stack, which helps the reader understand global and local scopes.
enumerate()function - Using
forloops and its advantages over using
random.shuffle()functions - These functions in the
randommodule weren't covered before.
- Identity and the
id()function - Added to help explain references and in-place modification.
partition()method - A useful string method similar to
- New chapter: PyInputPlus and input validation - Covers a third party module, PyInputPlus, for input validation and why input validation is important.
Pathobjects - Explores a new, versatile way to write code that interacts with the file system.
- OpenPyXL updates - This third party module made several backwards-incompatible changes, confusing some readers who installed the latest version instead of the version in the book. This chapter has been updated to the latest version.
- New chapter: Working with Google Sheets - A new chapter covering the EZSheets module, allowing your Python scripts to read and update spreadsheets on Google Sheets.
- New module: EZGmail - The email/SMS chapter now features the EZGmail module, which allows Python scripts to interact with Gmail accounts. Previously this was much more difficult to do via the
- SMS email gateways - A new section on how to send SMS text messages via the phone carrier's email gateways. Now your Python scripts won't need to use a service such as Twilio to send occasional text messages.
- MouseInfo app - A small GUI application that is a part of PyAutoGUI which reveals the current coordinates of the mouse. This information is useful for planning out GUI automation tasks.
- The PyGetWindow module - A new module included in PyAutoGUI that retrieves the coordinates, size, and status of the desktop windows for running programs.
- The PyMsgBox module - A new module included in PyAutoGUI that provides popup message boxes for your program when it needs to get the attention of the user.
- Requirements.txt files - Available text files that make it easy to install the exact versions of the modules that the book covers. (See below.)
New projects and programs include:
- "Rock, Paper, Scissors" game - The source code for a simple rock, paper, scissors game.
- "Zig Zag" program - A small animation program to produce a zig zag line.
- "Conway's Game of Life" program - The source code to the classic cellular automata program.
- "Pig Latin" program - The source code for an "igpay atinlay" text converter.
- "Zombie Dice" simulation - Instructions how to write your own bots that play the game Zombie Dice against each other.
- Date Detection practice project - An exercise for using regular expressions to parse dates.
- "How to Keep an Idiot Busy for Hours" program - The source code for a joke program.
- "Multiplication Quiz" program - The source code for a math quiz program.
- Practice projects: "Sandwich maker" and "Write your own multiplication quiz" - Exercises for using the PyInputPlus module.
To avoid installing third-party module versions that the book doesn't cover, I'm making available several requirements.txt files so that
pip can easily install the exact versions that the book covers. Download the file for your operating system:
To install, download the file for your operating system. Then open a terminal or command prompt window and run
pip install -r automate-<your os>-requirements.txt. If you're using pipenv to create a virtual environment, you'll need to run
pipenv install -r automate-<your os>-requirements.txt.
Note that PyAutoGUI requires Pillow, which currently doesn't support Python 3.8 yet.
If you have questions about the second edition or its content, you can post them on the /r/inventwithpython subreddit.