Pygitstats - a package that allows you to use the GitHub GraphQL API with ease in your Python programs

Related tags

GraphQL GitStats
Overview

GitStats

PyPI PyPI - Downloads PyPI - Format PyPI - Status PyPI - License

pygitstats is a package that allows you to use the GitHub GraphQL API with ease in your Python programs.

Installation

Anyone can use this package by installing it from PyPi via one of the following commands:

Pip

pip install pygitstats
pip3 install pygitstats
python -m pip install pygitstats
python3 -m pip install pygitstats

Poetry

poetry install pygitstats

Conda

conda install pygitstats

Pipenv

pipenv install pygitstats

Usage

Just import the modules you need and get started!

License

This project is licensed under the LGPLv3 license.

You might also like...
GraphQL framework for Python

Graphene 💬 Join the community on Slack We are looking for contributors! Please check the ROADMAP to see how you can help ❤️ The below readme is the d

Ariadne is a Python library for implementing GraphQL servers using schema-first approach.
Ariadne is a Python library for implementing GraphQL servers using schema-first approach.

Ariadne Ariadne is a Python library for implementing GraphQL servers. Schema-first: Ariadne enables Python developers to use schema-first approach to

GraphQL Engine built with Python 3.6+ / asyncio
GraphQL Engine built with Python 3.6+ / asyncio

Tartiflette is a GraphQL Server implementation built with Python 3.6+. Summary Motivation Status Usage Installation Installation dependencies Tartifle

A new GraphQL library for Python 🍓
A new GraphQL library for Python 🍓

Strawberry GraphQL Python GraphQL library based on dataclasses Installation ( Quick Start ) The quick start method provides a server and CLI to get go

This is a simple Python that will parse instanceStats GraphQL Query into a CSV
This is a simple Python that will parse instanceStats GraphQL Query into a CSV

GraphQL Python Labs - by Gabs the CSE Table of Contents About The Project Getting Started Prerequisites Installation and Usage Roadmap Contributing Li

Graphql-codegen library - a pure python implementation

turms DEVELOPMENT Inspiration Turms is a pure python implementation of the awesome graphql-codegen library, following a simliar extensible design. It

tartiflette-aiohttp is a wrapper of aiohttp which includes the Tartiflette GraphQL Engine, do not hesitate to take a look of the Tartiflette project.
tartiflette-aiohttp is a wrapper of aiohttp which includes the Tartiflette GraphQL Engine, do not hesitate to take a look of the Tartiflette project.

tartiflette-aiohttp is a wrapper of aiohttp which includes the Tartiflette GraphQL Engine. You can take a look at the Tartiflette API documentation. U

ASGI support for the Tartiflette GraphQL engine
ASGI support for the Tartiflette GraphQL engine

tartiflette-asgi is a wrapper that provides ASGI support for the Tartiflette Python GraphQL engine. It is ideal for serving a GraphQL API over HTTP, o

GraphQL is a query language and execution engine tied to any backend service.

GraphQL The GraphQL specification is edited in the markdown files found in /spec the latest release of which is published at https://graphql.github.io

Comments
  • Add GraphQL mutation functions

    Add GraphQL mutation functions

    • [x] Possibly rename module back over to pygitapi? This would be better sooner rather than later.
    • [x] Add GraphQL mutations for functions like commenting on issues, reacting etc.

    This issue will also be used for testing mutations

    WARNING: You probably don't want to follow this thread!

    If anyone would like to reach me in this thread, please make sure to @DillonB07. Don't just leave a comment!

    opened by DillonB07 115
  • Sourcery Starbot ⭐ refactored DillonB07/GitAPI

    Sourcery Starbot ⭐ refactored DillonB07/GitAPI

    Thanks for starring sourcery-ai/sourcery ✨ 🌟 ✨

    Here's your pull request refactoring your most popular Python repo.

    If you want Sourcery to refactor all your Python repos and incoming pull requests install our bot.

    Review changes via command line

    To manually merge these changes, make sure you're on the master branch, then run:

    git fetch https://github.com/sourcery-ai-bot/GitAPI master
    git merge --ff-only FETCH_HEAD
    git reset HEAD^
    
    opened by sourcery-ai-bot 1
  • Error in `v1.0.0rc5` - field `body` doesn't exist

    Error in `v1.0.0rc5` - field `body` doesn't exist

    {'errors': [{'extensions': {'code': 'undefinedField', 'fieldName': 'body', 'typeName': 'IssueCommentEdge'}, 'locations': [{'column': 13, 'line': 5}], 'message': "Field 'body' doesn't exist on type 'IssueCommentEdge'", 'path': ['mutation', 'addComment', 'commentEdge', 'body']}]}
    
    bug High Priority 
    opened by DillonB07 0
  • Documentation

    Documentation

    Documentation will be needed. Ideally with Sphinx though MkDocs is also fine.

    I'm not good at Sphinx...

    All contributions for documentation are welcome! Credit will be added to README according to the All Contributors specification

    High Priority 
    opened by DillonB07 3
