Cross-platform CLI tool to generate your Github profile's stats and summary.

Overview

ghs

Cross-platform CLI tool to generate your Github profile's stats and summary.

MIT License prs welcome platforms

Preview

Hop on to examples for other usecases.


Jump to:

Installation

Using pip

The stable version of this package is maintained on pypi, install using pip:

pip install ghs

Using source code

This can be useful when you want to do a code contribution to this project. You can test and verify your local changes before submitting a Pull Request.

  1. Clone the repository
git clone https://github.com/interviewstreet/ghs.git
  1. Navigate to the project root and create a virtual environment
python -m venv venv
  1. Activate the virtual environment
    • For macOS and linux, run source venv/bin/activate
    • For windows, run .\venv\Scripts\activate
  2. Install the cli by running the following command while you are in the project root
pip install .

Note: You need to reinstall by running the pip command if you want the cli to pick up your code changes.

Docker

docker build -t ghs:latest .
docker run -it ghs ghs --help

Github PAT

Generate a Github personal access token (https://github.com/settings/tokens) and use the ghs -t command to save it in the config file. This will be used to make the API requests to Github. A happy side-effect of this is that your private contributions are also considered while generating the stats and the summary of your username.

Please make sure that you give the following scopes to the token:

  • repo
  • read:user
  • read:packages

PS: Your Github PAT is not compromised by ghs. Please read the Privacy Notice to know more.

Usage

ghs [options]
Option Description
-v --version Print the cli version
-t --token-update Prompts the user for github PAT and saves it in the config file
-u <username> Print the general stats for the provided username
-s --summary Print the summary of the user. The username should be provided using the -u flag.
-c --copy-to-clipboard Copy the output to clipboard. Can be used with -u or -s.
-h --help Show the help message of the cli

Examples

ghs -u <username>

Prints the general Github stats for the given username.

copy to clipboard

Provide the -c flag to copy the output to your clipboard.

Other options for summary

In addition to getting the Github summary from the beginning, you can also get the summary of the last 12 months or you can provide your own custom duration.

Installation hiccups on windows

Could not install package due to Environment Error

It can be solved by scoping the installation. Add the flag --user to the pip command (pip install --user ghs).

Alternatively, you can install the tool inside a virtual environment

ghs command not found even after installing

Most likely the place where the command is installed is not in the system PATH. On windows, there are a few places where the packages might be installed. After confirming the location, add that directory to the PATH.

How to contribute?

Please see Contributing guidelines for more information.

Changelog

You can checkout Releases for the changelog.

Privacy Notice

ghs does not collect any data.

  • It has no home server. The Github PAT is stored locally in your machine.
  • It doesn't embed any kind of analytic hooks in its code.

The only time ghs connects to a remote server is when you want to generate the stats and summary of your github profile. The cli uses the Github GraphQL and Github Rest APIs to do so. The data collected via the APIs is not sent anywhere. It's displayed in your terminal or copied to your clipboard (only if you explicitly tell the tool to do so by providing the -c or --copy-to-clipboard flag).

License

MIT © HackerRank

Comments
  • bug: change in scope in github pat

    bug: change in scope in github pat

    Screenshot from 2022-04-06 16-37-58 The program asks for read:user , repo and read:packages scope for github pat. But GitHub has changed the structure of scopes. There is no read:user and read:packages scope. Github scopes (new) : https://docs.github.com/en/developers/apps/building-oauth-apps/scopes-for-oauth-app

    invalid 
    opened by jaiakash 3
  • Error: Query failed with status code: 401

    Error: Query failed with status code: 401

    I'm using this in Ubuntu 20.04 I've installed ghs using pip install ghs command and it's showing this error. I also tried using the source code and still shows the same error. I used this last month and it worked fine, maybe it's because of the Github Personal Access Token expired or something else. Is there a way to forget the user so it asks for new Access Token (It didn't ask for it this time)

    Screenshot from 2022-05-02 20-59-30

    opened by abhijhacodes 2
  • There is no options to fill the Required scopes

    There is no options to fill the Required scopes

    Hi

    ghs -t 
    
    
    Creating config file
    please enter your github pat: [ghp_xxxxxxxxxxxxxxxxxxxx]
    Error: The token does not have valid scopes.
     Required scopes: ['read:user', 'repo', 'read:packages'].
     Provided token scopes: ['repo']
    
    

    I have granted the permission to the repo, however, on the GitHub setting page, there is not an option to make a read, how can I set this?

    A suggestion is that, may you delete the judgment of read:* or make this optional

    opened by jianwang-ntu 2
  • `ghs` not working

    `ghs` not working

    Running ghs -u ratika-12 throws:

    Error: Query failed with status code: 401
    Traceback: 
      File "/Users/ratikaswami/ghs/venv/lib/python3.8/site-packages/ghs/ghs.py", line 293, in main_proxy
        main()
      File "/Users/ratikaswami/ghs/venv/lib/python3.8/site-packages/ghs/ghs.py", line 267, in main
        verify_github_username(args.username)
      File "/Users/ratikaswami/ghs/venv/lib/python3.8/site-packages/ghs/ghs.py", line 33, in verify_github_username
        if fetch_user_id(username) is None:
      File "/Users/ratikaswami/ghs/venv/lib/python3.8/site-packages/ghs/fetchers.py", line 129, in fetch_user_id
        raise Exception(f"Query failed with status code: {request.status_code}")
    
    opened by ratika-12 2
  • Bug: Unable to update token

    Bug: Unable to update token

    Hi, earlier I used the cli to generate the summary. Today I updated my token and tried to refresh/insert the new token but seems like the cli isn't accepting it. As a result the summary isn't generated backstage_bug

    Also is the token stored as a variable ? I don't see any .env file here even to manually update my token :thinking:

    bug 
    opened by ron-debajyoti 2
  • add: download badges in readme

    add: download badges in readme

    I have added download per month badge. But there is no "total download" badge available. See https://github.com/badges/shields/issues/4319

    Issue #2

    opened by jaiakash 2
  • Error: __enter__- Checking if the token is valid

    Error: __enter__- Checking if the token is valid

    Hey , whenever I try to enter my PAT key I always run into this error , I have ticked all required scopes while generating key and also added C:\Users\mahim\Appdata\Local\Programs\Python\Python39\lib\site-packages to the PATH image

    opened by mahimdashora 1
  • Create Desktop Assistant

    Create Desktop Assistant

    This is a code for a desktop assistant which will perform tasks like writing emails for you and extracting data from the net and opening and closing various apps in your pc.

    invalid 
    opened by manvendra542001 1
  • Documentation error for Windows

    Documentation error for Windows

    The admin, Your documentation for Windows Users for activating the virtual environment contains an error that doesn't allow the user to run this

    Step 3 . Activate the virtual environment

    For windows, run .\venv\Scripts\activate // error

    It should be source venv/Scripts/activate for Windows user Allow me to change it in your documentation so that next time no one faces the issue that I faced today.

    opened by iamakhileshmishra 0
  • Add CodeQL workflow for GitHub code scanning

    Add CodeQL workflow for GitHub code scanning

    Hi interviewstreet/ghs!

    This is a one-off automatically generated pull request from LGTM.com :robot:. You might have heard that we’ve integrated LGTM’s underlying CodeQL analysis engine natively into GitHub. The result is GitHub code scanning!

    With LGTM fully integrated into code scanning, we are focused on improving CodeQL within the native GitHub code scanning experience. In order to take advantage of current and future improvements to our analysis capabilities, we suggest you enable code scanning on your repository. Please take a look at our blog post for more information.

    This pull request enables code scanning by adding an auto-generated codeql.yml workflow file for GitHub Actions to your repository — take a look! We tested it before opening this pull request, so all should be working :heavy_check_mark:. In fact, you might already have seen some alerts appear on this pull request!

    Where needed and if possible, we’ve adjusted the configuration to the needs of your particular repository. But of course, you should feel free to tweak it further! Check this page for detailed documentation.

    Questions? Check out the FAQ below!

    FAQ

    Click here to expand the FAQ section

    How often will the code scanning analysis run?

    By default, code scanning will trigger a scan with the CodeQL engine on the following events:

    • On every pull request — to flag up potential security problems for you to investigate before merging a PR.
    • On every push to your default branch and other protected branches — this keeps the analysis results on your repository’s Security tab up to date.
    • Once a week at a fixed time — to make sure you benefit from the latest updated security analysis even when no code was committed or PRs were opened.

    What will this cost?

    Nothing! The CodeQL engine will run inside GitHub Actions, making use of your unlimited free compute minutes for public repositories.

    What types of problems does CodeQL find?

    The CodeQL engine that powers GitHub code scanning is the exact same engine that powers LGTM.com. The exact set of rules has been tweaked slightly, but you should see almost exactly the same types of alerts as you were used to on LGTM.com: we’ve enabled the security-and-quality query suite for you.

    How do I upgrade my CodeQL engine?

    No need! New versions of the CodeQL analysis are constantly deployed on GitHub.com; your repository will automatically benefit from the most recently released version.

    The analysis doesn’t seem to be working

    If you get an error in GitHub Actions that indicates that CodeQL wasn’t able to analyze your code, please follow the instructions here to debug the analysis.

    How do I disable LGTM.com?

    If you have LGTM’s automatic pull request analysis enabled, then you can follow these steps to disable the LGTM pull request analysis. You don’t actually need to remove your repository from LGTM.com; it will automatically be removed in the next few months as part of the deprecation of LGTM.com (more info here).

    Which source code hosting platforms does code scanning support?

    GitHub code scanning is deeply integrated within GitHub itself. If you’d like to scan source code that is hosted elsewhere, we suggest that you create a mirror of that code on GitHub.

    How do I know this PR is legitimate?

    This PR is filed by the official LGTM.com GitHub App, in line with the deprecation timeline that was announced on the official GitHub Blog. The proposed GitHub Action workflow uses the official open source GitHub CodeQL Action. If you have any other questions or concerns, please join the discussion here in the official GitHub community!

    I have another question / how do I get in touch?

    Please join the discussion here to ask further questions and send us suggestions!

    opened by lgtm-com[bot] 0
  • Feature Request: Associate roles with each duration for better context of summary

    Feature Request: Associate roles with each duration for better context of summary

    For the --summary tag, we provide 3 options. The 3rd option is to provide custom durations for which the summary needs to be generated. We can compliment this feature by also taking the roles associated with each duration as input.

    This would provide better context to the summary. For eg: it's expected that when you move to a leadership role in engineering, you tend to do more code reviews.

    enhancement 
    opened by makkoncept 0
Releases(v0.1.4)
Owner
HackerRank
Match Every Developer to the Right Job.
HackerRank
Aesara is a Python library that allows one to define, optimize, and efficiently evaluate mathematical expressions involving multi-dimensional arrays.

Aesara is a Python library that allows one to define, optimize, and efficiently evaluate mathematical expressions involving multi-dimensional arrays.

Aesara 898 Jan 07, 2023
Listing arxiv - Personalized list of today's articles from ArXiv

Personalized list of today's articles from ArXiv Print and/or send to your gmail

Lilianne Nakazono 5 Jun 17, 2022
CR-FIQA: Face Image Quality Assessment by Learning Sample Relative Classifiability

This is the official repository of the paper: CR-FIQA: Face Image Quality Assessment by Learning Sample Relative Classifiability A private copy of the

Fadi Boutros 33 Dec 31, 2022
PyTorch implementation of Lip to Speech Synthesis with Visual Context Attentional GAN (NeurIPS2021)

Lip to Speech Synthesis with Visual Context Attentional GAN This repository contains the PyTorch implementation of the following paper: Lip to Speech

6 Nov 02, 2022
Trash Sorter Extraordinaire is a software which efficiently detects the different types of waste in a pile of random trash through feeding it pictures or videos.

Trash-Sorter-Extraordinaire Trash Sorter Extraordinaire is a software which efficiently detects the different types of waste in a pile of random trash

Rameen Mahmood 1 Nov 07, 2021
Implementation of the paper: "SinGAN: Learning a Generative Model from a Single Natural Image"

SinGAN This is an unofficial implementation of SinGAN from someone who's been sitting right next to SinGAN's creator for almost five years. Please ref

35 Nov 10, 2022
Fully Convlutional Neural Networks for state-of-the-art time series classification

Deep Learning for Time Series Classification As the simplest type of time series data, univariate time series provides a reasonably good starting poin

Stephen 572 Dec 23, 2022
A PyTorch implementation of EventProp [https://arxiv.org/abs/2009.08378], a method to train Spiking Neural Networks

Spiking Neural Network training with EventProp This is an unofficial PyTorch implemenation of EventProp, a method to compute exact gradients for Spiki

Pedro Savarese 35 Jul 29, 2022
Reinforcement learning algorithms in RLlib

raylab Reinforcement learning algorithms in RLlib and PyTorch. Installation pip install raylab Quickstart Raylab provides agents and environments to b

Ângelo 50 Sep 08, 2022
Turi Create simplifies the development of custom machine learning models.

Quick Links: Installation | Documentation | WWDC 2019 | WWDC 2018 Turi Create Check out our talks at WWDC 2019 and at WWDC 2018! Turi Create simplifie

Apple 10.9k Jan 01, 2023
DaReCzech is a dataset for text relevance ranking in Czech

Dataset DaReCzech is a dataset for text relevance ranking in Czech. The dataset consists of more than 1.6M annotated query-documents pairs,

Seznam.cz a.s. 8 Jul 26, 2022
This is the official implementation of the paper "Object Propagation via Inter-Frame Attentions for Temporally Stable Video Instance Segmentation".

ObjProp Introduction This is the official implementation of the paper "Object Propagation via Inter-Frame Attentions for Temporally Stable Video Insta

Anirudh S Chakravarthy 6 May 03, 2022
Finetuning Pipeline

KLUE Baseline Korean(한국어) KLUE-baseline contains the baseline code for the Korean Language Understanding Evaluation (KLUE) benchmark. See our paper fo

74 Dec 13, 2022
Swapping face using Face Mesh with TensorFlow Lite

Swapping face using Face Mesh with TensorFlow Lite

iwatake 17 Apr 26, 2022
RARA: Zero-shot Sim2Real Visual Navigation with Following Foreground Cues

RARA: Zero-shot Sim2Real Visual Navigation with Following Foreground Cues FGBG (foreground-background) pytorch package for defining and training model

Klaas Kelchtermans 1 Jun 02, 2022
Code for the paper Open Sesame: Getting Inside BERT's Linguistic Knowledge.

Open Sesame This repository contains the code for the paper Open Sesame: Getting Inside BERT's Linguistic Knowledge. Credits We built the project on t

9 Jul 24, 2022
The source codes for TME-BNA: Temporal Motif-Preserving Network Embedding with Bicomponent Neighbor Aggregation.

TME The source codes for TME-BNA: Temporal Motif-Preserving Network Embedding with Bicomponent Neighbor Aggregation. Our implementation is based on TG

2 Feb 10, 2022
This is the official code for the paper "Ad2Attack: Adaptive Adversarial Attack for Real-Time UAV Tracking".

Ad^2Attack:Adaptive Adversarial Attack on Real-Time UAV Tracking Demo video 📹 Our video on bilibili demonstrates the test results of Ad^2Attack on se

Intelligent Vision for Robotics in Complex Environment 10 Nov 07, 2022
Megaverse is a new 3D simulation platform for reinforcement learning and embodied AI research

Megaverse Megaverse is a new 3D simulation platform for reinforcement learning and embodied AI research. The efficient design of the engine enables ph

Aleksei Petrenko 191 Dec 23, 2022