{"id":16894428,"url":"https://github.com/enselic/git-repo-language-trends","last_synced_at":"2025-04-11T13:33:37.868Z","repository":{"id":49129704,"uuid":"330888327","full_name":"Enselic/git-repo-language-trends","owner":"Enselic","description":"Analyze programming language usage over time in a git repository and produce a graphical or textual representation of the result.","archived":false,"fork":false,"pushed_at":"2021-08-30T14:52:34.000Z","size":278,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-05-08T19:49:19.702Z","etag":null,"topics":["git","png","repository-utilities","statistics","svg","tabular-data","trend-analysis"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Enselic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-01-19T06:42:57.000Z","updated_at":"2023-08-30T20:54:15.000Z","dependencies_parsed_at":"2022-09-04T15:25:01.449Z","dependency_job_id":null,"html_url":"https://github.com/Enselic/git-repo-language-trends","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Enselic%2Fgit-repo-language-trends","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Enselic%2Fgit-repo-language-trends/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Enselic%2Fgit-repo-language-trends/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Enselic%2Fgit-repo-language-trends/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Enselic","download_url":"https://codeload.github.com/Enselic/git-repo-language-trends/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248409859,"owners_count":21098771,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["git","png","repository-utilities","statistics","svg","tabular-data","trend-analysis"],"created_at":"2024-10-13T17:18:44.802Z","updated_at":"2025-04-11T13:33:37.832Z","avatar_url":"https://github.com/Enselic.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# git-repo-language-trends\n\nAnalyze programming language usage over time in a git repository and produce a\ngraphical or textual representation of the result.\n\nAvailable output file formats:\n* **.svg** - Scalable Vector Graphics\n* **.png** - Portable Network Graphics\n* **.csv** - Comma-separated values\n* **.tsv** - Tab-separated values\n\n# Examples\n\nShowing the pace at which **Kotlin** is replacing **Java** in [AndroidX\n`support`\nlibrary](https://android.googlesource.com/platform/frameworks/support/) by\nlanguage usage percentage:\n\n    % cd ~/src/androidx\n    % git-repo-language-trends --relative --max-commits 30 --min-interval-days 60  .kt .java\n    % open androidx-language-trends.png\n\n![AndroidX language trends](https://i.imgur.com/1B9cN1z.png)\n\nShowing how the implementation of CPython has grown over the last decades in\nterms of number of lines of C (.c and .h files) and Python (.py files):\n\n    % cd ~/src/cpython\n    % git-repo-language-trends --max-commits 30 --min-interval-days 365 .c+.h .py\n    % open cpython-language-trends.png\n\n![CPython language trends](https://i.imgur.com/Uv4mK1z.png)\n\nShowing the pace at which **TypeScript** is replacing **JavaScript** in\n[`mattermost-webapp`](https://github.com/mattermost/mattermost-webapp) by\nlanguage usage percentage:\n\n    % cd ~/src/mattermost-webapp\n    % git-repo-language-trends --min-interval-days 30 --max-commits 25 --relative .ts+.tsx .js+.jsx\n    % open mattermost-webapp-language-trends.png\n\n![mattermost-webapp language trends](https://i.imgur.com/6IGbgjb.png)\n\nShowing line count trends for **Swift**, **Objective-C** (.m and .h files summed\ntogether), and **Markdown** (.md) in the [iOS `Charts`\nlibrary](https://github.com/danielgindi/Charts):\n\n    % cd ~/src/Charts\n    % git-repo-language-trends  --min-interval-days 60 .swift .m+.h .md\n    % open Charts-language-trends.png\n\n![iOS Charts language trends](https://i.imgur.com/TVOiSlV.png)\n\nSame data as above, but as a comma-separated values (.csv) file, in case you\nwant to generate plots yourself from the raw data, and limited to 10 commits:\n\n    % cd ~/src/Charts\n    % git-repo-language-trends  --max-commits 10 --min-interval-days 60 .swift .m+.h .md -o charts-language-trends.csv\n    % cat charts-language-trends.csv\n            ,.swift,.m+.h,.md\n    2019-03-20,32163,6205,3785\n    2019-06-10,32347,6205,3859\n    2019-09-09,32368,6205,3859\n    2019-11-13,32746,6205,4007\n    2020-02-13,32687,6205,4015\n    2020-04-16,32778,6205,891\n    2020-07-08,32781,6205,897\n    2020-10-08,32785,6205,4215\n    2020-12-15,32176,6219,4225\n    2021-02-26,31771,6219,4252\n\n\n# Installation\n\n```sh\n# Install the tool to ~/opt/git-repo-language-trends/bin/git-repo-language-trends\npython3 -m venv ~/opt/git-repo-language-trends\n~/opt/git-repo-language-trends/bin/pip install git-repo-language-trends\n```\n\n\n# Usage\n\nFor brevity `~/opt/git-repo-language-trends/bin/git-repo-language-trends` is\nshortented to `git-repo-language-trends` below.\n\nFirst go to the git repository for a project.\n\n    cd ~/src/your-project\n\nThen run the tool, passing the file extensions for the languages you are\ninterested in as positional arguments:\n\n    git-repo-language-trends .java .kt\n\nFor languages with multiple file extensions such as C, you can use the `+`\nsyntax which will automatically summarize line counts from both file extensions.\nTo compare C and Rust:\n\n    git-repo-language-trends .c+.h .rs\n\nIf you want relative numbers, enable the `--relative` option:\n\n    git-repo-language-trends --relative .c+.h .rs\n\nUse `git-repo-language-trends --help` to see more options.\n\nIf `git-repo-language-trends` is not in your `PATH` after installation you can\nrun the tool via its module, e.g.:\n\n    python3 -m git_repo_language_trends --help\n\n# Method\n\nProgramming langauge usage is determined by the total number of newline\ncharacters in files with a given file extension.\n\nIt is easy to come up with something more fancy, but it would be overkill.\n\n\n# Performance\n\nThis program is pretty fast, because it uses the\n[**pygit2**](https://github.com/libgit2/pygit2) wrapper for the C library\n[**libgit2**](https://github.com/libgit2/libgit2). It easily counts hundreds of\nthousands lines per second on low-end machines. It also uses a cache keyed\nby git blob ID to avoid counting lines for the same blob twice.\n\n\n# Development\n\nClone this repo:\n\n    git clone https://github.com/Enselic/git-repo-language-trends.git\n\nCreate a venv:\n\n    python3 -m venv ~/venv-grlt\n    source ~/venv-grlt/bin/activate\n\nInstall and update dev dependencies:\n\n    python3 -m pip install --upgrade pip flake8 pytest\n\nMake an editable install:\n\n    python3 -m pip install -e .\n\nthen make your changes. When done, lint and test:\n\n    flake8 \u0026\u0026 pytest -vv\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenselic%2Fgit-repo-language-trends","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fenselic%2Fgit-repo-language-trends","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenselic%2Fgit-repo-language-trends/lists"}