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, commit_sha, authors = 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.


Attributions

The logo is combined from two logos from flaticon:

Metadata

Release files for truckfactor 0.3.2

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.3.2
File Size Uploaded Provenance Actions
truckfactor-0.3.2.tar.gz 20.2 kB Without provenance Details for truckfactor-0.3.2.tar.gz

Built distribution (wheel)

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

Total release size: 42.1 kB

Release files / truckfactor-0.3.2.tar.gz

Download URL truckfactor-0.3.2.tar.gz
Size 20.2 kB
Tags Source
SHA-256 checksum
How to use checksums
613f484b81783db6731257778cc71be7fafd119f0f9cf51ba43950249002064f
BLAKE2b-256 checksum
How to use checksums
75b31c3ff24045ae16aa2c92e021e3ba4e4f126df3c4662f0d15d4cd7ea4fff2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.10.6 Linux/5.19.0-76051900-generic

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

Download URL truckfactor-0.3.2-py3-none-any.whl
Size 22.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d3e6c32a04d46f58410fea960856c21169d01881a99c01d9e9664d202855c77c
BLAKE2b-256 checksum
How to use checksums
eb5fd5c24ad25c183f4774766817d38df50eb1546423e918d01f15eb7412aa3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.10.6 Linux/5.19.0-76051900-generic

Security for truckfactor 0.3.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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