Skip to content

Commit

Permalink
feat: common mypy configuration file
Browse files Browse the repository at this point in the history
  • Loading branch information
goerlibe committed Sep 11, 2023
1 parent 60f5ad1 commit 89971d0
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 5 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ jobs:
run: pip install -r requirements.txt

- name: "Run MyPy Type Checker - DiscoPoP Explorer"
run: python -m mypy -p discopop_explorer
run: python -m mypy --config-file=mypy.ini -p discopop_explorer

- name: "Run MyPy Type Checker - DiscoPoP Library"
run: python -m mypy -p discopop_library
run: python -m mypy --config-file=mypy.ini -p discopop_library

- name: "Run MyPy Type Checker - DiscoPoP Profiler"
run: python -m mypy -p discopop_profiler
run: python -m mypy --config-file=mypy.ini -p discopop_profiler

- name: "Run MyPy Type Checker - DiscoPoP Wizard"
run: python -m mypy -p discopop_wizard
run: python -m mypy --config-file=mypy.ini -p discopop_wizard

- name: "Check formatting of DiscoPoP Explorer"
run: python -m black -l 100 --check discopop_explorer
Expand Down
4 changes: 3 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ repos:
rev: 'v1.5.1' # Use the sha / tag you want to point at
hooks:
- id: mypy # run mypy
#args: [--strict, --ignore-missing-imports]
args: [--config-file=mypy.ini, --ignore-missing-imports]
#additional_dependencies: [dep==version.version.version, ...]
# NOTE: pre-commit runs mypy in a virtualenv, so dependencies are not installed unless explicitly listed here
# TODO: how do we manage the dependencies?

# Using this mirror lets us use mypyc-compiled black, which is about 2x faster
# more info: https://github.com/psf/black/blob/main/docs/integrations/source_version_control.md
Expand Down
43 changes: 43 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# This file is part of the DiscoPoP software (http://www.discopop.tu-darmstadt.de)
#
# Copyright (c) 2020, Technische Universitaet Darmstadt, Germany
#
# This software may be modified and distributed under the terms of
# the 3-Clause BSD License. See the LICENSE file in the package base
# directory for details.

# this file specifies common mypy options for the DiscoPoP project
# call mypy with `--config-file=mypy.ini`
# check https://mypy.readthedocs.io/en/stable/config_file.html for more details

[mypy]
# select files to check
files = discopop_explorer, discopop_library, discopop_profiler, discopop_wizard

# helps to catch typos in this file
warn_unused_configs = True
# the following options should be enabled one by one, then we will switch to `strict` type checking:

#warn_redundant_casts = True

#disallow-any-generics
#disallow-subclassing-any
#disallow-untyped-calls
#disallow-untyped-defs
#disallow-incomplete-defs
#check-untyped-defs
#disallow-untyped-decorators
#warn-unused-ignores
#warn-return-any
#no-implicit-reexport
#strict-equality
#extra-checks

# while we transition to --strict, we will allow project-specific settings, later everything should be strictly checked
[mypy-discopop_explorer.*]

[mypy-discopop_library.*]

[mypy-discopop_profiler.*]

[mypy-discopop_wizard.*]

0 comments on commit 89971d0

Please sign in to comment.