-
Notifications
You must be signed in to change notification settings - Fork 286
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
Type Check Package #1635
Comments
Hey, can I work on this issue ? |
Hey @guarin, some of the mypy tests are failing in local, 48 errors in 23 files in master, do you think I can still push my changes for the fix of some of the files ? |
Hi @ishaanagw! Thanks for contributing, feel free to work on any file :)
Interesting, will have a look at this on Monday. Which mypy version are you using? CI uses mypy 1.4.1 with Python 3.7. The Python version should not be too important. We use 3.7 in CI to make sure we don't introduce any types that are incompatible with old Python versions. |
@ishaanagw I created a PR to fix the failing mypy tests: #1654 |
Wow, that is impressive. |
@ishaanagw I unassigned you from the issue to make it clearer that other people can also work on it. |
can I work on this issue? |
can i work on this ? |
@Prasadayus and @Abhrajitdas02 can you select some files/submodules to work on? I can create other smaller issues and then assign those to you. |
@guarin, hi! I have two questions:
|
These models in Regarding 2) you can just put a local lightly/lightly/models/modules/masked_causal_vision_transformer.py Lines 13 to 14 in ce51134
|
We would like to type check all files in the package. Adding types helps to document the code and makes it easier to use.
How to work on this issue
exclude
section of the mypy settings. There should be a list of files like this:lightly/loss
,lightly/data
,lightly/utils
,lightly/models/modules
, and the corresponding test files. Do not type check deprecated model files inlightly/models
likelightly/models/barlow_twins.py
.mypy <filename>
(make sure that you have installed lightly following the contribution guide). This should show a list with all the missing types/errors.pyproject.toml
and remove the filename of the file you just typed from the mypyexclude
list.Add types for <filename>
and push your changes. Make sure all Github actions pass.Important
Lightly still supports old Python versions (including 3.7, 3.8, and 3.9) that do not work with new typing features introduced in Python 3.10. To use the new Python 3.10 syntax you have to add
from __future__ import annotations
at the top of the file. The following typing features changed in 3.10:str | int
instead ofUnion[str, int]
str | None
instead ofOptional[str]
tuple[str, int]
,list[str]
,dict[str, int]
instead ofTuple[str, int]
,List[str]
,Dict[str, int]
.Please use
from __future__ import annotations
with the new types whenever possible. This will save a lot of refactoring in the future. Also feel free to update files with old types to the new syntax.The text was updated successfully, but these errors were encountered: