UQComputingSociety / uqcsbot-discord

:mortar_board: UQCSbot: Our friendly little Discord bot
https://discord.uqcs.org
MIT License
20 stars 20 forks source link

add static typecheck system to poetry #114

Closed andrewj-brown closed 1 year ago

andrewj-brown commented 1 year ago

From one wide-ranging-dev-changes pull request to the next - now we have code style, I'm starting work on issue #56.

First step: get mypy to not throw errors on the current code, then I'll add a GH workflow for it for future branches. I've based this off the #111 PR branch, because I don't want to bother typing the entire channels cog when it's about to be removed.

andrewj-brown commented 1 year ago

once more, this time with feeling...

49Indium commented 1 year ago

Do we want to use list, tuple, etc instead of List, Tuple, etc. I only learnt recently that are already included (no need for Typing) from Python 3.9 onwards,

andrewj-brown commented 1 year ago

I'm in favour of standardising and using the typing types for everything, rather than mixing and using some inbuilt types and some typing types. If every type that typing includes is now inbuilt then I'm happy to do that, but I suspect there's some missing ones that we'll need.

andrewj-brown commented 1 year ago

I intend to get this PR merged as-is. The changes so far allow use of poetry run pyright uqcsbot to statically typecheck commands, or ... pyright uqcsbot/file.py for specific files.

My intention is to require that pyright types all new modules from here on out, including the proposed pastexams, dominos, morse, etc. rather than merge them now and just leave the typing until later.

andrewj-brown commented 1 year ago

Seems mostly fine, it appears that your poetry.lock needs to be updated though

This PR intentionally updates poetry.lock - we've got 5 new modules for typing and stubs, so I took the opportunity to bump versions on a bunch of other libraries so dependabot stops whinging.