Skip to content

Adding type hints and mypy #267

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,19 @@ jobs:
run: pipenv install --dev
- name: Linter with pylint
run: pipenv run pylint meilisearch

mypy:
name: mypy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Install pipenv
uses: dschep/install-pipenv-action@v1
- name: Install dependencies
run: pipenv install --dev
- name: mypy type check
run: pipenv run mypy meilisearch
Comment on lines +54 to +68
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your PR @sanders41!

Can you add the mypy check to bors too?

6 changes: 4 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,20 @@ pipenv install --dev

### Tests and Linter <!-- omit in toc -->

Each PR should pass the tests and the linter to be accepted.
Each PR should pass the tests, mypy type checking, and the linter to be accepted.

```bash
# Tests
docker pull getmeili/meilisearch:latest # Fetch the latest version of MeiliSearch image from Docker Hub
docker run -p 7700:7700 getmeili/meilisearch:latest ./meilisearch --master-key=masterKey --no-analytics=true
pipenv run pytest meilisearch
# MyPy
pipenv run mypy meilisearch
# Linter
pipenv run pylint meilisearch
```

Optionally tox can be used to run test on all supported version of Python and linting.
Optionally tox can be used to run test on all supported version of Python, mypy, and linting.

```bash
docker pull getmeili/meilisearch:latest # Fetch the latest version of MeiliSearch image from Docker Hub
Expand Down
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]
mypy = "*"
pylint = "*"
pytest = "*"
pdoc3 = "*"
Expand Down
111 changes: 104 additions & 7 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions bors.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
status = [
'pylint',
'mypy',
'integration-tests (3.6)',
'integration-tests (3.7)',
'integration-tests (3.8)',
Expand Down
Loading