2.24. tool - PyCharm (IDE)

2.24.1. General

  • To comment out lines: ctrl + /

  • To auto PEP8 (code cleanup/format): ctrl + alt + L

  • To enable Crtl+Mouse Wheel text zoom: File > Settings > Editor > General > Mouse > Change Font size…

  • To change max character line: File > Settings > Editor > Code Style > Right Margin (columns) 120 default

  • To search PyCharm commands: ctrl + shift + a

  • To close file tabs: ctrl + F4

  • Expand/Contract Code Blocks for a single code block: ctrl + + and ctrl + - (courser within code block)

  • Expand/Contract Code Blocks for a all code block: ctrl + shift + + and ctrl + shift + -

2.24.2. New Project Setup

  1. If project folder already exists: File > Open > Navigate to folder

  2. Configure your python environment: File > Setting > Project > Project Interpreter > Gear on top right > Add >> Virtualenv Environment > 2 options here…

    1. Create a virtualenv (highly recommended, for pip version control) Either link to an existing virtualenv python.exe (this will be under ProjectNameVenv/Scripts/) or create a virtualenv directly within PyCharm (note that you have to open to inherit all global packages, make sure this is unchecked before creating the virtualenv)

    2. Link to global python interpreter (access to all global pip)

2.24.3. Terminal

  • To configure terminal start directory:

File > Settings > Tools > Terminal > Start directory

  • To configure a custom terminal emulator (like gitbash) inside pycharm terminal tab:

File > Settings > Tools > Terminal > Shell path: "C:\Program Files\Git\bin\sh.exe" --login