Pygments
Pygments is a syntax highlighting package written in Python.
Install
pygments on PyPI
pip
pip install pygmentsuv
uv add pygmentspoetry
poetry add pygmentsPackage facts
| License | BSD-2-Clause (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 137 days since the last release |
| Last repo commit | |
| First released | |
| Popularity | one of the 100 most-downloaded packages on PyPI (30-day window, as of 2026-08-13) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-13) |
Evidence: pygments-2.20.0-py3-none-any.whl
Keywords: syntax, highlighting
About Pygments
from the package's own PyPI description — quoted content, verbatim
Pygments ~~~~~~~~
Pygments is a syntax highlighting package written in Python.
It is a generic syntax highlighter suitable for use in code hosting, forums, wikis or other applications that need to prettify source code. Highlights are:
- a wide range of over 500 languages and other text formats is supported
- special attention is paid to details, increasing quality by a fair amount
- support for new languages and formats are added easily
- a number of output formats, presently HTML, LaTeX, RTF, SVG, all image formats that PIL supports and ANSI sequences
- it is usable as a command-line tool and as a library
Copyright 2006-present by the Pygments team, see AUTHORS.
Licensed under the BSD, see LICENSE for details.
Read as markdown · JSON record · Source repository · Homepage · Docs
AI interpretation — verify before relying
AI-generated interpretation of the package facts above; every digit, version, license, or vulnerability id it cites is grounded in the facts already shown on this page
Pygments is a syntax highlighter that colorizes source code in over 500 languages and formats, outputting to HTML, LaTeX, RTF, SVG, images, or ANSI sequences for use in code hosting, wikis, forums, or as a command-line tool.
Pygments has zero runtime dependencies and installs as a pure Python wheel with low friction. The project is actively maintained with a recent release (137 days ago) and remains under active development with ongoing commits.
Pygments is licensed under BSD-2-Clause, a permissive open-source license that allows commercial and private use with minimal restrictions beyond attribution and liability disclaimers.
Usage
pip install pygments==2.20.0
from pygments import highlight
from pygments.lexers import PythonLexer
from pygments.formatters import HtmlFormatter
code = 'print("hello")'
result = highlight(code, PythonLexer(), HtmlFormatter())
Requires Python 3.9 or later.
Verdict: Pygments is a mature, actively maintained syntax highlighter with no dependencies, permissive licensing, and zero known vulnerabilities. It is well-suited for any application needing code colorization across a broad range of languages and output formats.
Needs verification
- Whether the 500+ language count and all listed output formats (HTML, LaTeX, RTF, SVG, PIL image formats, ANSI) remain current in version 2.20.0
- Performance characteristics and memory footprint for large codebases or real-time highlighting scenarios
Similar packages
permissive · top 1,000 on PyPI
ipython-pygments-lexerspermissive · top 1,000 on PyPI
jupyterlab-pygmentspermissive · top 1,000 on PyPI
prompt_toolkitpermissive · top 1,000 on PyPI
coloredlogspermissive · top 1,000 on PyPI
coloramapermissive · top 100 on PyPI
docutilsunclear · top 1,000 on PyPI
pandocfilterspermissive · top 1,000 on PyPI
wcwidthpermissive · top 1,000 on PyPI
humanfriendlypermissive · top 1,000 on PyPI