Chapter 8. Automation with Nox

When you maintain a Python project, you’re faced with many chores. Running checks on your code is an important part:

  • Testing helps you reduce the defect rate of your code (Chapter 6).

  • Coverage reporting pinpoints untested parts of your code (Chapter 7).

  • Linters analyze your source code to find ways to improve it (Chapter 9).

  • Code formatters lay out the source code in a readable way (Chapter 9).

  • Type checkers verify the type correctness of your code (Chapter 10).

Other chores include:

  • Building and publishing packages for distribution (Chapter 3)

  • Updating the dependencies of your project (Chapter 4)

  • Deploying your service (see Example 5-7 in Chapter 5)

  • Building the documentation for your project

Automating these tasks has many benefits. You focus on coding while the check suite covers your back. You gain confidence in the steps that take your code from development to production. You remove human error and encode each process so others can review and improve it.

Automation gives you leverage to make each step as repeatable, each result as reproducible, as possible. Checks and tasks run in the same way on developer machines and in continuous integration (CI). They run across different Python versions, operating systems, and platforms.

In this chapter, you’ll learn about Nox, a Python automation framework. Nox serves as a single entry point to your checks and tasks—​for your team, external contributors, and automated systems like ...

Get Hypermodern Python Tooling now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.