pygount


Namepygount JSON
Version 1.6.1 PyPI version JSON
download
home_pagehttps://github.com/roskakori/pygount
Summarycount source lines of code (SLOC) using pygments
upload_time2023-07-02 16:51:14
maintainer
docs_urlNone
authorThomas Aglassinger
requires_python>=3.8,<4
licenseBSD
keywords code analysis count sloc
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![PyPI](https://img.shields.io/pypi/v/pygount)](https://pypi.org/project/pygount/)
[![Python Versions](https://img.shields.io/pypi/pyversions/pygount.svg)](https://www.python.org/downloads/)
[![Build Status](https://github.com/roskakori/pygount/actions/workflows/build.yml/badge.svg)](https://github.com/roskakori/pygount/actions/workflows/build.yml)
[![Test Coverage](https://img.shields.io/coveralls/github/roskakori/pygount)](https://coveralls.io/r/roskakori/pygount?branch=master)
[![Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![License](https://img.shields.io/github/license/roskakori/pygount)](https://opensource.org/licenses/BSD-3-Clause)

# 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](https://www.dwheeler.com/sloccount/) and
[cloc](https://github.com/AlDanial/cloc) but uses the
[pygments](https://pygments.org/)
package to analyze the source code and consequently can analyze any
[programming language supported by pygments](https://pygments.org/languages/).

The name is a combination of pygments and count.

Pygount is open source and distributed under the
[BSD license](https://opensource.org/licenses/BSD-3-Clause). The source
code is available from https://github.com/roskakori/pygount.

## Quickstart

For installation run

```bash
$ pip install pygount
```

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

```bash
$ pygount ~/projects/example
```

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

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

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

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

To analyze a remote git repository directly without having to clone it first:

```bash
$ pygount --format=summary https://github.com/roskakori/pygount.git
```

You can pass a specific revision at the end of the remote URL:

```bash
$ pygount --format=summary https://github.com/roskakori/pygount.git/v1.5.1
```

This example results in the following summary output:

```
┏━━━━━━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━┳━━━━━━┳━━━━━━━━━┳━━━━━━┓
┃ Language         ┃ Files ┃     % ┃ Code ┃    % ┃ Comment ┃    % ┃
┡━━━━━━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━╇━━━━━━╇━━━━━━╇━━━━━━━━━╇━━━━━━┩
│ Python           │    18 │  47.4 │ 2132 │ 63.6 │     418 │ 12.5 │
│ TOML             │     2 │   5.3 │ 1204 │ 82.7 │       1 │  0.1 │
│ reStructuredText │     9 │  23.7 │  566 │ 64.8 │       1 │  0.1 │
│ Markdown         │     3 │   7.9 │   53 │ 49.1 │       0 │  0.0 │
│ Batchfile        │     1 │   2.6 │   24 │ 68.6 │       1 │  2.9 │
│ Text only        │     2 │   5.3 │   24 │ 82.8 │       0 │  0.0 │
│ Bash             │     2 │   5.3 │   12 │ 80.0 │       3 │ 20.0 │
│ Makefile         │     1 │   2.6 │    9 │ 45.0 │       7 │ 35.0 │
├──────────────────┼───────┼───────┼──────┼──────┼─────────┼──────┤
│ Sum              │    38 │ 100.0 │ 4024 │ 68.4 │     431 │  7.3 │
└──────────────────┴───────┴───────┴──────┴──────┴─────────┴──────┘
```

Plenty of tools can post process SLOC information, for example the
[SLOCCount plug-in](https://wiki.jenkins-ci.org/display/JENKINS/SLOCCount+Plugin)
for the [Jenkins](https://jenkins.io/) 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:

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

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

```bash
$ pygount --help
```

For more information and examples read the documentation chapter on
[Usage](https://pygount.readthedocs.io/en/latest/usage.html).

## Contributions

To report bugs, visit the
[issue tracker](https://github.com/roskakori/pygount/issues).

In case you want to play with the source code or contribute improvements, see
[CONTRIBUTING](https://pygount.readthedocs.io/en/latest/contributing.html).

## Version history

See [CHANGES](https://pygount.readthedocs.io/en/latest/changes.html).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/roskakori/pygount",
    "name": "pygount",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<4",
    "maintainer_email": "",
    "keywords": "code analysis,count,SLOC",
    "author": "Thomas Aglassinger",
    "author_email": "roskakori@users.sourceforge.net",
    "download_url": "https://files.pythonhosted.org/packages/71/0e/c7d891315a721fa4197e501835ba181a6241decb289d65d71a815167b2dd/pygount-1.6.1.tar.gz",
    "platform": null,
    "description": "[![PyPI](https://img.shields.io/pypi/v/pygount)](https://pypi.org/project/pygount/)\n[![Python Versions](https://img.shields.io/pypi/pyversions/pygount.svg)](https://www.python.org/downloads/)\n[![Build Status](https://github.com/roskakori/pygount/actions/workflows/build.yml/badge.svg)](https://github.com/roskakori/pygount/actions/workflows/build.yml)\n[![Test Coverage](https://img.shields.io/coveralls/github/roskakori/pygount)](https://coveralls.io/r/roskakori/pygount?branch=master)\n[![Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![License](https://img.shields.io/github/license/roskakori/pygount)](https://opensource.org/licenses/BSD-3-Clause)\n\n# pygount\n\nPygount is a command line tool to scan folders for source code files and\ncount the number of source code lines in it. It is similar to tools like\n[sloccount](https://www.dwheeler.com/sloccount/) and\n[cloc](https://github.com/AlDanial/cloc) but uses the\n[pygments](https://pygments.org/)\npackage to analyze the source code and consequently can analyze any\n[programming language supported by pygments](https://pygments.org/languages/).\n\nThe name is a combination of pygments and count.\n\nPygount is open source and distributed under the\n[BSD license](https://opensource.org/licenses/BSD-3-Clause). The source\ncode is available from https://github.com/roskakori/pygount.\n\n## Quickstart\n\nFor installation run\n\n```bash\n$ pip install pygount\n```\n\nTo get a list of line counts for a projects stored in a certain folder run for\nexample:\n\n```bash\n$ pygount ~/projects/example\n```\n\nTo limit the analysis to certain file types identified by their suffix:\n\n```bash\n$ pygount --suffix=cfg,py,yml ~/projects/example\n```\n\nTo get a summary of each programming language with sum counts and percentage:\n\n```bash\n$ pygount --format=summary ~/projects/example\n```\n\nTo analyze a remote git repository directly without having to clone it first:\n\n```bash\n$ pygount --format=summary https://github.com/roskakori/pygount.git\n```\n\nYou can pass a specific revision at the end of the remote URL:\n\n```bash\n$ pygount --format=summary https://github.com/roskakori/pygount.git/v1.5.1\n```\n\nThis example results in the following summary output:\n\n```\n\u250f\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n\u2503 Language         \u2503 Files \u2503     % \u2503 Code \u2503    % \u2503 Comment \u2503    % \u2503\n\u2521\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2529\n\u2502 Python           \u2502    18 \u2502  47.4 \u2502 2132 \u2502 63.6 \u2502     418 \u2502 12.5 \u2502\n\u2502 TOML             \u2502     2 \u2502   5.3 \u2502 1204 \u2502 82.7 \u2502       1 \u2502  0.1 \u2502\n\u2502 reStructuredText \u2502     9 \u2502  23.7 \u2502  566 \u2502 64.8 \u2502       1 \u2502  0.1 \u2502\n\u2502 Markdown         \u2502     3 \u2502   7.9 \u2502   53 \u2502 49.1 \u2502       0 \u2502  0.0 \u2502\n\u2502 Batchfile        \u2502     1 \u2502   2.6 \u2502   24 \u2502 68.6 \u2502       1 \u2502  2.9 \u2502\n\u2502 Text only        \u2502     2 \u2502   5.3 \u2502   24 \u2502 82.8 \u2502       0 \u2502  0.0 \u2502\n\u2502 Bash             \u2502     2 \u2502   5.3 \u2502   12 \u2502 80.0 \u2502       3 \u2502 20.0 \u2502\n\u2502 Makefile         \u2502     1 \u2502   2.6 \u2502    9 \u2502 45.0 \u2502       7 \u2502 35.0 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 Sum              \u2502    38 \u2502 100.0 \u2502 4024 \u2502 68.4 \u2502     431 \u2502  7.3 \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n```\n\nPlenty of tools can post process SLOC information, for example the\n[SLOCCount plug-in](https://wiki.jenkins-ci.org/display/JENKINS/SLOCCount+Plugin)\nfor the [Jenkins](https://jenkins.io/) continuous integration server.\n\nA popular format for such tools is the XML format used by cloc, which pygount\nalso supports and can store in an output file:\n\n```bash\n$ pygount --format=cloc-xml --out=cloc.xml ~/projects/example\n```\n\nTo get a short description of all available command line options use:\n\n```bash\n$ pygount --help\n```\n\nFor more information and examples read the documentation chapter on\n[Usage](https://pygount.readthedocs.io/en/latest/usage.html).\n\n## Contributions\n\nTo report bugs, visit the\n[issue tracker](https://github.com/roskakori/pygount/issues).\n\nIn case you want to play with the source code or contribute improvements, see\n[CONTRIBUTING](https://pygount.readthedocs.io/en/latest/contributing.html).\n\n## Version history\n\nSee [CHANGES](https://pygount.readthedocs.io/en/latest/changes.html).\n",
    "bugtrack_url": null,
    "license": "BSD",
    "summary": "count source lines of code (SLOC) using pygments",
    "version": "1.6.1",
    "project_urls": {
        "Changes": "https://pygount.readthedocs.io/en/latest/changes.html",
        "Documentation": "https://pygount.readthedocs.io",
        "Homepage": "https://github.com/roskakori/pygount",
        "Issue Tracker": "https://github.com/roskakori/pygount/issues",
        "Repository": "https://github.com/roskakori/pygount.git"
    },
    "split_keywords": [
        "code analysis",
        "count",
        "sloc"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9d417af1a366c4d9b02d939c2c2902f45b29cdddd665109e53f5d6b8678d3910",
                "md5": "7039dd4e8ba944096910f1a1a8d67ec2",
                "sha256": "85b1d06d51398150fe6de3ec39feca867e95dc9c7a1a45f4dee731ab43177bcf"
            },
            "downloads": -1,
            "filename": "pygount-1.6.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7039dd4e8ba944096910f1a1a8d67ec2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4",
            "size": 28147,
            "upload_time": "2023-07-02T16:51:12",
            "upload_time_iso_8601": "2023-07-02T16:51:12.704454Z",
            "url": "https://files.pythonhosted.org/packages/9d/41/7af1a366c4d9b02d939c2c2902f45b29cdddd665109e53f5d6b8678d3910/pygount-1.6.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "710ec7d891315a721fa4197e501835ba181a6241decb289d65d71a815167b2dd",
                "md5": "0f9f5ff9bc9634412a49c9814d9e3581",
                "sha256": "fac00c6bd61ab6d7633fe8724ae73943cde169de4f2a014244a488037a14d385"
            },
            "downloads": -1,
            "filename": "pygount-1.6.1.tar.gz",
            "has_sig": false,
            "md5_digest": "0f9f5ff9bc9634412a49c9814d9e3581",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4",
            "size": 26249,
            "upload_time": "2023-07-02T16:51:14",
            "upload_time_iso_8601": "2023-07-02T16:51:14.300592Z",
            "url": "https://files.pythonhosted.org/packages/71/0e/c7d891315a721fa4197e501835ba181a6241decb289d65d71a815167b2dd/pygount-1.6.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-02 16:51:14",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "roskakori",
    "github_project": "pygount",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pygount"
}
        
Elapsed time: 0.08181s