bot icon indicating copy to clipboard operation
bot copied to clipboard

Add a !mypy command

Open ionite34 opened this issue 2 years ago • 3 comments

Proposal to add a !mypy command

Works like !eval or !timeit but instead of running the file, run a mypy type check on the file using snekbox and return the stdout results.

Discussions on mypy results and inferrable types are pretty common, and usually means copying the output of mypy to paste with code in a discussion, having a command would encourage reproducible examples (like eval does)

Depends on

  • https://github.com/python-discord/snekbox/pull/159
  • https://github.com/python-discord/bot/pull/2326
  • Add mypy to our snekbox deployment venv

ionite34 avatar Dec 22 '22 04:12 ionite34

Related: #1880

wookie184 avatar Dec 22 '22 13:12 wookie184

Related: #1880

Hm, do you think we should just give a way for users to specify a -m? That would allow stuff like mypy and flake8 without adding new commands. It would just need for those modules to be added to snekbox.

!e -m mypy
# code to check with mypy
!e -m flake8
# code to check with flake8

we can continue to default the first block as main.py and append main.py to the end of the arguments

ionite34 avatar Dec 23 '22 01:12 ionite34

Dedicated commands would make it easier to add special casing to commands, which we may need (e.g. to provide default settings, maybe allow users to change settings, and maybe for formatting the output).

Commands are more "standard" so e.g. they would work with the !help command by default.

wookie184 avatar Dec 29 '22 14:12 wookie184

Closing as a duplicate of https://github.com/python-discord/bot/issues/1880, since it's still not approved I think it makes sense to keep discussion in once place.

wookie184 avatar Apr 19 '24 17:04 wookie184