Releases(v1.0.0)
  • v1.0.0(Feb 21, 2022)

    v1.0.0!

    This is the first official release of pyGitAPI. For information about it, read the docs at https://docs.pygitapi.cf.

    You can also read this post on dev.to for a basic introduction to this package.

    https://dev.to/dillonb07/access-github-graphql-queries-easily-in-python-34j6

    pip install --upgrade pygitapi

    Links: GitHub - https://github.com/DillonB07/GitAPI PyPi - https://pypi.org/project/pygitapi Docs - https://docs.pygitapi.cf/

    Full Changelog: https://github.com/DillonB07/GitAPI/compare/v0.1.1...v1.0.0

    Source code(tar.gz)
    Source code(zip)
  • v1.0.0rc6(Jan 20, 2022)

    This pre-release just closes #15

    comment_on_issue() should now work perfectly.

    Full Changelog: https://github.com/DillonB07/GitAPI/compare/v1.0.0rc5...v1.0.0rc6

    Source code(tar.gz)
    Source code(zip)
  • v1.0.0rc5(Jan 20, 2022)

    This pre-release adds in two new functions!

    • GitAPI.comment_on_issue(owner: str, repo: str, number: int, comment: str)
    • GitAPI.get_issue_id(owner: str, repo: str, number: int))

    The comment_on_issue() function will return a response with the comment body. This function utilises the get_issue_id() function to find the issue, so you don't need to input the issue ID yourself.

    What's Changed

    • docs: add kokonut27 as a contributor for code, question, code by @allcontributors in https://github.com/DillonB07/GitAPI/pull/11
    • docs: add DillonB07 as a contributor for code, infra, maintenance, test by @allcontributors in https://github.com/DillonB07/GitAPI/pull/12

    Full Changelog: https://github.com/DillonB07/GitAPI/compare/v1.0.0rc4...v1.0.0rc5

    Source code(tar.gz)
    Source code(zip)
  • v1.0.0rc4b(Jan 18, 2022)

    In this pre-release, I've renamed the module to pygitapi. This is because it isn't just for stats, so it's clearer.

    NOTE: The old versions are still available under pygitstats

    Install like so:

    pip install --upgrade --pre pygitapi
    

    And the main class has been renamed so use it like so:

    from pygitapi.graphql import GitAPI
    
    g = GitAPI(token)
    ...
    

    Full Changelog: https://github.com/DillonB07/GitAPI/compare/v1.0.0rc3...v1.0.0rc4b

    Source code(tar.gz)
    Source code(zip)
  • v1.0.0rc3(Jan 15, 2022)

    In this release candidate, a new function has been added.

    Here's a demo!

    from pygitstats.graphql import GitStats
    import os
    
    token = os.environ['PERSONAL_ACCESS_TOKEN']
    g = GitStats(token)
    
    response = g.repo_info(name='GitStats', owner='DillonB07')
    
    print(response['data']['repository']['collaborators'])
    

    Returns:

    {'nodes': [{'avatarUrl': 'https://avatars.githubusercontent.com/u/83948303?v=4', 'login': 'DillonB07', 'name': 'Dillon Barnes', 'url': 'https://github.com/DillonB07'}], 'totalCount': 1}
    

    You can install/upgrade to v1.0.0rc3 like so:

    pip install --upgrade --pre pygitstats
    

    Full Changelog: https://github.com/DillonB07/GitStats/compare/v0.1.0rc2...v1.0.0rc3

    Source code(tar.gz)
    Source code(zip)
  • v1.0.0rc2(Jan 10, 2022)

    In this release candidate, the module has been changed back to the requests module. Also, #3 is finally closed for good, hopefully.

    You can install/upgrade this module like so:

    pip install --upgrade --pre pygitstats
    

    Full Changelog: https://github.com/DillonB07/GitStats/compare/v1.0.0rc1...v1.0.0rc2

    Source code(tar.gz)
    Source code(zip)
  • v1.0.0rc1(Jan 10, 2022)

    This is v1.0.0 Release Candidate 1.

    ~The major change in this release is that the project has moved to a new library meaning that GraphQL responses are now Python dictionaries. - Closes #3~ This has been proved wrong via some testing - Reopened #3

    This should not affect usage as all of the functions in the module do the same thing and have the same name.

    As this is a pre-release, you will need to add the --pre flag when installing from pip like so:

    pip install --upgrade --pre pygitstats
    

    Full Changelog: https://github.com/DillonB07/GitStats/compare/v0.1.1...v1.0.0rc1

    Source code(tar.gz)
    Source code(zip)
  • v0.1.1(Jan 5, 2022)

    This fixes a bug where the response was printed instead of returned! 🤦

    Full Changelog: https://github.com/DillonB07/GitStats/compare/v0.1.0...v0.1.1

    Source code(tar.gz)
    Source code(zip)
  • v0.1.0(Jan 5, 2022)

    GitStats

    This is the first release of GitStats.

    Usage

    In this release, you can grab generic data about a user using GitStats.user_info() Here is an example:

    from pygitstats.graphql import GitStats
    import os
    
    g = GitStats(os.environ['GITHUB_PERSONAL_ACCESS_TOKEN']) # Don't store your Personal Access Token in plain text!
    
    user_info = g.user_info('DillonB07') # User to get info on
    print(user_info)
    

    You can also use custom GraphQL queries like so:

    from pygitstats.graphql import GitStats
    import os
    
    username = 'DillonB07'
    query = '''
    query repo_count {
      user(login: "''' + username + '''") {
        repositories {
          totalCount
        }
      }
    }
    '''
    
    g = GitStats(os.environ['GITHUB_PERSONAL_ACCESS_TOKEN']) # Don't store your Personal Access Token in plain text!
    
    total_repos = g.custom_query(query) # Custom query will return the amount of repositories the user has
    print(total_repos)
    

    Remember: DO NOT STORE YOUR PERSONAL ACCESS TOKEN IN YOUR PROGRAM! 0adfd2d

    Installation

    This package can be installed from PyPi via one of the following commands:

    Pip

    pip install pygitstats
    
    pip3 install pygitstats
    
    python -m pip install pygitstats
    
    python3 -m pip install pygitstats
    

    Poetry

    poetry install pygitstats
    

    Conda

    conda install pygitstats
    

    Pipenv

    pipenv install pygitstats
    

    Credit

    Feedback and suggestions for the package would be appreciated!

    Credit to @JBYT27 for GitAPI which inspired this project. I've also taken(and modified) some code from that repo.

    Source code(tar.gz)
    Source code(zip)
