Yesterday, I edited the `bin/activate` script of my virtualenv so that it sets the `PYTHONPATH` environment variable to include a development version of some external package. I had to do this because the setup.py of the package uses distutils and does not support the `develop` command à la setuptools. Setting `PYTHONPATH` works fine as far as using the Python interpreter in the terminal is concerned.
However, just now I opened the project settings in PyCharm and discovered that PyCharm is unaware of the external package in question - PyCharm lists neither the external package nor its path. Naturally, that's because PyCharm does not (and cannot reliably) parse or source the `bin/activate` script. I could manually add the path in the PyCharm project settings, but that means I have to repeat myself (once in `bin/activate`, and again in the PyCharm project settings). That's not DRY and that's bad.
Creating, in site-packages, a symlink that points to the external package is almost perfect. This way, at least the source editor of PyCharm can find the package and so does the Python interpreter in the terminal. However, somehow PyCharm still does not list the package in the project settings and I'm not sure if it's ok to leave it like that.
So how can I add the external package to my virtualenv/project in such a way that…
1. I don't have to repeat myself; and…
2. both the Python interpreter and PyCharm would be aware of it?
How do I add paths to my virtualenv so that both PyCharm and the interpreter can find the external packages?