Skip to main content

SCM mining utility classes

Project description

PyPi version Python compatibility GitHub Workflow Python application AppVeyor main status Libraries.io dependency status for latest release Documentation Coverage Codacy

codemetrics

Mine your SCM for insight on your software. A work of love inspired by Adam Tornhill’s books.

Code metrics is a simple Python module that leverage pandas and your source control management (SCM) tool togenerate insight on your code base.

  • pandas: for data munching.

  • lizard: for code complexity calculation.

  • cloc.pl (script): for line counts from cloc

  • For now, only Subversion and git are supported.

Installation

To install codemetrics, simply use pip:

pip install codemetrics

Usage

This is a simple tool that makes it easy to retrieve information from your Source Control Management (SCM) repository and hopefully gain insight from it.

import codemetrics as cm
import cm.git

project = cm.GitProject('path/to/project')
loc_df = cm.get_cloc(project, cloc_program='/path/to/cloc')
log_df = cm.get_log(project)
ages_df = cm.get_ages(log_df)

To retrieve the number of lines changed by revision with Subversion:

import codemetrics as cm
import cm.git

project = cm.SvnProject('path/to/project')
log_df = cm.get_log(project).set_index(['revision', 'path'])
log_df.loc[:, ['added', 'removed']] = log_df.reset_index().\
                                         groupby('revision').\
                                         apply(cm.svn.get_diff_stats, chunks=False)

See module documentation for more advanced functions or the example notebook where codemetrics is applied to pandas.

There is also an example notebook running codemetrics on the pandas code base, and the example html export of that notebook output (some features are missing like the display of file names when hovering on the circles).

License

Licensed under the term of MIT License. See attached file LICENSE.txt.

Credits

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

codemetrics-1.0.0.tar.gz (53.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

codemetrics-1.0.0-py3-none-any.whl (28.7 kB view details)

Uploaded Python 3

File details

Details for the file codemetrics-1.0.0.tar.gz.

File metadata

  • Download URL: codemetrics-1.0.0.tar.gz
  • Upload date:
  • Size: 53.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for codemetrics-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ecccf6f6531d7d3ecd1bdfae5e93af38f185505e6dd70100d5a21e2e28170abe
MD5 60cb3fa599cda88240bd33efcb3783bd
BLAKE2b-256 061c3f071173090e89772c8c3d69c8c26de0958600458d12897917fe67e77ba1

See more details on using hashes here.

Provenance

The following attestation bundles were made for codemetrics-1.0.0.tar.gz:

Publisher: publish.yml on elmotec/codemetrics

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file codemetrics-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: codemetrics-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 28.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for codemetrics-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 10b2487518aa7c3e37fad984313aed3efbe071e15fae01832ba900216f407605
MD5 55d3cce49e98e6c81576eb5957b0af08
BLAKE2b-256 731fc0564d3c66210f55f139bf9e0ae8d7fe8e48ba751862bfd6e2be1d6006b1

See more details on using hashes here.

Provenance

The following attestation bundles were made for codemetrics-1.0.0-py3-none-any.whl:

Publisher: publish.yml on elmotec/codemetrics

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page