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

add static typecheck system to poetry #114

Merged
merged 10 commits into from
Jun 30, 2023
Merged

add static typecheck system to poetry #114

merged 10 commits into from
Jun 30, 2023

Conversation

andrewj-brown
Copy link
Member

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
Copy link
Member Author

once more, this time with feeling...

@49Indium
Copy link
Member

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
Copy link
Member Author

andrewj-brown commented Jun 28, 2023

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 andrewj-brown marked this pull request as ready for review June 28, 2023 00:45
@andrewj-brown
Copy link
Member Author

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 andrewj-brown changed the title add static typechecks add static typecheck system to poetry Jun 28, 2023
Copy link
Member

@49Indium 49Indium left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Take everything I say with a pinch of salt, as I'm still learning good coding practices. Here are my 2 cents.

Overall, very happy to see some typechecks.

uqcsbot/bot.py Outdated Show resolved Hide resolved
uqcsbot/models.py Show resolved Hide resolved
uqcsbot/models.py Show resolved Hide resolved
Copy link
Member

@JamesDearlove JamesDearlove left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

.github/workflows/typecheck.yml Outdated Show resolved Hide resolved
.github/workflows/typecheck.yml Show resolved Hide resolved
uqcsbot/advent.py Outdated Show resolved Hide resolved
@andrewj-brown
Copy link
Member Author

andrewj-brown commented Jun 29, 2023

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.

Copy link
Member

@JamesDearlove JamesDearlove left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good to me. Still have a lock file warning in the checks though. Action log link

@andrewj-brown andrewj-brown merged commit e1d3c25 into main Jun 30, 2023
@andrewj-brown andrewj-brown mentioned this pull request Jul 1, 2023
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants