concept new program in category python

appears as: new programs, new program
Tiny Python Projects: Learn coding and testing with puzzles and games

This is an excerpt from Manning's book Tiny Python Projects: Learn coding and testing with puzzles and games.

It’s not easy to remember all the syntax for defining parameters using argparse, so I’ve created a way for you to write new programs from a template that includes this plus some other structure that will make your programs easier to read and run.

One way to start a new program is to use the new.py program. From the top level of the repository, you can execute this command:

Before you start working on the exercises, I want to discuss how to write programs that are documented and tested. Specifically, we’re going to

  • Write a Python program to say “Hello, World!”
  • Handle command-line arguments using argparse
  • Run tests for the code with Pytest.
  • Learn about $PATH
  • Use tools like YAPF and Black to format the code
  • Use tools like Flake8 and Pylint to find problems in the code
  • Use the new.py program to create new programs