Page MenuHomeSoftware Heritage
Paste P671

pre-commit run from within emacs (magit) already connected to virtualenv (`M-x pyvenv swh RET`) for modules with django dependencies, fail to commit on mypy
ActivePublic

Authored by ardumont on May 14 2020, 11:37 AM.
1 git … commit --
Trim Trailing Whitespace.................................................Passed
Flake8...................................................................Passed
Check JSON...........................................(no files to check)Skipped
Check Yaml...........................................(no files to check)Skipped
codespell................................................................Failed
- hook id: codespell
- exit code: 2
swh/deposit/migrations/0018_migrate_swhids.py:68: targetting ==> targeting
swh/deposit/migrations/0018_migrate_swhids.py:107: targetting ==> targeting
mypy.....................................................................Failed
- hook id: mypy
- exit code: 1
Traceback (most recent call last):
File "/home/tony/.virtualenvs/swh//bin/mypy", line 8, in <module>
sys.exit(console_entry())
File "/home/tony/.virtualenvs/swh/lib/python3.7/site-packages/mypy/__main__.py", line 8, in console_entry
main(None, sys.stdout, sys.stderr)
File "mypy/main.py", line 89, in main
File "mypy/build.py", line 180, in build
File "mypy/build.py", line 249, in _build
File "mypy/build.py", line 2596, in dispatch
File "mypy/build.py", line 2754, in load_graph
File "mypy/build.py", line 1852, in __init__
File "mypy/build.py", line 2127, in compute_dependencies
File "mypy/plugin.py", line 717, in get_additional_deps
File "/home/tony/.virtualenvs/swh/lib/python3.7/site-packages/mypy_django_plugin/main.py", line 125, in get_additional_deps
if file.fullname() == 'django.conf' and self.django_context.django_settings_module:
TypeError: 'str' object is not callable
black....................................................................Passed

Event Timeline

ardumont changed the title of this paste from on swh with django dependencies, fail to commit on mypy to pre-commit from within emacs (M-x pyvenv swh RET) with django dependencies, fail to commit on mypy.EditedMay 15 2020, 1:50 PM

Issue is solved if (for deposit and i guess with some adaptations to swh-web) if:

M-: (setenv "DJANGO_SETTINGS_MODULE" "swh.deposit.settings.testing") RET

Strangely though that variable is declared both in the /mypy.ini of those
modules ¯\_(ツ)_/¯

ardumont changed the title of this paste from pre-commit from within emacs (M-x pyvenv swh RET) with django dependencies, fail to commit on mypy to pre-commit run from within emacs (magit) already connected to virtualenv (`M-x pyvenv swh RET`) for modules with django dependencies, fail to commit on mypy.May 15 2020, 1:53 PM