count source lines of code (SLOC) using pygments
Maintained. Last release 8 months ago, commits in 1 of the last 26 weeks. Weaker on commit activity and release cadence.
pip install pygountpygount
Pygount is a command line tool to scan folders for source code files and count the number of source code lines in it. It is similar to tools like sloccount and cloc but uses the pygments package to analyze the source code and consequently can analyze any programming language supported by pygments.
The name is a combination of pygments and count.
Pygount is open source and distributed under the BSD license. The source code is available from https://github.com/roskakori/pygount.
Quickstart
For installation run
$ pip install pygount
or use uv to run it directly, for example:
$ uvx pygount --version
To get a list of line counts for a projects stored in a certain folder:
$ pygount ~/projects/example
To limit the analysis to certain file types identified by their suffix:
$ pygount --suffix=cfg,py,yml ~/projects/example