Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyCharm mark directory as excluded via flag in the filesystem?

Tags:

pycharm

I would like to exclude some directories as excluded in PyCharm via a flag in the matching directory.

Example: Our tests create a directory called .reports.

I know how to exclude this directory in my PyCharm instance.

But we have many developers and many projects. I really would like to avoid every developer needing to mark this directory as excluded.

Is there a way to tell PyCharm to skip this file?

For example by creating an empty file called ".pycharm-exclude"?

I am looking for an automated way to exclude the directory, since we have several developers and each developer has several projects.

I created a feature request: https://youtrack.jetbrains.com/issue/PY-51093

like image 676
guettli Avatar asked Oct 04 '21 19:10

guettli


People also ask

What does excluded folders mean PyCharm?

PyCharm allows you to exclude directories from consideration when searching and refactoring. You can exclude a directory by right-clicking on it and selecting Mark Directory as → Excluded.

How do I ignore files in PyCharm?

Under the Version Control node, of the Settings dialog box, click Ignored Files. The Ignored Files dialog box opens. You can also add files to ignore list on-the-fly. A new file under the Unversioned Files change list, has Ignore command on its context menu.

How do I change PyCharm save location?

Change the location of IDE directoriesFrom the main menu, select Help | Edit Custom Properties. Specify paths with forward slashes /, including Windows paths (for example, C:/idea/system). After you restart PyCharm, it will use the new location of the corresponding directory.


1 Answers

I don't know of any way similar to an ignore file since it seems PyCharm wants you to use it's GUI for configuration. However, if you're flexible to a different approach...

Take a look at the default file/directory ignore list at Settings | Editor | File Types | Ignore files and subfolders

You can rename .reports -> .reports~, .reports.pyc, .reports.rbc, .svn, etc. and PyCharm will ignore it.

By default PyCharm ignores a number of patterns/names because they are common non project names. If you name a directory something which matches one of those patterns/names then you can trick PyCharm into ignoring that directory. There are ~20 patterns/names which are ignored by default (found at the path above) so I'd choose whatever creates the least confusion in the team / prevent some problem I'm unaware of.

If you wanted a more sensible name you could add .report; to this list as this list persists across all projects, but every developer would need to update it once.

For the sake of others who see this, there is also the more common exclude list at Settings | Project: ... | Project Structure | Exclude files, which defaults to empty and does NOT persist across projects

like image 127
nanotek Avatar answered Oct 18 '22 14:10

nanotek