https://github.com/velimir/contributions
Scripts to generate user GithHub contributions Gantt chart
https://github.com/velimir/contributions
asyncio chart contributions-chart github-api graphql notebook python python3
Last synced: 28 days ago
JSON representation
Scripts to generate user GithHub contributions Gantt chart
- Host: GitHub
- URL: https://github.com/velimir/contributions
- Owner: velimir
- Created: 2017-12-29T16:59:19.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-01-02T19:50:20.000Z (about 8 years ago)
- Last Synced: 2025-01-20T06:25:28.736Z (about 1 year ago)
- Topics: asyncio, chart, contributions-chart, github-api, graphql, notebook, python, python3
- Language: Python
- Size: 1.49 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Historical GitHub contributions chart
[](examples/velimir-top20.png)
Read more about script usage and examples in a blog [post](https://velimir.me.uk/historical-github-contributions-chart.html).
## Use
### Getting data
1. Clone repo
```
$ git clone git@github.com:velimir0xff/contributions.git && cd contributions
```
2. Install dependencies:
```
$ pip install -r ./requirements.txt
```
3. Set GITHUB_TOKEN environment variable. It's required to talk to GraphQL endpoint. You can get token on token [page](https://github.com/settings/tokens).
```
$ export GITHUB_TOKEN=
```
4. Run script:
```
$ ./contributions.py > stats.json
```
For additional configuration options see script usage:
```
$ ./contributions.py -h
usage: contributions.py [-h] [-g URL] [-u USERNAME] [-o OWNERS] [-v] [-n] [-m MAX_CONCURRENCY]
[-c MAX_CONTRIBUTORS] [--out OUT]
List projects to which user have contributed to. Script requires valid GitHub token set via GITHUB_TOKEN environment variables.
optional arguments:
-h, --help show this help message and exit
-g URL, --url URL GitHub base url (default: https://api.github.com)
-u USERNAME, --username USERNAME
Contributor username
-o OWNERS, --owner OWNERS
Owners to check
-v, --verbose Verbose mode (default: False)
-n, --no-progress Do not show progress bar (default: False)
-m MAX_CONCURRENCY, --max-concurrency MAX_CONCURRENCY
Maximum # of concurrent requests to GitHub (default: 20)
-c MAX_CONTRIBUTORS, --max-contributors MAX_CONTRIBUTORS
Maximum # of concurrent requests to GitHub contributors endpoint (default:
20)
--out OUT output file with contributions (default=stdout)
```
### Data visualization
In order to generate chart use `contributions.ipynb` jupyter notebook in the repo root directory.
Configure `filename` variable to point to stats data generated by script (example: `filename = 'examples/uwiger.json'`) and run all cells.
To save pictures just add the following line at the end of the notebook:
```python
fig.savefig('my-stats.png', dpi=300, bbox_inches='tight')
```
or if you want a transparent version:
```python
fig.savefig('my-stats.png', dpi=300, bbox_inches='tight', transparent=True)
```
## Contribute
Please feel free to submit pull requests to this repository or open an issue.