skillfed

types-Pygments

Typing stubs for Pygments

types-pygments v2.20.0.20260728 3.2M downloads/30d#2,704 on PyPI37
Permissive license Apache-2.0 Active released

What it is and what it does

types-Pygments is a type stub package that adds static type annotations for the Pygments syntax highlighting library. It allows type checkers like mypy and pyright to understand and validate code that imports and uses Pygments, catching type-related errors at check time rather than runtime.

The package is maintained as part of typeshed, the canonical repository of type stubs for the Python ecosystem. It targets Pygments 2.20.* and is marked as partial, meaning some annotations may be incomplete—contributions to improve coverage are welcomed through the typeshed project itself.

Use it for:

  • Enable mypy or pyright to type-check code that uses Pygments for syntax highlighting.
  • Catch type errors in Pygments API calls during static analysis before running code.
  • Provide IDE autocomplete and inline type information for Pygments functions and classes.
  • Integrate Pygments into a codebase with strict type checking enabled.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides type hints for the Pygments syntax highlighting library, enabling static type checkers to validate code that uses Pygments.

Yes, if you use Pygments and run a static type checker. It has no runtime cost, no dependencies, and is actively maintained by typeshed. Install it alongside Pygments to enable type checking. If you do not use a type checker or do not use Pygments, it provides no value.

Install

types-pygments on PyPI

pip

pip install types-pygments

uv

uv add types-pygments

poetry

poetry add types-pygments

Installing types-Pygments

Before you install

Low install friction with no runtime dependencies. Actively maintained as part of typeshed, with a release 17 days old and recent upstream commits.

License in practice

Licensed under Apache-2.0 (permissive), imposing no restrictions on use or distribution.

Quickstart

pip install types-Pygments

import pygments
from pygments.lexers import get_lexer_by_name

lexer = get_lexer_by_name('python')

Requires Python 3.10 or later.

Verify before relying

  • Whether coverage of Pygments 2.20.* APIs is sufficient for your specific use case, given the package is marked as partial.
  • Compatibility with type checkers beyond mypy 2.3.0, pyright 1.1.411, and ty 0.0.59.

Package facts

License Apache-2.0 (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 17 days since the last release
Last repo commit
First released
Downloads 3,201,764/month — #2,704 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: types_pygments-2.20.0.20260728-py3-none-any.whl

Programming Language :: Python :: 3Typing :: Stubs Only

Tags

type stubs pygmentspygments type hintsstatic type checking pygmentsmypy pygments annotationspygments typing support
type-stubsstatic-analysis

More Text Processing packages