Giter Club home page Giter Club logo

thumbsup's Introduction

thumbsup

Summarize GitHub issues

Running the server

Directly

Install requirements:

pip install -r requirements.txt

To run the development server:

FLASK_ENV=development FLASK_APP=thumbsup.server flask run

To run production server:

gunicorn --bind 0.0.0.0:5000 thumbsup.server:app

Docker

To build the image:

docker build -t simiotics/thumbsup .

To run a container:

docker run -p 5000:5000 simiotics/thumbsup

Accessing in browser

Once you have a server set up, Thumbsup should be available at localhost:5000

GitHub rate limit

Thumbsup uses the GitHub API to retrieve issue comments. If you do not provide a GitHub access token, Thumbsup is subject to the unauthenticated GitHub API rate limit of 60 calls per hour.

You can provide a GitHub access token by setting it as the value for the THUMBSUP_GITHUB_TOKEN environment variable. This will bring your available rate limit to 5000 requests per hour (higher if you have a better GitHub plan).

You can also set a minimum rate limit threshold below which Thumbsup will fail all requests. To do this, set the THUMBSUP_RATE_LIMIT_BOUND to an integer value.

To pass these environment variables to Thumbsup through docker, assuming they are set in your shell:

docker run -p 5000:5000 \
    -e THUMBSUP_GITHUB_TOKEN="$THUMBSUP_GITHUB_TOKEN" \
    -e THUMBSUP_RATE_LIMIT_BOUND="$THUMBSUP_RATE_LIMIT_BOUND" \
    simiotics/thumbsup

See sample.env for an example of how to set these environment variables. To use it locally:

  1. Run $ cp sample.env my.env

  2. Update the values in my.env.

  3. Source the file: $ . my.env.

Stack Exchange API authentication

To generate an access token for the Stack Exchange API, follow their authentication guide.

This stackapps post was very helpful.

thumbsup's People

Contributors

zomglings avatar

Stargazers

Tae-woong Kim avatar  avatar  avatar

Watchers

James Cloos avatar  avatar  avatar  avatar

thumbsup's Issues

Ranking magic v1

Ranking of GitHub issues should be based on more features. For example:

  1. #emojis
  2. #(positive emojis)
  3. Length of post (in #lines)
  4. Length of post (in #chars)
  5. #(mentions of author in the comment thread)

We are currently only using the first two and in a hard-coded manner.

v1 should include more features (the ones listed above and possibly even more). Hard-coded combination of these features is okay.

v2 (out of scope of this issue) should involve learning how to combine the features.

Stack Overflow summaries

Add capability to summarize Stack Overflow posts by ranking by:

  1. Selected answer
  2. Number of votes
  3. Number of comments

Switch over from using a personal access token for GitHub to using a GitHub app

The danger is that, if you are not careful setting up a personal access token, the Thumbsup deployment may leak private information related to your GitHub account - for example, issues on private repos that you have access to.

In the case of our production deployment, we are safe because the personal access token was generated with no private permissions. But this is still not the way to really authenticate requests for increased rate limit.

Instead, GitHub has a notion of GitHub apps which do perfectly for increased rate limit with no potential escalation of permissions.

Documentation:
Authenticating as a GitHub App

Based on that documentation, it looks like we will have to generate a JWT to authenticate with. Will verify this manually, but in case we need to do so this seems like the most popular JWT library in Python: https://github.com/jpadilla/pyjwt/

Set up database migrations

Currently we are using just raw psycopg2 calls to set up and write to the database. We should have some sort of migration scheme. We can use a library like Alembic

Implement OAuth flows to bypass rate limit restrictions

This is not an issue now, but will be an issue if there are a lot of users for a single deployment of Thumbsup.

In this case, we can get over rate limit restrictions by acting against APIs on behalf of users - this would mean Thumbsup summaries use user rate limits and not server rate limits.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.