Project setup

In case you want to play with the source code or contribute changes proceed as follows:

  1. Check out the project from GitHub:

    $ git clone
    $ cd pygount
  2. Create and activate a virtual environment:

    $ python -m venv venv
    $ . venv/bin/activate
  3. Install the required packages:

    $ pip install --upgrade pip
    $ pip install -r dev-requirements.txt
  4. Install the pre-commit hook:

    $ pre-commit install


To run the test suite:

$ pytest

To build and browse the coverage report in HTML format:

$ pytest --cov-report=html
$ open htmlcov/index.html  # macOS only


To build the documentation in HTML format:

$ make -C docs html
$ open docs/_build/html/index.html  # macOS only

Coding guidelines

The code throughout uses a natural naming schema avoiding abbreviations, even for local variables and parameters.

Many coding guidelines are automatically enforced (and some even fixed automatically) by the pre-commit hook. If you want to check and clean up the code without performing a commit, run:

$ pre-commit run --all-files

In particular, this applies black, flake8 and isort.