1

I mostly work on Java/c# before and like the feature these IDEs provide to import the whole project into a workspace tree without messing up all the references (Underlying linker seems to handle them). Is there anything equivalent in python?

I now works on a few different projects in python and realized that referencing each other becomes a nightmare. Either I have to write the absolute path when I do import or I have to copy files / make symlinks (not easily portable to Windows hence platform dependent).

I definitely know symlinking / hard directory links (put the whole directory in import) works but when I have to move files around / switch OS they all break.

Does such thing exist in the Python world? What's the intended way when I have to modularize things into projects and cross-reference something?

(I have read Python: Referencing another project but it doesn't help, any method there brokes when modules are moved to a different place. Really want an automatic solution.)

xxbidiao
  • 834
  • 5
  • 14
  • 27
  • What about manipulating `sys.path`? – MEE Feb 15 '18 at 18:48
  • That's equivalent of `virtualenv`, does no good since if you move a directory your dependency brokes. – xxbidiao Feb 15 '18 at 18:56
  • @xxbiddiao I suppose that there is no really other way then because python imports all modules that are on sys.path. If you have no idea where the modules are (because they might have moved) you are out of luck. In case there are only a few possible places you can manipulate sys.path of course. – MEE Feb 15 '18 at 18:58
  • @MEE Maybe some tools that automatically manipulates sys.path just like what you have with MS c#? In c# with Visual Studio you don't even need to know where a class is provides it's somewhere in the source code tree. – xxbidiao Feb 15 '18 at 19:14
  • 1
    I don't know wether some tool like this would exist but the request for it would be off-topic for SO ;) – MEE Feb 15 '18 at 19:17

0 Answers0