Skip to content

Conversation

@isaaccorley
Copy link
Collaborator

No description provided.

- torchmetrics>=1.6.2
- torchvision>=0.18
exclude: (build|data|dist|logo|logs|output)/
exclude: (build|data|dist|logo|logs|output|docs/user/metrics)/
Copy link
Member

Choose a reason for hiding this comment

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

Any reason why docs/user/metrics needs to be excluded? I think it's passing.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It wasn't passing mypy for me locally. I can paste the errors.

Copy link
Member

Choose a reason for hiding this comment

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

Please do. It's passing in CI. Maybe the min version of mypy in pre-commit needs to be bumped?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Mainly the errors were around not having request mypy stubs. But maybe it's just a local thing

Copy link
Member

Choose a reason for hiding this comment

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

Ah, that's something we set in pyproject.toml:

ignore_missing_imports = true

but pre-commit refuses to support pyproject.toml so we have to duplicate every single flag. Basically, there's a flag for this. Technically we should also add --strict, may require a couple overrides though.

Copy link
Collaborator

@ashnair1 ashnair1 Nov 4, 2025

Choose a reason for hiding this comment

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

So pre-commit creates a separate environment to run the checks. Hence why the additional dependencies are needed. These deps are installed in that environment and the checks are run.

So the request errors should be resolved by adding types-requests to mypy's additional_dependencies.

Copy link
Member

Choose a reason for hiding this comment

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

We should probably add a bunch of stub packages as testing deps. I wish these were within the requests source code, but at least someone wrote a stub.

@adamjstewart adamjstewart requested a review from ashnair1 November 3, 2025 16:05
@adamjstewart adamjstewart added this to the 0.8.0 milestone Nov 3, 2025
Copy link
Collaborator

@ashnair1 ashnair1 left a comment

Choose a reason for hiding this comment

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

I was able to get pre-commit to pass by adding types-requests to additional_dependencies and fixing (and ignoring) some typing errors in update_github.py and update_downloads.py

@adamjstewart
Copy link
Member

I would like to keep pre-commit matching direct invocation of mypy. So we either ignore missing imports in pre-commit like we do in mypy, or we add type stubs to both.

@isaaccorley isaaccorley force-pushed the misc/precommit-update branch from cb36125 to 619b072 Compare November 4, 2025 17:10
@adamjstewart adamjstewart mentioned this pull request Nov 5, 2025
@adamjstewart adamjstewart modified the milestones: 0.8.0, 0.8.1 Nov 11, 2025
@calebrob6
Copy link
Collaborator

This is a minor thing that we should just merge

@adamjstewart
Copy link
Member

Not user facing so doesn't matter which release it goes into. Would like to sort out the type stubs stuff separately from updating dependencies here.

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.

4 participants