Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mawkee committed Apr 28, 2020
0 parents commit 53e56b7
Show file tree
Hide file tree
Showing 45 changed files with 1,428 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
template: |
## What’s Changed
$CHANGES
categories:
- title: '🚀 Features'
labels:
- 'feature'
- 'improvement'
- 'enhancement'
- title: '🐛 Bug Fixes'
label: 'bug'
- title: '🧰 Maintenance'
label: 'chore'
- title: '🎯 QA'
label: 'qa'
exclude-labels:
- 'skip-changelog'
17 changes: 17 additions & 0 deletions .github/workflows/draft-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Create/update draft release

on:
push:
branches:
- development

jobs:
update_draft_release:
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: pinio/draft-semver@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71 changes: 71 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Sphinx documentation
docs/_build/

# PyBuilder
target/

#Ipython Notebook
.ipynb_checkpoints

.vagrant/

# editors
*.swp
*.swo
.idea
.vscode
.ropeproject
22 changes: 22 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/asottile/seed-isort-config
rev: v1.9.4
hooks:
- id: seed-isort-config
- repo: https://github.com/pre-commit/mirrors-isort
rev: 'v4.3.21'
hooks:
- id: isort
types: [file, python]
- repo: https://github.com/psf/black
rev: 19.10b0
hooks:
- id: black
types: [file, python]
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Danilo Martins

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
80 changes: 80 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Freyr - Kanban Metrics for Github Board

This project aims to fetch and work with metrics from a common Github board.

## Disclaimer

This project is in early alpha stage. It shouldn't in theory break anything, but don't blame me if it sets your computer on fire, or sends troll messages to your relatives.

## Name origin

Freyr (Old Norse: “[the] Lord”) is the god of prosperity (source: Wikipedia).

## Requirements

- MongoDB 4.0 or above
- Python 3.6 or above

## Quickstart

1. Set up a local MongoDB server instance
1. Create a Github token with access to the project(s) you want to collect data from
1. Set the environment variable GITHUB_PROJECTS_ACCESS_TOKEN
1. Create a virtualenv and install everything from requirements.txt
1. Create a superuser on Django Admin (`python src/manage.py createsuperuser`)
1. Run `src/manage.py list_projects`. The first column shows your projects IDs
1. Run `src/manage.py runserver`
1. Access 127.0.0.1:8000/admin
1. Add at least one Repository (by organization and repo) and one Project (using the ID above)
1. Run `src/manage.py sync_project :project_id`. Optionally you can also inform the `-r repo` param to limit fetching data from a single repository.
1. If the command above is taking too long, you can set a minimum date on the repo configuration to fech only data starting from that date
1. For now, you can use curl to see the output json for percentiles. Just use:
```
curl --location --request POST 'localhost:8000/issue/percentiles/' \
--form 'start_date=2020-01-01' \
--form 'end_date=2020-06-01' \
--form 'project=:object_id_for_project_on_admin'
```
(The project object ID can be seen on the URL when you open the project on the admin page)

## Detailed instructions

### Installing MongoDB

For now, _freyr_ only supports a local mongodb server instance. You can customize settings.py if you want.
Installation instructions: https://docs.mongodb.com/manual/installation/

### Github personal access token

https://help.github.com/en/enterprise/2.17/user/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line

### Creating a virtualenv and installing requirements.txt

I suggest using virtualenvwrapper -- https://virtualenvwrapper.readthedocs.io/en/latest/
Then using:
```sh
mkvirtualenv freyr
pip install -r requirements.txt
```

## Supported Python/MongoDB versions

This project was tested on Python 3.6, 3.7 and 3.8, and on MongoDB 4.0 and 4.2.

## Contributing

Just make sure you use the pre-commit hooks and follow the PEP8 specification

## Versioning

_NOTE: This project is still **beta** -- versioning will start at 1.0 when ready_

We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/pinio/freyr/tags).

## Authors

* **Danilo Martins** - *Initial work* - [Mawkee](https://github.com/mawkee)

## License

This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
17 changes: 17 additions & 0 deletions requirements.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Django stuff
django<=2.2.99
djongo==1.3.1
django-extensions
django-jsonview

# Development
black
flake8
ipdb
ipython
isort

# Misc
PyGithub
requests
iso8601
58 changes: 58 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile requirements.in
#
appdirs==1.4.3 # via black
attrs==19.3.0 # via black
backcall==0.1.0 # via ipython
black==19.10b0 # via -r requirements.in
bson==0.5.8 # via djongo
certifi==2020.4.5.1 # via requests
chardet==3.0.4 # via requests
click==7.1.1 # via black
dataclasses==0.6 # via djongo
decorator==4.4.2 # via ipython, traitlets
deprecated==1.2.9 # via pygithub
django-extensions==2.2.9 # via -r requirements.in
django-jsonview==1.3.1 # via -r requirements.in
django==2.2.12 # via -r requirements.in, djongo
djongo==1.3.1 # via -r requirements.in
entrypoints==0.3 # via flake8
flake8==3.7.9 # via -r requirements.in
idna==2.9 # via requests
ipdb==0.13.2 # via -r requirements.in
ipython-genutils==0.2.0 # via traitlets
ipython==7.13.0 # via -r requirements.in, ipdb
iso8601==0.1.12 # via -r requirements.in
isort==4.3.21 # via -r requirements.in
jedi==0.17.0 # via ipython
mccabe==0.6.1 # via flake8
parso==0.7.0 # via jedi
pathspec==0.8.0 # via black
pexpect==4.8.0 # via ipython
pickleshare==0.7.5 # via ipython
prompt-toolkit==3.0.5 # via ipython
ptyprocess==0.6.0 # via pexpect
pycodestyle==2.5.0 # via flake8
pyflakes==2.1.1 # via flake8
pygithub==1.47 # via -r requirements.in
pygments==2.6.1 # via ipython
pyjwt==1.7.1 # via pygithub
pymongo==3.10.1 # via djongo
python-dateutil==2.8.1 # via bson
pytz==2019.3 # via django
regex==2020.4.4 # via black
requests==2.23.0 # via -r requirements.in, pygithub
six==1.14.0 # via bson, django-extensions, djongo, python-dateutil, traitlets
sqlparse==0.2.4 # via django, djongo
toml==0.10.0 # via black
traitlets==4.3.3 # via ipython
typed-ast==1.4.1 # via black
urllib3==1.25.9 # via requests
wcwidth==0.1.9 # via prompt-toolkit
wrapt==1.12.1 # via deprecated

# The following packages are considered to be unsafe in a requirements file:
# setuptools
12 changes: 12 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[flake8]
max-line-length = 88

[isort]
multi_line_output=3
include_trailing_comma=True
force_grid_wrap=0
combine_as_imports=True
line_length=88
known_third_party=djongo,github,iso8601,issue,jsonview,project,pytz,utils
known_django=django
sections=FUTURE,STDLIB,DJANGO,THIRDPARTY,PANDAS,FIRSTPARTY,LOCALFOLDER
Empty file added src/freyr/__init__.py
Empty file.
Loading

0 comments on commit 53e56b7

Please sign in to comment.