Skip to content

Commit

Permalink
feat: add initial version
Browse files Browse the repository at this point in the history
BREAKING CHANGE: initial version with all the base functionalities
  • Loading branch information
rozsasarpi committed Jul 23, 2021
1 parent e50c156 commit b300a32
Show file tree
Hide file tree
Showing 30 changed files with 2,122 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,5 @@
<!-- To get a coverage badge: change `$your_source_branch_name$` in the URL below to
the name of your source branch. `target branch` <- merge - `source branch`.
The badge will show the coverage after the first CI run has been completed.
If you do not want to display the coverage, just remove the line below. -->
![coverage](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/rozsasarpi/da9e3419b54a0daf6fe07b934f37f837/raw/lightkde_$your_source_branch_name$_coverage.json)
112 changes: 112 additions & 0 deletions .github/workflows/push.yaml
@@ -0,0 +1,112 @@
# This workflow runs on
# * a `push` to any branch
# * a schedule to check compatibility with potentially updated dependencies

name: CI

on:
push:
schedule:
- cron: '0 1 * * 6' # weekly run at 01:00 UTC on Saturday

jobs:
# Lint and type checking
lint_and_type_check:
name: Lint and type check
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
pip install pre-commit
- name: Lint and type check
run: |
pre-commit run --all-files --verbose --show-diff-on-failure
# Unit test and coverage
test:
name: Test on Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ 3.6, 3.7, 3.8, 3.9 ]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install package with dependencies
run: |
pip install .[tests]
- name: Test with pytest
run: |
# grab the coverage output and also print it to the sreen
COVERAGE_REPORT=$(coverage run -m pytest && coverage report -m | \
tee /dev/stderr)
# extract the percentage of the total coverage, e.g. `75%`
COVERAGE_PCT=$(echo $COVERAGE_REPORT | \
grep -oP "TOTAL\s+\d+\s+\d+\s+(\d+%)" | grep -oP "\d+%")
# get only the coverage number without the percentage symbol
COVERAGE_NUM=$(echo $COVERAGE_PCT | grep -oP "\d+")
# get an indicative color
if (( COVERAGE_NUM <= 50 )); then
COVERAGE_COL="red"
elif (( COVERAGE_NUM <= 60 )); then
COVERAGE_COL="orange"
elif (( COVERAGE_NUM <= 70 )); then
COVERAGE_COL="yellow"
elif (( COVERAGE_NUM <= 80 )); then
COVERAGE_COL="yellowgreen"
elif (( COVERAGE_NUM <= 90 )); then
COVERAGE_COL="green"
else
COVERAGE_COL="brightgreen"
fi
# active branch name
BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})
# add them to the github env for later usage
echo "COVERAGE_PCT=$(echo $COVERAGE_PCT)" >> $GITHUB_ENV
echo "COVERAGE_COL=$(echo $COVERAGE_COL)" >> $GITHUB_ENV
echo "BRANCH_NAME=$(echo $BRANCH_NAME)" >> $GITHUB_ENV
# Upload the coverage value to gist only once
- if: ${{ matrix.python-version == '3.9' }}
name: Upload coverage to gist
uses: schneegans/dynamic-badges-action@v1.1.0
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: bafe6e5b1382e4c2c49156a01e4803f3
filename: lightkde_${{ env.BRANCH_NAME }}_coverage.json
label: coverage
message: ${{ env.COVERAGE_PCT }}
color: ${{ env.COVERAGE_COL }}

# Release to GitHub and PyPi [only for `main`]
release:
name: Semantic Release
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && github.repository == 'rozsasarpi/lightkde'
concurrency: release
needs: [ lint_and_type_check, test ]

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Fetch main
run: |
git fetch --prune origin +refs/heads/main:refs/remotes/origin/main
- name: Python semantic release
uses: relekang/python-semantic-release@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
pypi_token: ${{ secrets.PYPI_TOKEN }}
207 changes: 207 additions & 0 deletions .gitignore
@@ -0,0 +1,207 @@
### Sphinx gallery ###
*/auto_examples/

### Images ###
*.svg
*.png

###
*.pickle

### Unit testing data ###
**/*amazonaws*/

### Log files ###
*.log


### PyCharm ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

.idea/

# CMake
cmake-build-*/

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

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

# 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/
.nox/
.coveragerc
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

### venv ###
# Virtualenv
# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
[Bb]in
[Ii]nclude
[Ll]ib
[Ll]ib64
[Ll]ocal
[Ss]cripts
pyvenv.cfg
pip-selfcheck.json

### VisualStudioCode ###
.vscode/*

# Local History for Visual Studio Code
.history/

### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide
46 changes: 46 additions & 0 deletions .pre-commit-config.yaml
@@ -0,0 +1,46 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: check-added-large-files
args: ['--maxkb=100']
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/PyCQA/isort
rev: 5.9.1
hooks:
- id: isort
name: isort (python)
args: ['--profile', 'black', '--filter-files']

- repo: https://github.com/psf/black
rev: 21.5b2
hooks:
- id: black
args: ['--line-length=88']

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.910
hooks:
- id: mypy
pass_filenames: false
args: ['lightkde', '--ignore-missing-imports']

- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
args: [
'--max-line-length=88',
'--select=E,F,W,C90,B,I',
'--ignore=E203,W503',
'--import-order-style=pycharm',
'--application-import-names=lightkde, tests'
]
additional_dependencies: [
flake8-bugbear,
flake8-tidy-imports,
flake8-import-order
]
23 changes: 23 additions & 0 deletions .readthedocs.yaml
@@ -0,0 +1,23 @@
# .readthedocs.yml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py

# Optionally build your docs in additional formats such as PDF and ePub
formats:
- htmlzip

# Optionally set the version of Python and requirements required to build your docs
python:
version: "3.8"
install:
- method: pip
path: .
extra_requirements:
- docs

0 comments on commit b300a32

Please sign in to comment.