diff --git a/mypy.ini b/mypy.ini new file mode 100644 index 0000000..c062136 --- /dev/null +++ b/mypy.ini @@ -0,0 +1,12 @@ +[mypy] +warn_unused_ignores = True +ignore_missing_imports = True +strict_optional = False +check_untyped_defs = True +disallow_incomplete_defs = True +disallow_untyped_defs = True +disallow_any_generics = True +disallow_untyped_calls = True +warn_redundant_casts = True +warn_unused_configs = True +strict_equality = True diff --git a/setup.py b/setup.py index 4807b5b..a2b0aa2 100644 --- a/setup.py +++ b/setup.py @@ -7,6 +7,26 @@ classifiers = [ ] +# pylint: disable=invalid-name +extras_require = { + "test": [ + "codecov", + "pytest", + "pytest-cov", + "pytest-asyncio", + ], + "lint": [ + "pylint", + "mypy", + ], + "dev": [ + "tox", + ], +} + +extras_require["dev"] = extras_require["test"] + extras_require["lint"] + extras_require["dev"] + + setuptools.setup( name="libp2p", description="libp2p implementation written in python", @@ -26,6 +46,7 @@ setuptools.setup( "lru-dict>=1.1.6", "aio_timers>=0.0.1,<0.1.0", ], + extras_require=extras_require, packages=setuptools.find_packages(exclude=["tests", "tests.*"]), zip_safe=False, ) diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..d7cf5d7 --- /dev/null +++ b/tox.ini @@ -0,0 +1,21 @@ +# Reference: https://github.com/ethereum/py_ecc/blob/d0da74402210ea1503ef83b3c489d5b5eba7f7bf/tox.ini + +[tox] +envlist = + py37-test + lint + +[testenv] +deps = +extras = test +commands = + pytest --cov=./libp2p tests/ +basepython = + py37: python3.7 + +[testenv:lint] +basepython = python3 +extras = dev +commands = + pylint --rcfile={toxinidir}/.pylintrc libp2p tests + mypy -p p2pclient --config-file {toxinidir}/mypy.ini