The world’s leading publication for data science, AI, and ML professionals.

Showcase GitHub profile for job interviews

using Datapane and GitHub API

Photo by Adeolu Eletu on Unsplash
Photo by Adeolu Eletu on Unsplash

GitHub is definitely the most used platform for collaborative coding and software sharing. Hence, it represents a precious resource for candidates to showcase their projects and for companies to sift potential hires.

Whether you are an applicant or an employer, querying the information of a GitHub profile can be time-consuming and presents several challenges. You need to search user’s data, inspect repositories, explore activities and languages, etc. 😬 😒 Also, summarising the profile’s content through a nice Dashboard requires considerable effort using drag-and-drop tools like Power BI or Tableau. 😰 😵 Not to mention the ugly feeling of repeating this for multiple job postings or candidates. 😫 🤕

Luckily, some great APIs enable doing so in a customisable and reproducible manner. In this post, we are going to build a dashboard for showcasing the main features of a GitHub account using Datapane and PyGithub.


Photo by Roman Synkevych 🇺🇦  on Unsplash
Photo by Roman Synkevych 🇺🇦 on Unsplash

Setup

The setup is pretty simple. Just clone this repository and install the 3 dependencies listed in the requirements.txt file.

$git clone [email protected]:clissa/github-user-dashboard.git
$cd github-user-dashboard
$conda create --name Datapane python=3.9.6
$conda activate datapane
$conda install -c conda-forge --file requirements.txt

Extracting profile data with GitHub API

First, let’s get some data about the user activity, its repositories and languages.

Connecting to the GitHub API

For convenience, I will use my GitHub account as an example, but you can easily adapt the code for your own use.

Although not strictly necessary for our analysis, we connect to the Github Api through a token to access both public and private information. For this purpose, you can get a token here and store it as the GITHUB_API_TOKEN environment variable in a .env file. The dotenv package will do the rest!

Retrieve user data

This task depends on what kind of information we want to visualise in our dashboard. I chose stats related to the number of repositories and commits, the engagement in terms of stars received and followers, the programming languages adopted, and the most important repositories (collaborative projects and most starred).

Of course, the possibilities are endless!! Feel free to adapt the following script for your needs!


Photo by Myriam Jessier on Unsplash
Photo by Myriam Jessier on Unsplash

Datapane dashboard

Datapane is an open-source reporting API that enables building interactive reports, hosting on their platform and even embedding into third-party websites. All of this completely programmatically to guarantee quick reproducibility and automation.

The idea is to organise our dashboard into 3 tabs:

  • Highlights: presents some summary stats and info about the user
  • Languages: outlines insights about the programming languages adopted
  • Repositories: illustrates user’s contributions to collaborative projects and summarises the most popular repositories

Structure blocks

In order to do that, we can use Datapane’s Page() class to construct each of the tabs. The blocks argument collects all the contents to display inside the tab, while title determines the tab heading.

Inside each tab, the page structure can be set thanks to the Group() class. For example, we can nest several of these objects to articulate our sections within the page. We use the block argument for listing the components and columns to specify the structure, from which each element’s positioning is then inferred (by default, contents are filled by row).

Another useful building block is the Select() class which acts as a container of nested contents. Besides the usual block argument, the type attribute allows inserting drop-down menus (SelectType.DROPDOWN) or tabs (SelectType.TABS).

Content blocks

The great thing about Datapane is that it provides native classes for all types of content you may want to insert in a report, including text, plots, tables, embeddings of various media types, attachments and more!

The Text() class allows to insert textual contents as pure text or Markdown and automatically detects the encoding and correspondingly displays it. Alternative formats are also available with HTML(), Code() and Formula() classes.

Regarding data vizs, the Plot() class enables using static and interactive charts, seamlessly interacting with the most popular plotting frameworks such as Altair, Plotly, Bokeh, Matplotlib and Seaborn.

Finally, Datapane allows inserting entire data tables in reports. For this, you simply need to use the Data() (static) or DataTable() (interactive) classes and pass a pandas dataframe.

Creating report and upload

Once we have all the building blocks of our dashboard, then we only need to put them together to create a report. For this, we just need to instantiate a Report() object and pass all the blocks we have designed.

Finally, we can save our report locally as an html file and/or upload it directly to Datapane for free! ✨ 👏 ✌️


Photo by Windows on Unsplash
Photo by Windows on Unsplash

So, are you ready to see the final version of our GitHub user dashboard?

Probably the most exciting Datapane feature is that you can share your public reports everywhere, and even embed entire dashboards on Medium as interactive elements! Here is the result 📊 📈 😎


Final thoughts

Well done folks! We’ve just created a GitHub user dashboard for showcasing our projects at job interviews or summarising the activity of potential candidates.

Plus, Datapane ensures all is easily customisable and reproducible, making the process scalable to multiple applications or candidates! 😃 😍 🍾 🙌 🎉

If you want to know more about Datapane and the GitHub API, here are some useful readings:

  1. https://blog.datapane.com/
  2. https://www.techgeekbuzz.com/how-to-use-github-api-in-python/
  3. https://martinheinz.dev/blog/25

For this article it’s all. Now I am really curious to see what kind of reports you can come up with. Feel free to drop me the link to your Datapane dashboard in the comments!


Related Articles