Skip to content
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

mypy setup improvements #356

Merged
merged 2 commits into from
Sep 24, 2024
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
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ repos:
always_run: true

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.1
rev: v1.11.2
hooks:
- id: mypy
files: src
args:
- "--ignore-missing-imports"
- "--ignore-missing-imports" # Not managing to get it to work from pre-commit without this flag
- "--namespace-packages"
- "--explicit-package-bases"
- "--install-types"
Expand Down
11 changes: 7 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,18 @@ $(VENV) :
$(PYTHON) -mvenv $(VENV)
$(VENV)/bin/pip install ruff mypy pylint

lint : venv
lint : build
$(VENV)/bin/ruff check src
$(VENV)/bin/mypy src
# $(VENV)/bin/pylint src
MYPYPATH=src $(VENV)/bin/mypy --namespace-packages --explicit-package-bases --install-types --non-interactive src
@# These options should be the same flags as in .pre-commit-config.yml, except that I can't get it to
@# work there without the "--ignore-missing-imports" flag, while it does work without it here

@# MYPYPATH is needed because apparently some type checking ignores the directory option given as command-line argument
@# $(VENV)/bin/pylint src

test : venv
$(VENV)/bin/pytest -v


release :
@which $(PYTHON) || ( echo 'No executable called "python". Append your python to the make command, like "make PYTHON=your-python"' && false )
[[ -d venv.release ]] && rm -rf venv.release || true
Expand Down
4 changes: 2 additions & 2 deletions src/feditest/nodedrivers/mastodon/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@
m = sys.modules.pop("mastodon")
try:
mastodon_api = importlib.import_module("mastodon")
from mastodon_api import AttribAccessDict, Mastodon
from mastodon_api import AttribAccessDict, Mastodon # type: ignore
finally:
sys.modules["mastodon"] = m
else:
from mastodon import AttribAccessDict, Mastodon
from mastodon import AttribAccessDict, Mastodon # type: ignore


VERIFY_API_TLS_CERTIFICATE_PAR = TestPlanNodeParameter(
Expand Down
Loading