Coverage.py with sys.monitoring

14 · Ned Batchelder · Dec. 27, 2023, 11:42 p.m.
New in Python 3.12 is sys.monitoring, a lighter-weight way to monitor the execution of Python programs. Coverage.py 7.4.0 now can optionally use sys.monitoring instead of sys.settrace, the facility that has underpinned coverage.py for nearly two decades. This is a big change, both in Python and in coverage.py. It would be great if you could try it out and provide some feedback.Using sys.monitoring should reduce the overhead of coverage measurement, often lower than 5%, but of course your timin...