pythonconfigurationpycharmideinit

How to hide the __init__.py in every directory


I have a repo filled with lots of nested directories; in almost everyone, I have a __init__.py file. The problem is it makes it harder to visually search directories for the files, and it was noticeable when the directory only contained 1 Python code file alongside __init__.py

So my question is:

I have tried to exclude it from PyCharm from General > File Types but that breaks the code because it is not simply hiding the files from the codebase.

for reference:

I am new to the project and not so experienced, so hiding the init files will help me to focus only on the code files and folder construction design, and learn about the code that I'm going to deal with, for now.


Solution

  • In JetBrains IDE there is feature called scope. Just go to your project bar, and press three dots: Project bar

    After that press Edit Scopes, you will see this window Edit scope menu

    In this window press + key, choose any type (local for example), enter name of your scope (for me it's test) and in field patter type this !file:*__init__.py. Press Apply and then OK Scope After that in your Project bar you can click on Project and instead of Project choose your scope. That's it Before applying scope After applying scope