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
X-VLM: Multi-Grained Vision Language Pre-Training

X-VLM: learning multi-grained vision language alignments Multi-Grained Vision Language Pre-Training: Aligning Texts with Visual Concepts. Yan Zeng, Xi

Yan Zeng 286 Dec 23, 2022
image scene graph generation benchmark

Scene Graph Benchmark in PyTorch 1.7 This project is based on maskrcnn-benchmark Highlights Upgrad to pytorch 1.7 Multi-GPU training and inference Bat

Microsoft 303 Dec 27, 2022
This repository contains the official code of the paper Equivariant Subgraph Aggregation Networks (ICLR 2022)

Equivariant Subgraph Aggregation Networks (ESAN) This repository contains the official code of the paper Equivariant Subgraph Aggregation Networks (IC

Beatrice Bevilacqua 59 Dec 13, 2022
DANet for Tabular data classification/ regression.

Deep Abstract Networks A PyTorch code implemented for the submission DANets: Deep Abstract Networks for Tabular Data Classification and Regression. Do

Ronnie Rocket 55 Sep 14, 2022
Karate Club: An API Oriented Open-source Python Framework for Unsupervised Learning on Graphs (CIKM 2020)

Karate Club is an unsupervised machine learning extension library for NetworkX. Please look at the Documentation, relevant Paper, Promo Video, and Ext

Benedek Rozemberczki 1.8k Jan 07, 2023
Alleviating Over-segmentation Errors by Detecting Action Boundaries

Alleviating Over-segmentation Errors by Detecting Action Boundaries Forked from ASRF offical code. This repo is the a implementation of replacing orig

13 Dec 12, 2022
Denoising images with Fourier Ring Correlation loss

Denoising images with Fourier Ring Correlation loss The python code accompanies the working manuscript Image quality measurements and denoising using

2 Mar 12, 2022
Code for the paper "Ordered Neurons: Integrating Tree Structures into Recurrent Neural Networks"

ON-LSTM This repository contains the code used for word-level language model and unsupervised parsing experiments in Ordered Neurons: Integrating Tree

Yikang Shen 572 Nov 21, 2022
Data Engineering ZoomCamp

Data Engineering ZoomCamp I'm partaking in a Data Engineering Bootcamp / Zoomcamp and will be tracking my progress here. I can't promise these notes w

Aaron 61 Jan 06, 2023
JstDoS - HTTP Protocol Stack Remote Code Execution Vulnerability

jstDoS If you are going to skid that, please give credits ! ^^ ¿How works? This

apolo 4 Feb 11, 2022
Unifying Architectures, Tasks, and Modalities Through a Simple Sequence-to-Sequence Learning Framework

Official repository of OFA. Paper: Unifying Architectures, Tasks, and Modalities Through a Simple Sequence-to-Sequence Learning Framework

OFA Sys 1.4k Jan 08, 2023
Self-Supervised Document-to-Document Similarity Ranking via Contextualized Language Models and Hierarchical Inference

Self-Supervised Document Similarity Ranking (SDR) via Contextualized Language Models and Hierarchical Inference This repo is the implementation for SD

Microsoft 36 Nov 28, 2022
Fake News Detection Using Machine Learning Methods

Fake-News-Detection-Using-Machine-Learning-Methods Fake news is always a real and dangerous issue. However, with the presence and abundance of various

Achraf Safsafi 1 Jan 11, 2022
codes for Image Inpainting with External-internal Learning and Monochromic Bottleneck

Image Inpainting with External-internal Learning and Monochromic Bottleneck This repository is for the CVPR 2021 paper: 'Image Inpainting with Externa

97 Nov 29, 2022
PGPortfolio: Policy Gradient Portfolio, the source code of "A Deep Reinforcement Learning Framework for the Financial Portfolio Management Problem"(https://arxiv.org/pdf/1706.10059.pdf).

This is the original implementation of our paper, A Deep Reinforcement Learning Framework for the Financial Portfolio Management Problem (arXiv:1706.1

Zhengyao Jiang 1.5k Dec 29, 2022
Reduce end to end training time from days to hours (or hours to minutes), and energy requirements/costs by an order of magnitude using coresets and data selection.

COResets and Data Subset selection Reduce end to end training time from days to hours (or hours to minutes), and energy requirements/costs by an order

decile-team 244 Jan 09, 2023
Official repository of ICCV21 paper "Viewpoint Invariant Dense Matching for Visual Geolocalization"

Viewpoint Invariant Dense Matching for Visual Geolocalization: PyTorch implementation This is the implementation of the ICCV21 paper: G Berton, C. Mas

Gabriele Berton 44 Jan 03, 2023
An implementation of chunked, compressed, N-dimensional arrays for Python.

Zarr Latest Release Package Status License Build Status Coverage Downloads Gitter Citation What is it? Zarr is a Python package providing an implement

Zarr Developers 1.1k Dec 30, 2022
Selecting Parallel In-domain Sentences for Neural Machine Translation Using Monolingual Texts

DataSelection-NMT Selecting Parallel In-domain Sentences for Neural Machine Translation Using Monolingual Texts Quick update: The paper got accepted o

Javad Pourmostafa 6 Jan 07, 2023
Estimating Example Difficulty using Variance of Gradients

Estimating Example Difficulty using Variance of Gradients This repository contains source code necessary to reproduce some of the main results in the

Chirag Agarwal 48 Dec 26, 2022