summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/lint.yml8
-rw-r--r--.mypy.ini2
-rw-r--r--gitlab/cli.py2
-rw-r--r--gitlab/client.py2
-rw-r--r--test-requirements.txt1
-rw-r--r--tox.ini9
6 files changed, 21 insertions, 3 deletions
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 968320d..4b918df 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -27,3 +27,11 @@ jobs:
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v2
+
+ mypy:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - uses: actions/setup-python@v2
+ - run: pip install --upgrade tox
+ - run: tox -e mypy
diff --git a/.mypy.ini b/.mypy.ini
new file mode 100644
index 0000000..e68f0f6
--- /dev/null
+++ b/.mypy.ini
@@ -0,0 +1,2 @@
+[mypy]
+files = gitlab/*.py
diff --git a/gitlab/cli.py b/gitlab/cli.py
index d858a74..3a315a8 100644
--- a/gitlab/cli.py
+++ b/gitlab/cli.py
@@ -193,7 +193,7 @@ def main():
# Now we build the entire set of subcommands and do the complete parsing
parser = _get_parser(gitlab.v4.cli)
try:
- import argcomplete
+ import argcomplete # type: ignore
argcomplete.autocomplete(parser)
except Exception:
diff --git a/gitlab/client.py b/gitlab/client.py
index 43cee10..910926a 100644
--- a/gitlab/client.py
+++ b/gitlab/client.py
@@ -25,7 +25,7 @@ import gitlab.config
import gitlab.const
import gitlab.exceptions
from gitlab import utils
-from requests_toolbelt.multipart.encoder import MultipartEncoder
+from requests_toolbelt.multipart.encoder import MultipartEncoder # type: ignore
REDIRECT_MSG = (
diff --git a/test-requirements.txt b/test-requirements.txt
index 8d61ad1..53456ad 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -1,6 +1,7 @@
coverage
httmock
mock
+mypy
pytest
pytest-cov
responses
diff --git a/tox.ini b/tox.ini
index ba64a43..826e081 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,7 +1,7 @@
[tox]
minversion = 1.6
skipsdist = True
-envlist = py39,py38,py37,py36,pep8,black,twine-check
+envlist = py39,py38,py37,py36,pep8,black,twine-check,mypy
[testenv]
passenv = GITLAB_IMAGE GITLAB_TAG
@@ -35,6 +35,13 @@ deps = -r{toxinidir}/requirements.txt
commands =
twine check dist/*
+[testenv:mypy]
+basepython = python3
+deps = -r{toxinidir}/requirements.txt
+ -r{toxinidir}/test-requirements.txt
+commands =
+ mypy {posargs}
+
[testenv:venv]
commands = {posargs}