Problems using different source and install paths

I am having some difficulties using PyCharm in my pre-existing Python environment, where the Python code I'm working with has different source paths and install paths.

Let's say there are four files:

1.  $HOME/worktree/src/module_a/python/foo.py

2.  $HOME/worktree/src/module_b/python/bar.py

3.  $HOME/worktree/install/lib/python/a/foo.py

4.  $HOME/worktree/install/lib/python/b/bar.py

When doing editing and source code checkouts, I use the paths under src (1 and 2).  But when Python code runs, $HOME/worktree/install/lib/python is in $PYTHONPATH (3 and 4).

An additional complexity is that our 'make install' creates hard links when it copies the files over.  That is, both foo.py's (1 and 3) are the same actual file on disk, and same with the bar.py's (2 and 4).

This produces weirdness when working with things in PyCharm.  I originally just added the src/ paths to the project.  This let me do basic editing and check changes back into Subversion.  But when I tried running the code in the debugger, it got ugly, because the debugger file paths were the ones in the install/ tree.  Thus PyCharm was seeing two copies of what I consider to be the same files.  And when I'd make a code change to one foo.py, PyCharm would warn me that the other foo.py had also changed, since both files share the same timestamp in the system.  I haven't even yet tried to do fancy refactorings, etc. that require deep module awareness.

I realize that my Python environment may seem strange.  But up until now it hasn't been a problem; we've just been using plain text editors, so there was nothing to get confused.  And really, it's similar to the way we treat our C/C++ code.

Is there a way to make this stuff work gracefully?  Or is it simply unreasonable to expect an IDE to work properly with this kind of setup?

0

Please sign in to leave a comment.