-
Notifications
You must be signed in to change notification settings - Fork 499
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
[feature] Type Hints #2536
Comments
it would be highly appreciated! Tag me as reviewer. If possible, work with the pp3 dev release. |
Perfect then I will start with the PR.
|
yes develop. or does it make sense for you to not support python 3.8 and work directly in python_313? |
Python 3.8 ended Like 4 months ago: https://endoflife.date/python I would suggest to not officially support it anymore. One big question, can you do it smaller pieces? Like maybe File by File? Otherwise Changes in between will lead to a Lot of conflicts... |
Python Version
In that case I would prefer to use features which aren't available in Python 3.8 and would support Python >= 3.9. For me both is fine, having the branch The most relevant type hinting features are in my opinion: 3.8from typing import List, Optional
def foo(l: List[int], o: Optional[int] = None) -> int:
return sum(l) + (o or 0) 3.9from typing import Optional
def foo(l: list[int], o: Optional[int] = None) -> int:
return sum(l) + (o or 0) 3.10def foo(l: list[int], o: int | None = None) -> int:
return sum(l) + (o or 0) Split PR size
Yes I totally agree. I would start with the functions most often used by the users e.g. |
Feature Checklist
Searched the issues page for similar feature requests
Read the relevant sections of the documentation
Browse the repository, tutorials and tests for already existing functionalities
Feature Type
Adding new functionality to pandapower
Changing existing functionality in pandapower
Removing existing functionality in pandapower
Problem Description
pandapower provides type information in the doc-strings e.g.
pandapower/pandapower/create.py
Line 37 in 01d80e6
It would be helpful to also have type hints in the code for function parameters and return types.
Feature Description
Add PEP484 type hints to functions etc.
IDEs like VS Code and PyCharm understand these type hints and can support with linting.
E.g.
becomes
Since the smallest Python version currently supported by pandapower is 3.8, it would be needed to stick to type hints compatible with Python 3.8 e.g.
instead of
I think it would be sufficient to add type hints to functions which are most frequently used by users e.g. in
pandapower/pandapower/create.py
for now.Is there principal interest in this feature?
If yes I can start making PRs for this.
It would also be possible to use static type checking with mypy to validate the type hints but this is fully optional.
Additional Context
No response
Label
The text was updated successfully, but these errors were encountered: