skillfed

autopage

A library to provide automatic paging for console output

autopage v0.6.0 1.5M downloads/30d#3,885 on PyPI7
Permissive license AGING released

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 autopage

uv

uv add autopage

poetry

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 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

Environment :: ConsoleIntended Audience :: DevelopersLicense :: OSI ApprovedLicense :: OSI Approved :: Apache Software LicenseOperating System :: POSIXProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.15Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Python ModulesTopic :: TerminalsTopic :: Utilities

Tags

automatic paging for console outputpipe output to less conditionallyterminal pager integrationsmart output paginationpreserve colors in pagerCLI output paging library
cli-outputterminal-ui

More Libraries packages