Autopage is a Python library designed to automatically display terminal output from a program in a pager (like `less`) when the output is extensive, and behave normally otherwise. It ensures consistent, user-friendly console output, preserves colors, and correctly handles output redirection. The current version is 0.6.0, released on January 29, 2026. While there isn't a strict stated release cadence, releases tend to be infrequent, occurring roughly every 6-18 months.
pip install autopageVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `autopage.AutoPager` as a context manager to pipe extensive console output through a system pager (like `less`). It generates a large amount of text, first printing it directly to `stdout` and then routing it through `AutoPager` to show the difference. For `autopage` to function, a pager (e.g., `less`) must be installed and accessible in the system's PATH.
Ensure you are importing `from autopage import AutoPager` and not attempting to use web scraping functionality.
Pass `line_buffering=True` to the `AutoPager` constructor (e.g., `with autopage.AutoPager(line_buffering=True) as out:`) to force line buffering.
Pass `reset_on_exit=True` to the `AutoPager` constructor (e.g., `with autopage.AutoPager(reset_on_exit=True) as out:`).
Install the module using pip: 'pip install autopage'.
Ensure you have the latest version of autopage installed: 'pip install --upgrade autopage'.
Check the 'AutoPager' class documentation for the correct usage and supported arguments.
Use 'pip install --user autopage' to install it in the user's home directory, or activate a virtual environment before installing.
Use 'autopage.AutoPager()' as a context manager to get an output stream object, then call 'write' on that object:
import sys
import autopage
with autopage.AutoPager() as out:
for line in sys.stdin:
out.write(line)No dependency data recorded yet.