PyCharm: how do I ignore the installed copy of my project?
Let's say I'm working on a Python project that uses a setup.py or a PEP 517 compliant build process (in short, properly packageable and installable), that contains a package `foo`.
Now, if this project is _installed_ into the interpreter I'm using in PyCharm (e. g. installed into the virtualenv, or installed system-wide if I'm on Linux and not using a virtualenv at all), how do I make PyCharm ignore the _installed_ copy of the package `foo`?
Currently, if I point PyCharm to a usage of `foo.MyClass.my_method()` and click Go To Declaration, it will show me two copies of `my_method()` — one belonging to the loaded project, and the other one belonging to the installed copy of the same project. This is annoying, especially when I'm in the middle of refactoring. How do I make PyCharm hide or ignore the second one?
请先登录再写评论。
1. When searching for usages, you can select the scope, e.g. "Project files" should exclude any references from site-packages.
2. Try installing the package as editable, i.e. `pip install -e` if you haven't already.
3. When installing the package, it may leave the `build` directory. Make sure to mark it as excluded or remove it.
If it's not helping, could you provide a screenshot of the duplicated entries in the usage list?
I'm having the same issue with remote development