Skip to main content

SCM mining utility classes

Project description

PyPi version Python compatibility GitHub Workflow Python application AppVeyor master 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

log_df = cm.get_git_log()
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

log_df = cm.get_svn_log().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 (html export of pandas).

License

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

Credits

History

0.10.0 (2020-12-12)

  • Fixed handling of files with commas in the name.

  • Fixed visualization of pandas example as html.

  • Leveraged new pandas dtypes.

  • Introduced type hints in code base.

  • Switched backend to GitHub actions from travis-ci.

0.9.6 (2019-09-29)

0.9.5 (2019-09-05)

  • Factored common logic between git and svn. Bug fixes.

0.9.4 (2019-09-02)

0.9.3 (2019-04-01)

  • Fixed retrieval of added and removed lines when there are spaces in a file name.

  • Fixed indexed input in get_mass_changes.

  • Fixed handling of removed files in svn.get_diff_stats.

  • Fixed handling of branches in svn.get_diff_stats.

0.9 (2019-03-19)

  • Started changing interfaces to leverage apply and groupby.

  • Added lines added/removed for Subversion.

0.8.2 (2019-02-26)

  • Added svn.get_diff_stats to retrieve line changes stats per diff.

0.8 (2019-02-13)

  • Integrated lizard to calculate average and function level cyclomatic complexity.

0.7 (2019-01-09)

  • Function oriented interface.

  • Visualization via Vega, Altair.

  • Documentation.

0.6

  • Alpha work.

0.5 (2018-05-12)

  • First release on PyPI.

MIT License

Copyright (c) 2012-2019 elmotec

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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-0.10.0.tar.gz (50.1 kB view details)

Uploaded Source

Built Distribution

codemetrics-0.10.0-py2.py3-none-any.whl (27.7 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: codemetrics-0.10.0.tar.gz
  • Upload date:
  • Size: 50.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.6

File hashes

Hashes for codemetrics-0.10.0.tar.gz
Algorithm Hash digest
SHA256 0558815c01b7b99132af2ef51bc5ddd48d1450aacf8dd207ddd330ba894cb3ae
MD5 1b4c556f63aa0a0f6ea0a91a4e95ced7
BLAKE2b-256 5596499082e34b48506790b2bdf4329b0b31bc55e191cde7923648d148b8542e

See more details on using hashes here.

File details

Details for the file codemetrics-0.10.0-py2.py3-none-any.whl.

File metadata

  • Download URL: codemetrics-0.10.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 27.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.6

File hashes

Hashes for codemetrics-0.10.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 a0f80e38a11706708e0b40b0d18564d0fbb2d0b1aaaf4ba5dae41171e42722db
MD5 af8709478c00c38ad923933c7977ae67
BLAKE2b-256 f37375301c207fb55dd2fde3bd955e328e256814942cc5d5f3f58eea8f795c7b

See more details on using hashes here.

Supported by

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