ansys / pymapdl

Pythonic interface to MAPDL
https://mapdl.docs.pyansys.com
MIT License
419 stars 118 forks source link

Add Type Hints to all classes, methods and functions. #434

Open jgd10 opened 3 years ago

jgd10 commented 3 years ago

This is a pretty big task, but I think it would be worthwhile to have type hints wherever it is sensible. We already have them in a few places. E.g. in mesh_commands.py

class _MapdlMeshingCommands:

    def n(self, node="", x="", y="", z="", thxy="", thyz="", thzx="",
          **kwargs) -> int:

But ideally type hints should be present on every callable. I think it's a fairly uncontroversial addition, and I am happy to go through and start making these changes, although I don't suspect it'll be done particularly soon!

natter1 commented 3 years ago

Maybe this should be splitt up in small junks to prevent merge-hassle. And mentioning here, who is working on witch file right now. Also, for the APDL-Commands it might be tricky in some cases. For example n(..) -> int should be n(...) -> Optional[int] (#421)

akaszynski commented 3 years ago

Maybe this should be splitt up in small junks to prevent merge-hassle. And mentioning here, who is working on witch file right now. Also, for the APDL-Commands it might be tricky in some cases. For example n(..) -> int should be n(...) -> Optional[int] (#421)

Adding type hints, examples to documentations, etc is a long term goal for this project. What's been done is moving methods that have been refactored or cleaned up to different modules to avoid having them all in one location (as mapdl_functions.py is just huge!).

Splitting this up to do a handful of methods at a time would be great as we can review a PR at a time rather than doing one gigantic refactor.