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
Code for Quantifying Ignorance in Individual-Level Causal-Effect Estimates under Hidden Confounding

🍐 quince Code for Quantifying Ignorance in Individual-Level Causal-Effect Estimates under Hidden Confounding 🍐 Installation $ git clone

Andrew Jesson 19 Jun 23, 2022
Codebase for Diffusion Models Beat GANS on Image Synthesis.

Codebase for Diffusion Models Beat GANS on Image Synthesis.

Katherine Crowson 128 Dec 02, 2022
Code to reproduce the results for Compositional Attention

Compositional-Attention This repository contains the official implementation for the paper Compositional Attention: Disentangling Search and Retrieval

Sarthak Mittal 58 Nov 30, 2022
Code for DisCo: Remedy Self-supervised Learning on Lightweight Models with Distilled Contrastive Learning

DisCo: Remedy Self-supervised Learning on Lightweight Models with Distilled Contrastive Learning Pytorch Implementation for DisCo: Remedy Self-supervi

79 Jan 06, 2023
Complete-IoU (CIoU) Loss and Cluster-NMS for Object Detection and Instance Segmentation (YOLACT)

Complete-IoU Loss and Cluster-NMS for Improving Object Detection and Instance Segmentation. Our paper is accepted by IEEE Transactions on Cybernetics

290 Dec 25, 2022
PoolFormer: MetaFormer is Actually What You Need for Vision

PoolFormer: MetaFormer is Actually What You Need for Vision (arXiv) This is a PyTorch implementation of PoolFormer proposed by our paper "MetaFormer i

Sea AI Lab 1k Dec 30, 2022
Deep Learning: Architectures & Methods Project: Deep Learning for Audio Super-Resolution

Deep Learning: Architectures & Methods Project: Deep Learning for Audio Super-Resolution Figure: Example visualization of the method and baseline as a

Oliver Hahn 16 Dec 23, 2022
FACIAL: Synthesizing Dynamic Talking Face With Implicit Attribute Learning. ICCV, 2021.

FACIAL: Synthesizing Dynamic Talking Face with Implicit Attribute Learning PyTorch implementation for the paper: FACIAL: Synthesizing Dynamic Talking

226 Jan 08, 2023
Code for the ICCV 2021 paper "Pixel Difference Networks for Efficient Edge Detection" (Oral).

Microsoft365_devicePhish Abusing Microsoft 365 OAuth Authorization Flow for Phishing Attack This is a simple proof-of-concept script that allows an at

Alex 236 Dec 21, 2022
Framework for training options with different attention mechanism and using them to solve downstream tasks.

Using Attention in HRL Framework for training options with different attention mechanism and using them to solve downstream tasks. Requirements GPU re

5 Nov 03, 2022
Script utilizando OpenCV e modelo Machine Learning para detectar o uso de máscaras.

Reconhecendo máscaras Este repositório contém um script em Python3 que reconhece se um rosto está ou não portando uma máscara! O código utiliza da bib

Maria Eduarda de Azevedo Silva 168 Oct 20, 2022
A curated list of awesome open source libraries to deploy, monitor, version and scale your machine learning

Awesome production machine learning This repository contains a curated list of awesome open source libraries that will help you deploy, monitor, versi

The Institute for Ethical Machine Learning 12.9k Jan 04, 2023
Release of SPLASH: Dataset for semantic parse correction with natural language feedback in the context of text-to-SQL parsing

SPLASH: Semantic Parsing with Language Assistance from Humans SPLASH is dataset for the task of semantic parse correction with natural language feedba

Microsoft Research - Language and Information Technologies (MSR LIT) 35 Oct 31, 2022
Boostcamp CV Serving For Python

Boostcamp-CV-Serving Prerequisites MySQL GCP Cloud Storage GCP key file Sentry Streamlit Cloud Secrets: .streamlit/secrets.toml #DO NOT SHARE THIS I

Jungwon Seo 19 Feb 22, 2022
Degree-Quant: Quantization-Aware Training for Graph Neural Networks.

Degree-Quant This repo provides a clean re-implementation of the code associated with the paper Degree-Quant: Quantization-Aware Training for Graph Ne

35 Oct 07, 2022
Transformers4Rec is a flexible and efficient library for sequential and session-based recommendation, available for both PyTorch and Tensorflow.

Transformers4Rec is a flexible and efficient library for sequential and session-based recommendation, available for both PyTorch and Tensorflow.

730 Jan 09, 2023
A set of tools for Namebase and HNS

HNS-TOOLS A set of tools for Namebase and HNS To install: pip install -r requirements.txt To run: py main.py My Namebase referral code: http://namebas

RunDavidMC 7 Apr 08, 2022
OptaPlanner wrappers for Python. Currently significantly slower than OptaPlanner in Java or Kotlin.

OptaPy is an AI constraint solver for Python to optimize the Vehicle Routing Problem, Employee Rostering, Maintenance Scheduling, Task Assignment, School Timetabling, Cloud Optimization, Conference S

OptaPy 211 Jan 02, 2023
Implementation / replication of DALL-E, OpenAI's Text to Image Transformer, in Pytorch

DALL-E in Pytorch Implementation / replication of DALL-E, OpenAI's Text to Image Transformer, in Pytorch. It will also contain CLIP for ranking the ge

Phil Wang 5k Jan 04, 2023
Joint Discriminative and Generative Learning for Person Re-identification. CVPR'19 (Oral)

Joint Discriminative and Generative Learning for Person Re-identification [Project] [Paper] [YouTube] [Bilibili] [Poster] [Supp] Joint Discriminative

NVIDIA Research Projects 1.2k Dec 30, 2022