Owner
Dillon Barnes
An aspiring web developer who likes making weird and useless projects
Dillon Barnes
A Python 3.6+ port of the GraphQL.js reference implementation of GraphQL.

GraphQL-core 3 GraphQL-core 3 is a Python 3.6+ port of GraphQL.js, the JavaScript reference implementation for GraphQL, a query language for APIs crea

GraphQL Python 458 Dec 13, 2022
MGE-GraphQL is a Python library for building GraphQL mutations fast and easily

MGE-GraphQL Introduction MGE-GraphQL is a Python library for building GraphQL mutations fast and easily. Data Validations: A similar data validation w

MGE Software 4 Apr 23, 2022
GraphQL security auditing script with a focus on performing batch GraphQL queries and mutations

BatchQL BatchQL is a GraphQL security auditing script with a focus on performing batch GraphQL queries and mutations. This script is not complex, and

Assetnote 267 Dec 24, 2022
A Django GraphQL Starter that uses graphene and graphene_django to interface GraphQL.

Django GraphQL Starter GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data... According to the doc

0101 Solutions 1 Jan 10, 2022
A python graphql api, which serves ECB currency rates from last 90 days.

Exchange Rate Api using GraphQL Get Code git pull https://github.com/alaturqua/exchangerate-graphql.git Create .env file with following content and s

Isa 1 Nov 4, 2021
Django Project with Rest and Graphql API's

Django-Rest-and-Graphql # 1. Django Project Setup With virtual environment: mkdir {project_name}. To install virtual Environment sudo apt-get install

Shubham Agrawal 5 Nov 22, 2022
A plug and play GraphQL API for Wagtail, powered by Strawberry 🍓

Strawberry Wagtail ?? A plug and play GraphQL API for Wagtail, powered by Strawberry ?? ⚠️ Strawberry wagtail is currently experimental, please report

Patrick Arminio 27 Nov 27, 2022
Integrate GraphQL into your Django project.

Graphene-Django A Django integration for Graphene. ?? Join the community on Slack Documentation Visit the documentation to get started! Quickstart For

GraphQL Python 4k Dec 31, 2022
Adds GraphQL support to your Flask application.

Flask-GraphQL Adds GraphQL support to your Flask application. Usage Just use the GraphQLView view from flask_graphql from flask import Flask from flas

GraphQL Python 1.3k Dec 31, 2022
GraphQL framework for Python

Graphene ?? Join the community on Slack We are looking for contributors! Please check the ROADMAP to see how you can help ❤️ The below readme is the d

GraphQL Python 7.5k Jan 1, 2023