How to type hint a dictionary with values of different types

You are looking for TypedDict. It is currently only a mypy-only extension, but there are plans to make it an officially sanctioned type in the near-future. I am not sure if PyCharm supports this feature yet, though. So, in your case, you’d do: from mypy_extensions import TypedDict RectangleElements = TypedDict(‘RectangleElements’, { ‘front’: Line, ‘left’: Line, … Read more

Pycharm environment different than command line

.bash_profile is being read by bash (your command line interpreter) only. However if you want to preserve bash environment for PyCharm there is one true Linux way. Run PyCharm from your command line (from bash). Thus environment variables will be inherited from bash to pycharm. Read $man environ for information on linux environment inheritance process. … Read more

PyCharm noinspection for whole file?

Is it possible to disable an inspection for the whole file in PyCharm? Yes. NOTE: This answer is for this quoted question only (and not about “Maybe there’s another way to fix these problems? Maybe I’m using py.test incorrectly?”). Settings/Preferences | Appearance & Behavior | Scopes Create a new scope that would include such “unwanted” … Read more

Change file type in PyCharm

Settings (Preferences on Mac) | Editor | File Types | Text Check patterns there (bottom list) — you must have had testTreeGen or similar pattern. Just remove it. UPDATE 2021-02-28: Since 2020.3 version you should also check under Auto-detect file type by content file type. See a bit more / with screenshots in this answer: … Read more

Add directory to Python path in PyCharm?

You can add custom paths this way. Go to File->Settings->project Interpreter In the Project-Interpreter field, click the down facing arrow and select “show All” In that Menu, highlight your interpreter and then in the right menu, select the button “Show paths for the selected interpreter” (this is the last button) click the plus symbol to … Read more