--- id: types-pygments version: "2.20.0.20260728" license: Apache-2.0 license_treatment: permissive maintenance: active --- # types-Pygments — Typing stubs for Pygments License: permissive · Maintenance: active · Downloads: 3.2M/mo ## 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 above — 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 pip install types-pygments uv add types-pygments 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_current - Install friction: low - Maintenance: active - Downloads: 3.2M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags type stubs pygments, pygments type hints, static type checking pygments, mypy pygments annotations, pygments typing support, type-stubs, static-analysis [View on SkillFed](https://skillfed.io/packages/types-pygments) · [View on PyPI](https://pypi.org/project/types-pygments/)