Acellera / htmd

HTMD: Programming Environment for Molecular Discovery
https://software.acellera.com/docs/latest/htmd/index.html
Other
261 stars 59 forks source link

Do not clobber the "glob" function #961

Closed tonigi closed 4 years ago

tonigi commented 4 years ago

https://github.com/Acellera/htmd/blob/d8b7b249a839c38570b6275fde934e48f7d569a3/htmd/ui.py#L71

This exports "glob" as a function in the user namespace, which is unexpected. E.g.

import glob
from htmd.ui import *

glob.glob(..) # <- this fails
stefdoerr commented 4 years ago

we always use just the glob function of the glob module. Do you use any other?

tonigi commented 4 years ago

Internally I agree. But that alters the behaviour in user code. E.g., as a user

import glob

#my code uses glob.glob and works

then

import glob
from htmd.ui import *

#my code is unchanged and yet it does not work any more

and then

from htmd.ui import *
import glob

#my code is still unchanged and now works again
stefdoerr commented 4 years ago

Unfortunately all the tutorials of HTMD use glob as a function so we would need to change those as well. I would say that at the point where you have your own code with glob.glob you should not import * anymore anyway and import individual modules of HTMD

stefdoerr commented 4 years ago

I will close this issue since we are not planning on changing this behaviour. Same thing would happen if the user was doing from glob import glob and we did import glob so it's a decision we will have to live with.