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

Mypy is failing while checking finetune_eval.py #1733

Open
vectorvp opened this issue Nov 13, 2024 · 7 comments
Open

Mypy is failing while checking finetune_eval.py #1733

vectorvp opened this issue Nov 13, 2024 · 7 comments

Comments

@vectorvp
Copy link
Contributor

As long as there is duplicated naming of finetune_eval in benchmarks/imagenet/resnet50/finetune_eval.py and benchmarks/imagenet/vitb16/finetune_eval.py mypy throws an exception when running pre-commit run --all-files:

benchmarks/imagenet/vitb16/finetune_eval.py: error: Duplicate module named "finetune_eval" (also at "benchmarks/imagenet/resnet50/finetune_eval.py")
benchmarks/imagenet/vitb16/finetune_eval.py: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#mapping-file-paths-to-modules for more info
benchmarks/imagenet/vitb16/finetune_eval.py: note: Common resolutions include: a) using `--exclude` to avoid checking one of them, b) adding `__init__.py` somewhere, c) using `--explicit-package-bases` or adjusting MYPYPATH
Found 1 error in 1 file (errors prevented further checking)

There are 3 solutions:

  • Change the namings;
  • Add init.py to form packages;
  • Add the workaround to contributing manual.
@guarin
Copy link
Contributor

guarin commented Nov 13, 2024

Thanks for raising the issue! Mypy should actually only check the src and tests directories. This seems like an error in the pre-commit configuration

@vectorvp
Copy link
Contributor Author

vectorvp commented Nov 14, 2024

@guarin, as long as there is no src, I think it should be configured to check only tests. I will make a PR to fix this.

@gurain
Copy link

gurain commented Nov 14, 2024

,只要没有 src,我觉得应该配置成只检查 tests。我将制作一个 PR 来解决这个问题。

haha, friend, you quoted the wrong person

@vectorvp
Copy link
Contributor Author

@gurain, 对不起!

@vectorvp
Copy link
Contributor Author

@guarin, if I set mypy to analyze only tests it throws a lot of error from this folder. If I understand correctly you have a TODO in pyproject.toml to empty the exclude list. I can take some files from there and exclude them one by one if it is OK.

@guarin
Copy link
Contributor

guarin commented Nov 18, 2024

Hi, yes we have an issue to increase typing coverage: #1635

@vectorvp
Copy link
Contributor Author

@guarin, great, I will work on it.

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

No branches or pull requests

3 participants