pygount
count source lines of code (SLOC) using pygments
What it is and what it does
Pygount is a command-line tool that scans directories or remote git repositories to count source lines of code (SLOC) across any programming language supported by pygments. It works similarly to sloccount and cloc but leverages pygments' language detection to analyze a wide range of file types without needing language-specific parsers.
You run it from the shell to get per-file line counts, language summaries with percentages, or export results in cloc-compatible XML format for integration with CI/CD systems like Jenkins. It can analyze local folders, filter by file suffix, and even check out specific git revisions directly from remote URLs without cloning.
Use it for:
- Generate SLOC reports for code review or project metrics in CI/CD pipelines.
- Compare code volume across multiple programming languages in a single repository.
- Export metrics in cloc XML format for ingestion by Jenkins or other build tools.
- Analyze remote git repositories directly without downloading the full clone.
- Filter analysis to specific file types (e.g., only .py and .yml files) for focused metrics.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Pygount counts source lines of code (SLOC) across multiple programming languages by scanning folders or remote git repositories, using pygments for language detection.
Yes. Pygount is a stable, actively maintained tool with low install friction, no known vulnerabilities, and permissive licensing. Install it if you need to measure code volume across multiple languages or integrate SLOC reporting into your build pipeline.
Install
pygount on PyPI
pip
pip install pygountuv
uv add pygountpoetry
poetry add pygountInstalling pygount
Before you install
Low friction install with a pure Python wheel. Actively maintained with a recent release (128 days ago) and an active repository; supports current Python versions (3.10–3.14).
License in practice
BSD-3-Clause is permissive; you can use, modify, and distribute pygount freely in commercial and private projects with minimal restrictions.
Quickstart
pip install pygount
pygount ~/projects/example
pygount --format=summary ~/projects/example
Package facts
| License | BSD-3-Clause (permissive) |
| Python support | supports the current Python release (<4,>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — chardet, gitpython, pygments, rich |
| Maintenance | actively maintained — 128 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 719,788/month — #5,238 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pygount-3.2.0-py3-none-any.whl
Keywords: SLOC, code analysis, count
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
syllapyCounts syllables in English words, returning an…
permissive · top 5,000 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
lizardLizard analyzes code complexity and detects…
permissive · top 5,000 on PyPI
radonRadon computes code metrics from Python source…
permissive · top 5,000 on PyPI
django-querycountDjango middleware that logs the number of…
permissive · top 15,000 on PyPI
thopCounts floating-point operations (MACs) and…
permissive · top 5,000 on PyPI
ipython-pygments-lexersProvides Pygments syntax highlighters for…
permissive · top 1,000 on PyPI
pytest-progressA pytest plugin that displays real-time test…
permissive · top 15,000 on PyPI
ansible-pygmentsProvides a Pygments lexer and style for…
permissive · top 15,000 on PyPI
jupyterlab-pygmentsProvides a Pygments syntax highlighting theme…
permissive · top 1,000 on PyPI