gitcen : censusing the git

In the developers’ sprint at PyCon US, I was sitting in the MicroPython room. After the second half, many of the developers left the room. The room turned into a Tundra region (I came from a place where the temperature was 40C). The only option left was to get into the CPython room. It seems a huge(if not most) of the people are or aspires to be a core developer. I was unwilling to get inside. I was shy, “how can a novice sit with the best and work on something beginner?” But the basic “intent to live” wins and to save myself from being ice-fied I sat in there. It was a muggle sitting with wizards. I just wanted to check my ‘audacity’, so I came with the idea a project -- gitcen. But never managed to work on it until a few days ago.

Introducing gitcen

gitcen - censusing a git repository. This is a command line application. If you provide a git repository it can tell the number of commits made in

  • each day of the week,
  • each hour of a day,
  • by each author of the commits.

How to install and use it:

You can install gitcen using pip.

$ pip install gitcen 

One will get these information on passing different flags such as --author,
--all etc.

Use the --path flag to point to a git directory:

$ gitcen --path  ~/code/cpython

By default it prints the commits made on days and hours of a day.

If we want to get the details of the authors commit we have to provide the author, flag:

$ gitcen --author --path  ~/code/cpython

For getting all the information, time, day and author, then we have to pass the all flag:

$ gitcen --all --path  ~/code/cpython

I know you can easily find out these information using git but I wanted to write my application. It gave me some interesting facts when I ran gitcen on cpython:

  • Sunday has 12484 commits
  • Monday has 13779 commits
  • Tuesday has 15499 commits
  • Wednesday has 15112 commits
  • Thursday has 13718 commits
  • Friday has 15312 commits
  • Saturday has 13642 commits.

Tuesday is the most productive and Sunday is least (thank God these people actually take a day off. Now actually I can use this data and tell Mr.(lazy) Das to take us out over weekends and stop giving,"I have work. All my friends work more over the weekends." excuse:)).

The first issue I had to tackle was how to write a command line application. I googled for it. The blog post which popped up, was written by someone familiar. I decided to trust that and started working accordingly. I installed Click and went through the whole tutorial according to the blogpost. The next module I spent my time with was datetime module. To get the statistics from git I used pygit2. It is the Python binding to libgit2 shared library.

This is the first time I uploaded a project in PyPI. I will be updating the code, adding new features to it in the new releases. This is not a perfect code, nor something very innovative. But as they say release early release often. So here is the gitcen 0.1.0. It has offered me a chance to learn, have fun, make mistakes and grow.

Show Comments