Skip to main content

What is this?

This tool, truckfactor computes the truck (bus/lorry/lottery) factor for a given Git repository.

The truck factor is

the number of people on your team that have to be hit by a truck (or quit) before the project is in serious trouble

L. Williams and R. Kessler, Pair Programming Illuminated. Addison Wesley, 2003.

Installation

pip install truckfactor

Requirements

The tool requires that git is installed and accessible on PATH.

How to use it?

You have to either point the tool to a directory containing a Git repository or to a URL with a remote repository. In case a URL is given, the tool will clone the repository into a temporary directory.

From the terminal, the tool can be run as in the following:

Usage:
  truckfactor <repository> [<commit_sha>] [--output=<kind>]
  truckfactor -h | --help
  truckfactor --version

Options:
  -h --help     Show this screen.
  --version     Show version.
  --output=<kind>  Kind of output, either csv or verbose.

For example, in its most basic form it can be called like this:

$ truckfactor <path_or_url_to_repository>
The truck factor of <path_to_repository> (<commit_sha>) is: <number>

If no output switch is given, the tool produces a single line output above. Otherwise, it will output a line in CSV format or in key: value form.

Calling it from code:

from truckfactor.compute import main


truckfactor = main("<path_to_repo>")

How does the tool compute the truck factor?

In essence the tool does the following:

  • Reads a git log from the repository
  • Computes for each file who has the knowledge ownership of it.
    • A contributor has knowledge ownership of a file when she edited the most lines in it.
    • That computation is inspired by A. Thornhill Your Code as a Crime Scene.
    • Note, only for text files knowledge ownership is computed. The tool may not return a good answer for repositories containing only binary files.
  • Then similar to G. Avelino et al. A novel approach for estimating Truck Factors low-contributing authors are removed from the analysis as long as still more than half of all files have a knowledge owner. The amount of remaining knowledge owners is the truck factor of the given repository.

Why does it exist?

This tool was developed since in Dec. 2020, we could not find an open-source and readily installable tool to compute truck factors of projects on PyPI or Rubygems.

Release files for truckfactor 0.2.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for truckfactor 0.2.5
File Size Uploaded
truckfactor-0.2.5.tar.gz 19.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for truckfactor 0.2.5
File Interpreter ABI Platform
truckfactor-0.2.5-py3-none-any.whl Python 3 none any Details

Total release size: 39.9 kB

Release files / truckfactor-0.2.5.tar.gz

Download URL truckfactor-0.2.5.tar.gz
Size 19.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e10fe7377ebbd71f766dc7d76c7daed63f607c64546749ab32d89210bf4671f1
BLAKE2b-256 checksum
How to use checksums
7a74b20736e3792e570080b392d89609284245962d607db0010ca64d6a1d58a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.4 CPython/3.9.0 Darwin/18.7.0

Release files / truckfactor-0.2.5-py3-none-any.whl

Download URL truckfactor-0.2.5-py3-none-any.whl
Size 20.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ae367b30bfbf09056ab2eb0ee1f3a38f74d925e81ebb6bcce56665aacc7bf454
BLAKE2b-256 checksum
How to use checksums
778b281ea6ddc7d5230e449dd0f61ec03c8211deef95863671f6bc5be59187c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.4 CPython/3.9.0 Darwin/18.7.0

Release history Release notifications | RSS feed

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.10

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

This release

0.2.5 This release

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page