-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENH: modernize setup and add lume command manager to ease development… (
#25) * ENH: modernize setup and add lume command manager to ease development. Add also a new github workflow for ci * ENH: use pydantic instead of dataclasses * ENH: add CONCURRENT_TEST to do or not to do some assertions which depends on time and external server
- Loading branch information
1 parent
cfad84f
commit d35ff7c
Showing
24 changed files
with
203 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: ci | ||
|
||
on: | ||
pull_request: | ||
paths-ignore: | ||
- '*.md' | ||
- 'alice/VERSION' | ||
branches: | ||
- master | ||
|
||
env: | ||
ONBOARDING_API_KEY: ${{ secrets.ONBOARDING_API_KEY }} | ||
ONBOARDING_SANDBOX_TOKEN: ${{ secrets.ONBOARDING_SANDBOX_TOKEN }} | ||
CONCURRENT_TESTING: True | ||
|
||
jobs: | ||
ci: | ||
strategy: | ||
max-parallel: 4 | ||
matrix: | ||
os: [ macOS-latest, ubuntu-latest ] | ||
python-version: [3.7, 3.8, 3.9] | ||
runs-on: ${{matrix.os}} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- uses: actions/cache@v2 | ||
with: | ||
path: ${{ env.pythonLocation }} | ||
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('dev-requirements.txt') }} | ||
- name: Install Requirements | ||
run: | | ||
pip install lume | ||
lume -install | ||
- name: Lint | ||
run: lume -lint | ||
- name: Check Requirements | ||
run: lume -check-requirements | ||
- name: Test [pytest] | ||
run: lume -test | ||
- name: Example [Onboarding] | ||
run: python examples/onboarding.py | ||
- name: Example [Onboarding with Identification] | ||
run: python examples/onboarding_with_identification.py | ||
- name: Example [Onboarding with Certificate] | ||
run: python examples/onboarding_with_certificate.py | ||
- name: Example [Onboarding with Screening] | ||
run: python examples/onboarding_with_screening.py | ||
- name: Example [Auth] | ||
run: python examples/auth.py | ||
- name: Example [Sandbox] | ||
run: python examples/sandbox.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,55 +11,34 @@ env: | |
ONBOARDING_API_KEY: ${{ secrets.ONBOARDING_API_KEY }} | ||
ONBOARDING_SANDBOX_TOKEN: ${{ secrets.ONBOARDING_SANDBOX_TOKEN }} | ||
ALICE_GITHUB_ACCESS_TOKEN: ${{ secrets.ALICE_GITHUB_ACCESS_TOKEN }} | ||
CONCURRENT_TESTING: True | ||
|
||
jobs: | ||
ci: | ||
strategy: | ||
max-parallel: 4 | ||
matrix: | ||
os: [ macOS-latest, ubuntu-latest ] | ||
python-version: [3.8] | ||
python-version: [3.7, 3.8, 3.9] | ||
runs-on: ${{matrix.os}} | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- uses: actions/cache@v1 | ||
if: startsWith(runner.os, 'Linux') | ||
- uses: actions/cache@v2 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/dev.txt') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- uses: actions/cache@v1 | ||
if: startsWith(runner.os, 'macOS') | ||
with: | ||
path: ~/Library/Caches/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/dev.txt') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- uses: actions/cache@v1 | ||
if: startsWith(runner.os, 'Windows') | ||
with: | ||
path: ~\AppData\Local\pip\Cache | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/dev.txt') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: Install requirements | ||
run: | | ||
pip install -r requirements/dev.txt | ||
- name: Lint with black & flake8 | ||
path: ${{ env.pythonLocation }} | ||
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('dev-requirements.txt') }} | ||
- name: Install Requirements | ||
run: | | ||
black . | ||
flake8 alice | ||
- name: Install package | ||
run: | | ||
pip install -e . # Dependencies are also included in the setup.py | ||
pip install lume | ||
lume -install | ||
- name: Lint | ||
run: lume -lint | ||
- name: Test [pytest] | ||
run: | | ||
pytest --tb=no | ||
run: lume -test | ||
- name: Example [Onboarding] | ||
run: python examples/onboarding.py | ||
- name: Example [Onboarding with Identification] | ||
|
@@ -96,7 +75,7 @@ jobs: | |
- name: Git - Commit VERSION File | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "ALiCE Biometrics" | ||
git config --global user.name "Alice Biometrics" | ||
git commit -m "Update version to ${RELEASE_VERSION}" | ||
- name: Push changes | ||
uses: alice-biometrics/github-push-action@master | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
|
||
The aim of this Python package is to manage the authentication and backend operations against ALiCE Onboarding API. | ||
|
||
If you want more information about how to integrate with ALiCE technology, please contact us at [email protected]. | ||
If you want more information about how to integrate with Alice technology, please contact us at [email protected]. | ||
|
||
## Table of Contents | ||
- [Requirements](#requirements) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,9 @@ | ||
from typing import Optional | ||
|
||
from dataclasses import dataclass | ||
from dataclasses_json import dataclass_json | ||
from pydantic import BaseModel | ||
|
||
|
||
@dataclass_json | ||
@dataclass | ||
class DeviceInfo: | ||
class DeviceInfo(BaseModel): | ||
device_platform: Optional[str] = None | ||
device_platform_version: Optional[str] = None | ||
device_model: Optional[str] = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,9 @@ | ||
from typing import Optional | ||
|
||
from dataclasses import dataclass | ||
from dataclasses_json import dataclass_json | ||
from pydantic import BaseModel | ||
|
||
|
||
@dataclass_json | ||
@dataclass | ||
class UserInfo: | ||
class UserInfo(BaseModel): | ||
first_name: Optional[str] = None | ||
last_name: Optional[str] = None | ||
email: Optional[str] = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: onboarding-python | ||
|
||
install: | ||
run: | ||
- pip install --upgrade --upgrade-strategy eager -r requirements/dev-requirements.txt -r requirements/requirements.txt | ||
- pip install -e . | ||
steps: | ||
clean: | ||
run: | ||
- rm -f .coverage | ||
- rm -rf output | ||
- rm -rf .pytest_cache | ||
- find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf | ||
lint: | ||
run: | ||
- black --check . | ||
- flake8 alice | ||
check-requirements: | ||
run: safety check -r requirements/requirements.txt | ||
static-analysis: | ||
run: mypy --namespace-packages alice | ||
test: | ||
run: pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Configuration of py.test | ||
[pytest] | ||
markers=unit | ||
addopts=tests | ||
-v | ||
--color=yes | ||
--durations=10 | ||
filterwarnings = | ||
error | ||
ignore::DeprecationWarning | ||
|
||
python_files=test_*.py | ||
python_classes=Test* | ||
python_functions=test_* should_ | ||
|
||
norecursedirs = examples alice requirements *.egg-info .git resources |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
black==21.11b1 | ||
flake8==4.0.1 | ||
isort==5.6.4 | ||
pytest==5.0.1 | ||
pytest-cov==2.5.1 | ||
pytest-mock==1.7.1 | ||
pytest-env==0.6.2 | ||
pytest-variables[yaml]==1.9.0 | ||
pytest-clarity==1.0.1 | ||
pre-commit==2.15.0 | ||
mypy==0.910 | ||
safety==1.10.3 |
Oops, something went wrong.