Plots programming language usage over time in a git repository to an SVG file.
Project description
git-repo-language-trends
Analyze programming language usage over time in a git repository and produce a graphical or textual representation of the result.
Several output file formats are available:
- .svg - Scalable Vector Graphics
- .png - Portable Network Graphics
- .csv - Comma-separated values
- .tsv - Tab-separated values
Example command and its SVG output:
% cd ~/src/cpython
% git-repo-language-trends --max-commits 30 --min-interval-days 365 .c+.h .py
Installation
Installation requires pip>=19.0
. When in doubt, begin by upgrading pip
:
python3 -m pip install --upgrade pip
Then simply do
python3 -m pip install git-repo-language-trends
Usage
First go to the git repository for a project.
% cd ~/src/your-project
Then run the tool, passing the file extensions for the languages you are interested in as positional arguments:
% git-repo-language-trends .java .kt
For language with multiple file extensions such as C, you can use the +
syntax
which will automatically summarize line counts from both file extensions. To
compare C and Rust:
% git-repo-language-trends .c+.h .rs
Method
Programming langauge usage is determined by the total number of newlines in files with a given file extension.
More examples
TODO
Performance
This program is pretty fast, because it uses the pygit2 wrapper for the C library libgit2. On a low-end computer (with an Intel(R) Celeron(R) J4005 CPU @ 2.00GHz) it counts ~400 000 lines per second.
Development
First clone this repo:
git clone https://github.com/Enselic/git-repo-language-trends.git
then make an editable install:
python3 -m pip install -e .
then make your changes. When done, lint and test:
flake8 && pytest -vv
TODO
- Fix CI to use Python 3.6 for app
- print info when auto caclulating extensions to use
- Add .tsv and .csv and .png and .svg CLI test cases
- handle shallow clones
- limit size of cache
- stacked percentage chart
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
Built Distribution
File details
Details for the file git-repo-language-trends-0.0.3.tar.gz
.
File metadata
- Download URL: git-repo-language-trends-0.0.3.tar.gz
- Upload date:
- Size: 10.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5da94cd21cb468f30b7bd170b91f485b6354dc4623496907558842e99de2b972 |
|
MD5 | b9a4716b0440202ff9ac1ea64da6fe52 |
|
BLAKE2b-256 | 55750cea1c63378f02b35892ef07ca0c08b49b05cd164c11ff4ac3ac7348ea3d |
File details
Details for the file git_repo_language_trends-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: git_repo_language_trends-0.0.3-py3-none-any.whl
- Upload date:
- Size: 11.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 14d033e931fef979ef2de1ff06e0e7e19b16c7e694a7dd948bc75666153a2db1 |
|
MD5 | 1de479d728d051dd433c971fd0725d36 |
|
BLAKE2b-256 | cef2e5ab15cbe2bf4effe88e132071184e9049a10c99bc03b2f72260686926a3 |