Skip to content

Commit

Permalink
🎉 Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ddelange committed Apr 9, 2020
0 parents commit 31abc16
Show file tree
Hide file tree
Showing 20 changed files with 1,000 additions and 0 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tests
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @ddelange
90 changes: 90 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: GH

on:
pull_request:
branches: "*"
push:
branches: "master"
tags: "*"

jobs:
CI:
runs-on: ubuntu-latest
strategy:
max-parallel: 8
matrix:
python-version: [2.7, 3.5, 3.6, 3.7, 3.8]
steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}

- name: Pip cache
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements/*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements/ci.txt
pip install -e .
- name: Lint
run: make lint

- name: Mypy
if: matrix.python-version == 3.8
run: mypy src/

- name: Test
run: python -m pytest tests/

- name: Codecov
if: matrix.python-version == 3.8
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: |
pip install codecov
codecov
CD:
needs: CI
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8

- name: PyPi Deploy preparation
run: |
pip install --upgrade setuptools wheel
python setup.py sdist bdist_wheel --universal
- name: PyPi Deploy
uses: pypa/[email protected]
with:
user: ${{ secrets.PYPI_USER }}
password: ${{ secrets.PYPI_PASSWORD }}

# - name: Docker image build and deploy
# # GITHUB_TOKEN should be less than 60mins old at this point
# run: |
# DOCKER_IMAGE_PATH="./Dockerfile"
# DOCKER_IMAGE_TAG="${GITHUB_REF##refs/tags/}"
# DOCKER_IMAGE_NAME="docker.pkg.github.com/$GITHUB_REPOSITORY/$(basename $GITHUB_REPOSITORY):$DOCKER_IMAGE_TAG"
# test -f $DOCKER_IMAGE_PATH || { echo "Dockerfile '$DOCKER_IMAGE_PATH' not found" && exit 1; }
# echo ${{ secrets.GITHUB_TOKEN }} | docker login docker.pkg.github.com -u $GITHUB_ACTOR --password-stdin
# docker build . -f $DOCKER_IMAGE_PATH -t $DOCKER_IMAGE_NAME --build-arg PIP_INDEX_URL=$PIP_INDEX_URL --build-arg PIP_EXTRA_INDEX_URL=$PIP_EXTRA_INDEX_URL
# docker images
# docker push $DOCKER_IMAGE_NAME
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# setuptools_scm
_repo_version.py
48 changes: 48 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
repos:
- repo: https://github.com/Yelp/detect-secrets
rev: v0.13.1
hooks:
- id: detect-secrets
args: ['--baseline', '.secrets.baseline']
exclude: .*/tests/.*

- repo: https://github.com/psf/black
rev: stable
hooks:
- id: black
language_version: python3.7

- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.21
hooks:
- id: isort

- repo: https://github.com/PyCQA/flake8
rev: 3.7.9
hooks:
- id: flake8
additional_dependencies: [
flake8-absolute-import,
flake8-black,
flake8-blind-except,
flake8-builtins,
flake8-comprehensions,
flake8-docstrings,
flake8-mutable,
flake8-print,
flake8-quotes,
flake8-tuple,
]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.5.0
hooks:
- id: mixed-line-ending
args: ['--fix=lf']
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-merge-conflict
- id: check-json
- id: check-toml
- id: check-xml
- id: check-yaml
51 changes: 51 additions & 0 deletions .secrets.baseline
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"exclude": {
"files": null,
"lines": null
},
"generated_at": "2020-04-08T15:21:27Z",
"plugins_used": [
{
"name": "AWSKeyDetector"
},
{
"name": "ArtifactoryDetector"
},
{
"base64_limit": 4.5,
"name": "Base64HighEntropyString"
},
{
"name": "BasicAuthDetector"
},
{
"hex_limit": 3,
"name": "HexHighEntropyString"
},
{
"name": "JwtTokenDetector"
},
{
"keyword_exclude": null,
"name": "KeywordDetector"
},
{
"name": "MailchimpDetector"
},
{
"name": "PrivateKeyDetector"
},
{
"name": "SlackDetector"
},
{
"name": "StripeDetector"
}
],
"results": {},
"version": "0.13.1",
"word_list": {
"file": null,
"hash": null
}
}
17 changes: 17 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
MIT License

Copyright (c) 2020 ddelange

Copyright (c) 2017 EricDuminil

Copyright (c) 2013 atiking

Copyright (c) 2012 fcicq

Copyright (c) 2010 rex

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.
8 changes: 8 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
global-exclude *
include setup.py
include README*
include LICENSE*
graft src
graft requirements
exclude requirements/ci.txt
recursive-exclude * __pycache__
27 changes: 27 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
clean:
find src -type d -name "__pycache__" -exec rm -rf {} + > /dev/null 2>&1
find src -type f -name "*.pyc" -exec rm -rf {} + > /dev/null 2>&1

find tests -type d -name "__pycache__" -exec rm -rf {} + > /dev/null 2>&1
find tests -type f -name "*.pyc" -exec rm -rf {} + > /dev/null 2>&1

lint:
flake8 --show-source src
isort --check-only -rc src --diff

flake8 --show-source tests
isort --check-only -rc tests --diff

flake8 --show-source setup.py
isort --check-only setup.py --diff

test:
mypy src/
python -m pytest tests/

install:
pip install -r requirements/ci.txt
pip install -e .
pre-commit install

all: clean lint test
Loading

0 comments on commit 31abc16

Please sign in to comment.