types-pygments is a PEP 561 type stub package providing external type annotations for the Pygments library. It enables static type checkers like MyPy and PyCharm to verify code that uses Pygments. This package, currently at version 2.20.0.20260408, is part of the typeshed project and is regularly updated, often daily, to reflect changes in the underlying Pygments library.
pip install types-pygments PygmentsVerified import paths — ran on the pinned version, not inferred.
This example demonstrates basic usage of Pygments for syntax highlighting. When 'types-pygments' is installed alongside 'Pygments', a static type checker can analyze this code for type consistency, leveraging the provided stub files.
Ensure both 'Pygments' and 'types-pygments' are installed: `pip install Pygments types-pygments`.
Check the PyPI page for 'types-pygments' to see which Pygments versions it targets. Pin your 'types-pygments' version accordingly, e.g., `pip install 'Pygments==2.20.*' 'types-pygments==2.20.0.*'`.
Refer to the Pygments official documentation for runtime behavior. Consider contributing to typeshed if you find significant missing annotations that you can address.