1
0
mirror of https://github.com/enpaul/keyosk.git synced 2025-12-19 09:42:34 +00:00

Overhaul repository with newest bestest practices

Add typing stub file
Add metadata tests
Add missing dev dependencies
Add merge conflict check pre-commit
Add tox env for py3.9
Update license from MIT to GPL3
Update pyproject with pypi metadata
Update makefile to reduce duplication and add missing targets
Update dependencies to latest versions
Update pre-commit config to piggy back on poetry env
Update pyproject to use poetry-core
Update toxfile to use locked dependencies
Remove unused codeowners file
Remove placeholder test
This commit is contained in:
2020-11-26 01:22:13 -05:00
parent 5030db2a84
commit ca891dd1fb
17 changed files with 2073 additions and 784 deletions

88
tox.ini
View File

@@ -1,48 +1,78 @@
[tox]
envlist = py37, py36, lint, typing, security, docs
envlist = py36, py37, py38, py39, static, static-tests, security, docs
isolated_build = true
skip_missing_interpreters = true
[testenv]
description = Run the unit tests (pytest)
deps =
description = Run the tests
require_locked_deps = true
locked_deps =
pytest
pytest-cov
toml
commands =
pytest --cov={envsitepackagesdir}/keyosk --cov-config .coveragerc tests/ --cov-report term-missing
pytest --cov={envsitepackagesdir}/keyosk --cov-config {toxinidir}/.coveragerc --cov-report term-missing {toxinidir}/tests/
[testenv:lint]
description = Check code formatting against black and pylint
deps =
[testenv:static]
description = Static formatting and quality enforcement
basepython = python3.8
platform = linux
ignore_errors = true
require_locked_deps = true
locked_deps =
pre-commit
pylint == 2.3.1
astroid == 2.2.5
commands =
pre-commit run --all-files
pylint keyosk
[testenv:typing]
description = Check type annotations with mypy
deps =
black
blacken-docs
reorder-python-imports
pylint
mypy
commands =
mypy keyosk --ignore-missing-imports --no-strict-optional
pre-commit run --all-files
pylint --rcfile {toxinidir}/.pylintrc {toxinidir}/keyosk/
mypy --ignore-missing-imports --no-strict-optional {toxinidir}/keyosk/
[testenv:static-tests]
description = Static formatting and quality enforcement for the tests
basepython = python3.8
platform = linux
ignore_errors = true
require_locked_deps = true
locked_deps =
pylint
mypy
commands =
pylint --rcfile {toxinidir}/.pylintrc {toxinidir}/tests/
mypy --ignore-missing-imports --no-strict-optional {toxinidir}/tests/
[testenv:security]
description = Check security vulnerabilities (bandit)
deps =
description = Security checks
basepython = python3.8
platform = linux
ingore_errors = true
require_locked_deps = true
skip_install = true
locked_deps =
bandit
safety
allowlist_externals =
poetry
commands =
bandit --recursive keyosk
bandit --recursive --quiet {toxinidir}/keyosk/
bandit --recursive --quiet --skip B101 {toxinidir}/tests/
poetry export --format requirements.txt --output {envtmpdir}/requirements.txt --without-hashes --dev
safety check --bare --file {envtmpdir}/requirements.txt
[testenv:docs]
description = Build documentation to check RST syntax (sphinx)
deps =
sphinx >= 1.7.5, < 2.0
sphinx-autodoc-typehints >= 1.3.0, < 2.0
whitelist_externals =
description = Build sphinx documentation
basepython = python3.8
platform = linux
require_locked_deps = true
locked_deps =
sphinx
sphinx-autodoc-typehints
allowlist_externals =
rm
commands =
sphinx-apidoc -o "./docs/" "keyosk"
rm "docs/modules.rst"
sphinx-build -M html "./docs/" "./docs/_build"
sphinx-build -M latex "./docs/" "./docs/_build"
sphinx-apidoc -o "{toxinidir}/docs/" "keyosk"
rm "{toxinidir}/docs/modules.rst"
sphinx-build -M html "{toxinidir}/docs/" "{toxinidir}/docs/_build"