-
Notifications
You must be signed in to change notification settings - Fork 17
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
No notion of PYTHONPATH in analysis #163
Comments
Need to setup some examples (test cases) here. |
It seems like the default |
Potentially helpful link: https://docs.python.org/3/tutorial/modules.html#the-module-search-path |
@msridhar Looking at the input to WALA, it seems to take a classpath to the analysis engine. In Ariadne's case, it takes a sequence of "scripts." I think the a good part of the problem here is that there is no "project root" input to Ariadne. If I had such an input. I could construct the IR with relative directory names. Currently, if there are two scripts say If, on the other hand, I believe this would also solve #162 as we would incorporate relative directory names and thus each script would be uniquely identifiable. But, this seems different than what is done in WALA. AFAIK, WALA does not have a notion of a root project directory of the analyzed code. So, I suppose this is kind of a design decision. Is there a particular acceptable solution? Does it make sense to have a project root? |
I suppose an alternative to a "project root" would be a |
I'm also unsure what the design decision was regarding feeding the analysis engine each individual file. In WALA, the entire classpath is scanned. Is each file entered in the JavaScript case? If we go with the |
Other static analysis tools of Python, e.g., PyDev, have a notion of "PYTHONPATH," e.g, source folders. I believe that Ariadne only considers the script directory as the PYTHONPATH, but, in fact, it might be elsewhere. In PyDev, the developer sets this. Maybe Ariadne should also have this as input.
Example
Consider the following directory structure:
Currently, if, for example, in
B.py
, we havefrom A import X
, that's valid in both Python and resolves correctly in Ariadne. However, if, for example, inB.py
, we havefrom src.A import X
, if we run Python from the parent directory ofsrc
and setPYTHONPATH=.
, I believe that's valid in Python. However, Ariadne can't resolve this import probably because there's nosrc/src
directory.The text was updated successfully, but these errors were encountered: