This article explores Python testing methods, logging best practices, and error handling techniques. It also introduces alternative libraries, such as enum class, pytest caching, Redis LRU cache for decorators, build tools, type checking, code static analysis, automation tools like pydoit, SCons, and Rake. The article aims to provide insights into various Python tools and their applications for effective development and maintenance.

how to log error emitted from better-exceptions?


logging tutorial at betterstack & official

other logging libraries: loguru structlog (able to show locals/globals around error)


better-exceptions


to ensure the consistency of tests, you need to collect input/output pairs (and compare with expected/actual output), if it is deterministic.


monkeytype, pytype (by google), runtype (Dispatch)


better assertion


enum class in python


use cache in pytest

use redis lru_cache, put decorators to json serializable functions

use build tools, forcing program to read and write files in the process

type checking using mypy

code static analysis

code formatter like black


tools:

pydoit with “up to date” signals for non-file objectives

scons

ruby rake

Comments