All Projects → roskakori → pygount

roskakori / pygount

Licence: BSD-3-Clause license
count lines of code for hundreds of languages using pygments

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to pygount

Scc
Sloc, Cloc and Code: scc is a very fast accurate code counter with complexity calculations and COCOMO estimates written in pure Go
Stars: ✭ 2,943 (+3206.74%)
Mutual labels:  cloc, sloc
count-org-loc
Count total lines of code across a GitHub organization
Stars: ✭ 71 (-20.22%)
Mutual labels:  lines-of-code
tokei-pie
Render tokei's output to interactive sunburst chart.
Stars: ✭ 138 (+55.06%)
Mutual labels:  cloc
Cloc
cloc counts blank lines, comment lines, and physical lines of source code in many programming languages.
Stars: ✭ 13,070 (+14585.39%)
Mutual labels:  cloc
Tokei
Count your code, quickly.
Stars: ✭ 5,896 (+6524.72%)
Mutual labels:  cloc

PyPI Python Versions Build Status Test Coverage Black License

pygount

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

To get a list of line counts for a projects stored in a certain folder run for example:

$ pygount ~/projects/example

To limit the analysis to certain file types identified by their suffix:

$ pygount --suffix=cfg,py,yml  ~/projects/example

To get a summary of each programming language with sum counts and percentage:

$ pygount --format=summary ~/projects/example

As an example here is the summary output for pygount's own source code:

    Language      Files    %     Code    %     Comment    %
----------------  -----  ------  ----  ------  -------  ------
Python               19   51.35  1924   72.99      322   86.10
reStructuredText      7   18.92   332   12.59        7    1.87
markdown              3    8.11   327   12.41        1    0.27
Batchfile             1    2.70    24    0.91        1    0.27
YAML                  1    2.70    11    0.42        2    0.53
Makefile              1    2.70     9    0.34        7    1.87
INI                   1    2.70     5    0.19        0    0.00
TOML                  1    2.70     4    0.15        0    0.00
Text                  3    8.11     0    0.00       34    9.09
----------------  -----  ------  ----  ------  -------  ------
Sum total            37          2636              374

Plenty of tools can post process SLOC information, for example the SLOCCount plug-in for the Jenkins continuous integration server.

A popular format for such tools is the XML format used by cloc, which pygount also supports and can store in an output file:

$ pygount --format=cloc-xml --out=cloc.xml ~/projects/example

To get a short description of all available command line options use:

$ pygount --help

For more information and examples read the documentation chapter on Usage.

Contributions

To report bugs, visit the issue tracker.

In case you want to play with the source code or contribute improvements, see CONTRIBUTING.

Version history

See CHANGES.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].