--- id: autopage version: "0.6.0" license: unclear license_treatment: permissive maintenance: aging --- # autopage — A library to provide automatic paging for console output License: permissive · Maintenance: aging · Downloads: 1.5M/mo ## 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 above — 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 pip install autopage uv add autopage poetry add autopage ## Installing 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_current - Install friction: low - Maintenance: aging - Downloads: 1.5M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags automatic paging for console output, pipe output to less conditionally, terminal pager integration, smart output pagination, preserve colors in pager, CLI output paging library, cli-output, terminal-ui [View on SkillFed](https://skillfed.io/packages/autopage) · [View on PyPI](https://pypi.org/project/autopage/)