SCM mining utility classes
Project description
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
This package was inspired by Adam Tornhill’s books.
This package was created with Cookiecutter.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ecccf6f6531d7d3ecd1bdfae5e93af38f185505e6dd70100d5a21e2e28170abe
|
|
| MD5 |
60cb3fa599cda88240bd33efcb3783bd
|
|
| BLAKE2b-256 |
061c3f071173090e89772c8c3d69c8c26de0958600458d12897917fe67e77ba1
|
Provenance
The following attestation bundles were made for codemetrics-1.0.0.tar.gz:
Publisher:
publish.yml on elmotec/codemetrics
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
codemetrics-1.0.0.tar.gz -
Subject digest:
ecccf6f6531d7d3ecd1bdfae5e93af38f185505e6dd70100d5a21e2e28170abe - Sigstore transparency entry: 521537540
- Sigstore integration time:
-
Permalink:
elmotec/codemetrics@91c6c7e55b396e35b7478f930ff6e96476218e16 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/elmotec
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@91c6c7e55b396e35b7478f930ff6e96476218e16 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
10b2487518aa7c3e37fad984313aed3efbe071e15fae01832ba900216f407605
|
|
| MD5 |
55d3cce49e98e6c81576eb5957b0af08
|
|
| BLAKE2b-256 |
731fc0564d3c66210f55f139bf9e0ae8d7fe8e48ba751862bfd6e2be1d6006b1
|
Provenance
The following attestation bundles were made for codemetrics-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on elmotec/codemetrics
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
codemetrics-1.0.0-py3-none-any.whl -
Subject digest:
10b2487518aa7c3e37fad984313aed3efbe071e15fae01832ba900216f407605 - Sigstore transparency entry: 521537563
- Sigstore integration time:
-
Permalink:
elmotec/codemetrics@91c6c7e55b396e35b7478f930ff6e96476218e16 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/elmotec
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@91c6c7e55b396e35b7478f930ff6e96476218e16 -
Trigger Event:
push
-
Statement type: