autopage
A library to provide automatic paging for console output
What it is and what it does
Autopage is a Python library that wraps your program's output stream to automatically invoke a pager (typically `less`) when the output exceeds one screen, and skip the pager entirely when it doesn't. It mimics the behavior of tools like `git` and `man`, which intelligently decide whether paging is needed. The library respects ANSI color codes, handles file redirects correctly, and lets the end user override the pager command via the `PAGER` environment variable.
You integrate it by wrapping your output in an `AutoPager` context manager, or by importing `autopage.argparse` to automatically page `argparse` help output. It supports line buffering for streaming data, terminal reset on exit, and custom error handling. The library works with Python 3.6 through 3.15 and has no external dependencies.
Use it for:
- Automatically page help output from CLI tools built with argparse without modifying the help formatter.
- Stream log or status data to the terminal with line buffering so users see updates in real time before paging kicks in.
- Build a CLI tool that behaves like `git` or `man`, paging output only when it fills the screen.
- Preserve ANSI color codes in paged output while respecting shell redirects and pipes.
- Let end users override the pager command via `PAGER` environment variable in your Python application.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Automatically pipes terminal output to a pager like `less` when needed, preserving colors and respecting redirects, with just one line of code.
Yes, if you are building CLI tools in Python and want professional paging behavior without boilerplate. The library is simple, dependency-free, and well-tested. Maintenance is aging but the code is stable and no vulnerabilities are known. The only caveat is that POSIX support is explicit in classifiers; verify Windows compatibility if that is a target platform.
Install
autopage on PyPI
pip
pip install autopageuv
uv add autopagepoetry
poetry add autopageInstalling autopage
Before you install
Low friction: pure Python wheel with no runtime dependencies. Maintenance status is aging—last commit was 2026-01-30 and the package has not been released in 196 days—but the repository is active and not archived.
License in practice
Licensed under Apache Software License 2.0 (permissive). Safe for commercial and private use with minimal restrictions.
Quickstart
pip install autopage
import sys
import autopage
with autopage.AutoPager() as out:
for l in sys.stdin:
out.write(l)
Verify before relying
- Whether the package works on Windows (classifiers list POSIX only, but description mentions Windows pager fallback).
- Performance characteristics when handling very large outputs or high-frequency streaming data.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.6) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | aging — 196 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,451,162/month — #3,885 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: autopage-0.6.0-py3-none-any.whl
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
coloredColored provides ANSI/VT100 escape sequences…
permissive · top 5,000 on PyPI
ydiffYdiff displays colored, incremental diffs in a…
permissive · top 15,000 on PyPI
pastelPastel adds colored text output to terminal…
permissive · top 5,000 on PyPI
crayonsCrayons provides colored text output for…
permissive · top 15,000 on PyPI
ansiProvides ANSI escape codes for cursor movement…
permissive · top 15,000 on PyPI
colored-tracebackAutomatically colors Python exception…
permissive · top 5,000 on PyPI
pansiPansi provides a clean interface for rendering…
permissive · top 15,000 on PyPI
myclimycli is a command-line client for MySQL and…
permissive · top 15,000 on PyPI
autocommandAutocommand converts a Python function into a…
copyleft · top 5,000 on PyPI
pyston-autoloadAutomatically loads and enables Pyston, a…
unclear · top 15,000 on PyPI