mdanalysis
mdanalysis copied to clipboard
Replace custom lib.util.which with shutil.which
Given the newest version of MDAnalysis support Python 3.6+, is it reasonable to replace lib.util.which with shutil.which? They seems to have identical intended uses and functionality. Using the standard library instead of custom code reduces the maintenance burden.
If this is a reasonable/desired change, I'll make a PR performing the replacement.
I realize this is a small nitpick, but I found it while reading the codebase and would like to take this opportunity to become a contributor to this project.
Less code is always the best option in my opinion. If they work equally under the OS conditions they are expected to work then I support such a change.
I think we would then
- replace the
lib.util.whichfunction withshutil.whichand add a deprecation note (to be removed in 3.0) - replace all use of
lib.util.whichwithshutil.whichacross the library (so that we don't trigger our own deprecation warning)
Since no PR has been opened for this, I would like to work on this issue. @orbeckst please let me know how and where should the note be added once we replace the usage of lib.util.which with shutil.which.
You need to keep lib.util.which() but decorate it with our deprecated decorator (see other examples in the code). You’d replace the body of the lib.util.which() function with a call to shutil.which().
The idea is that existing code that uses lib.util.which() will not break but raise a deprecation warning so that people have time to change their code to use shutil.which().