-
Notifications
You must be signed in to change notification settings - Fork 36
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
Adding function annotations and type-hints. #53
Conversation
Thanks for your contribution @alchemistcai . A recurrent error is killing all tests:
I don't use type hints on my daily basis, but I do see the advantage for other developers. So after fixing the tests and new bugs, I'd happy to merge this into main. Since this PR requires a lot of testing and double-checking, I keep this in the fridge until I have some extra time. |
Just entered into linux successfully again.I will fix them and test in linux recently. |
All tests passed now.Phew! |
Thanks @alchemistcai for the heavy work adding type hints to the current code. After a general overview of the changes, this is my opinion:
I think it would be better to use Maybe it is a good time for dropping support for 3.6 and 3.7 since they are or almost deprecated (https://endoflife.date/python). Moreover, Let me know your thoughts, specially on the quotes-hints concern. Cheers! |
I hate quates for type subscriptions too.I tried to |
I use python 3.10 and 3.11 more for type annotations and not sure how to make codes compatible and elegant in python 3.8 at the same time . |
Before changing all the files, let me further investigate this and I will come back to you. As I mentioned in the previous comment, if we could avoid using quotes on 3.8, then it is good for me to just drop support for 3.6 and 3.7 and move on. Replacing |
Getting back to this PR after some time, sorry for the delay @alchemistcai After analyzing pros and cons of type-hints, I come to the conclusion that they add more burden and have real limitations (for example NumPy associated structures). I'd like to ask if it would be possible for you to create a new PR with all changes from this one, but without the type-hints associated code. There are some important fixes from this PR that should be added to the main branch, including |
👌 |
*.pyi
stub files for.c
implementations of scoring functions and other math functions.DockingModel
is a generic type now.Theobjects
attribute ofDockgingModel[DFIREObject]
's subclass is always a list ofDFIREObject
.For type checking and code auto-completion too.[]
are alterd to beNone
,less confusing.__init__
calls of the subclasses ofDockingModel
because of the newmembrane
position parameter.Spacepoints.copy()
toSpacepoints.clone()
in other classes' clone methods.__getitem__
and__setitem__
s'index
parameters are writed to beint
,most of them acceptslice
and return lists of elements though.