Skip to main content

SCM mining utility classes

Project description

.. image:: https://img.shields.io/pypi/v/codemetrics.svg
:target: https://pypi.org/pypi/codemetrics/
:alt: PyPi version

.. image:: https://img.shields.io/pypi/pyversions/codemetrics.svg
:target: https://pypi.org/pypi/codemetrics/
:alt: Python compatibility

.. image:: https://img.shields.io/travis/elmotec/codemetrics.svg
:target: https://travis-ci.org/elmotec/codemetrics
:alt: Build Status

.. image:: https://img.shields.io/readthedocs/codemetrics.svg
:target: https://codemetrics.readthedocs.org/
:alt: Documentation

.. image:: https://coveralls.io/repos/github/elmotec/codemetrics/badge.svg?branch=master
:target: https://coveralls.io/github/elmotec/codemetrics?branch=master
:alt: Test coverage

.. image:: https://api.codacy.com/project/badge/Grade/dd4a11eb66674b3bbe518d8f829b6234
:target: https://www.codacy.com/app/elmotec/codemetrics?utm_source=github.com&utm_medium=referral&utm_content=elmotec/codemetrics&utm_campaign=Badge_Grade
:alt: 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`_


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_.


.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _lizard: https://github.com/terryyin/lizard
.. _pandas: https://pandas.pydata.org/
.. _cloc: http://cloc.sourceforge.net/
.. _Pandas documentation: https://pandas.pydata.org/pandas-docs/stable/text.html
.. _MIT License: https://en.wikipedia.org/wiki/MIT_License
.. _Adam Tornhill: https://www.adamtornhill.com/
.. _module documentation: https://codemetrics.readthedocs.org/
.. _example notebook: https://github.com/elmotec/codemetrics/tree/master/notebooks


=======
History
=======

0.9.2 (2019-03-28)
----------------
* 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`

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.

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

Uploaded Source

File details

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

File metadata

  • Download URL: codemetrics-0.9.2.tar.gz
  • Upload date:
  • Size: 49.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.31.1 CPython/3.7.0

File hashes

Hashes for codemetrics-0.9.2.tar.gz
Algorithm Hash digest
SHA256 49b026fd49078ab4ef2180af026733772d1f3c47d3c33525bb1db162b893fbea
MD5 6cc56c0e932451d3f072db391e57b914
BLAKE2b-256 0562b394e2af21e5c5a151219fadb14d5e8d819671eab6e8e33289e68ae541ea

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