diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..0e1ec71 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,24 @@ +--- +kind: pipeline + +name: default + +matrix: + include: + - python: 3.8 + env: TOXENV=py38 + - python: 3.8 + env: TOXENV=lint + - python: 3.8 + env: TOXENV=sort + - python: 3.8 + env: TOXENV=format + - python: 3.8 + env: TOXENV=type + +steps: + - name: Tox matrix testing + image: python:3.8.2-buster + commands: + - pip install tox==3.14.6 + - tox diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ca15349 --- /dev/null +++ b/.gitignore @@ -0,0 +1,12 @@ +*.egg-info/ +*.pyc +.coverage +.eggs/ +.mypy_cache/ +.tox/ +.venv/ +__pycache__ +build/ +dist/ +pip-wheel-metadata/ +documentation/build/ diff --git a/library/gandi_dns.py b/library/gandi_dns.py index ec8f782..8837f9b 100644 --- a/library/gandi_dns.py +++ b/library/gandi_dns.py @@ -1,5 +1,7 @@ #!/usr/bin/python3 +from ansible.module_utils.basic import AnsibleModule + DOCUMENTATION = """ --- module: gandi_dns @@ -14,8 +16,6 @@ EXAMPLES = """ ipv4: 192.168.1.2 """ -from ansible.module_utils.basic import AnsibleModule - def main(): module = AnsibleModule(argument_spec={}) diff --git a/mypy.ini b/mypy.ini new file mode 100644 index 0000000..3580d9a --- /dev/null +++ b/mypy.ini @@ -0,0 +1,4 @@ +[mypy] +python_version = 3.7 +platform = linux +ignore_missing_imports = True diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..60c158d --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,13 @@ +[build-system] +requires = [ + "setuptools>=40.9.0", + "setuptools-scm", + "wheel", +] +build-backend = "setuptools.build_meta" + +[tool.black] +line-length = 80 +target-version = ["py38"] +skip-string-normalization = true +include = '\.pyi?$' diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..749b5d7 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,16 @@ +[tool:pytest] +testpaths = test + +[flake8] +max-line-length = 80 + +[isort] +line_length = 80 +multi_line_output = 3 +skip = .venv, .tox +include_trailing_comma = True + +[metadata] +name = autonomic.gandi +author = decentral1se +version = 0.0.1 diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..6a83aee --- /dev/null +++ b/tox.ini @@ -0,0 +1,40 @@ +[tox] +envlist = + {py38} + lint + sort + format + type +skip_missing_interpreters = True +isolated_build = True + +[testenv] +description = run the unit tests +deps = + pytest + pytest-cov +commands = pytest test/ --cov={toxinidir}/library/ --no-cov-on-fail {posargs} + +[testenv:lint] +description = lint the source +skipdist = True +deps = flake8 +commands = flake8 {posargs} library/ test/ + +[testenv:sort] +description = sort the source +skipdist = True +deps = isort +commands = isort {posargs:-rc -c} -sp setup.cfg library/ test/ + +[testenv:format] +description = format the source +skipdist = True +deps = black +commands = black {posargs:--check} library/ test/ + +[testenv:type] +description = type check the source +skipdist = True +deps = mypy +commands = mypy library/ test/