-
Notifications
You must be signed in to change notification settings - Fork 192
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 type annotations to nf-core/tools #2200
Comments
quick question, do I provide types for variable declarations as well? For example in the nf-core/tools/nf_core/components/components_command.py at line 60 we have: local_component_dir = Path(self.dir, self.component_type, "local")
# should I convert it to
local_component_dir : Path = Path(self.dir, self.component_type, "local")
# ?
# If so, I will try to do it for every declaration |
yeah, looks good to me. |
Since this is a bigger task, we probably should only convert one file at a time, to keep track of when something breaks |
Type (almost) annotations are always good to have. I find the most useful places to have them in functions and methods that are used by others - be it in the codebase or users of a module or package. On a side-note: please make sure to use Python 3.7 to check the type annotations locally, if you do, because we still officially support it. Otherwise it will be easy to use newer capabilities of Python that won't work in all cases. |
To add an example, this would be a function that is used in an nf-core command. |
FYI: I am currently doing a large rewrite of the I am happy to add the types to that one later in a separate PR, since I anyway now have a quite good understanding of the implementation. |
First PR (#2223) merged. |
Submitted #2483 to implement PyUpgrade in pre-commit |
Description of feature
Typed Python will improve the development experience (and hopefully the code quality).
Intro to types in python: https://fastapi.tiangolo.com/python-types/
Tools we should add:
To lower the work load we will do it file by file (if possible)
Active PRs
The text was updated successfully, but these errors were encountered: