From 94463a238702680a237ddfb2cbb9190669a334c1 Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 14 Jul 2024 21:06:06 -0500 Subject: [PATCH] attempt to add language graph --- .github/workflows/pages.yml | 3 +++ docs/conf.py | 10 ++++++++++ docs/index.rst | 2 ++ docs/requirements.txt | 2 ++ 4 files changed, 17 insertions(+) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 0a18e9a4..fa2fcb96 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -30,6 +30,9 @@ jobs: with: node-version: 22 + - name: Install Linguist + run: gem install github-linguist + - name: Build sphinx docs run: make html diff --git a/docs/conf.py b/docs/conf.py index 75b35294..dfdac261 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -11,6 +11,8 @@ from sys import path as sys_path from sphinxcontrib.domaintools import custom_domain +from gh import linguist +import matplotlib.pyplot as plt basedir = path.abspath(path.join(path.dirname(__file__), '..')) sys_path.insert(0, basedir) @@ -73,6 +75,13 @@ intersphinx_mapping = {'python': ('https://docs.python.org/3', None)} def setup(app): + langs = ghl.linguist(basedir) + labels = [lang[0] for lang in langs] + sizes = [lang[1] for lang in langs] + fig, ax = plt.subplots() + ax.pie(sizes, labels=labels, autopct='%1.1f%%') + plt.savefig("languages.svg") + app.add_domain(custom_domain( "RustDomain", "rust", @@ -86,3 +95,4 @@ def setup(app): }, } )) + diff --git a/docs/index.rst b/docs/index.rst index 02b8477a..47eb3fbe 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -66,6 +66,8 @@ This project is divided into several Makefiles, connected by a root Makefile whi If the recipe you call isn't covered by any others, it will get distributed to all languages. So for instance, ``make test`` would be translated to ``make cs_test c_test js_test py_test rs_test`` +.. image:: ./languages.svg + .. |C| replace:: **C** .. |C#| replace:: **C#** .. |Js| replace:: **JavaScript** diff --git a/docs/requirements.txt b/docs/requirements.txt index 1ba70c05..89c4baca 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -4,3 +4,5 @@ sphinx-js sphinx-csharp sphinxcontrib-makedomain sphinxcontrib-domaintools +ghlinguist +matplotlib