Unresolved attribute reference. Distutils-aware inspection?

Greetings,

I'm currently trialing PyCharm and wanted to explore some existing code with it. The code in question is http://sourceforge.net/projects/supybot/ for which the directory layout in the distribution archive differs from the post-installation directory layout. Now, when exploring the distribution archive content, PyCharm's inspection fails to resolve functions that rely on imports which would only work after installation. How do you guys usually deal with a situation like this? I assume, supybot is not the only project where this issue of different file locations applies. Do you simply run setup.py to get the final directory layout or can PyCharm be made to evaluate a distutil-based setup.py (and thus determine the file locations within the distribution archive)?

A specific example from the supybot sources:

1) Distribution archive has a "src" directory for which the installation destination is "supybot" (cf. setup.py + package_dir)

2) RSS\plugin.py imports supybot.callbacks as callbacks

3) RSS\plugin.py uses callbacks.plugin to derive class RSS

4) RSS\plugin.py PyCharm fails to resolve RSS attributes inherited from callbacks.plugin (e.g. self.registryValue())

Here's a link to the supybot git tree if that makes it easier. http://supybot.git.sourceforge.net/git/gitweb.cgi?p=supybot/supybot;a=tree

Sebastian

4 comments

Please mark the "src" directory as a source root in Settings | Project Structure.

0

Dmitry, marked as requested, attribute still can't be resolved.

What would that do? Add 'src' to the search directories for packages/modules? Note: 'src' doesn't contain a supybot package, but becomes the supybot package after installation.

0

I've looked at it in more detail, and indeed PyCharm does not currently support such project configurations. I've filed a feature request for this:

http://youtrack.jetbrains.net/issue/PY-5533

0

Thanks, Dmitry.

For the time being - and because my first objective is to understand, not modify code -, I've resorted to install supybot and inspect the installed code where the references resolve just fine.

Once it comes to fully working with the raw upstream code tree (editing/VCS integration), your RFE looks like just what's needed though!

0

Please sign in to leave a comment.