Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Enhancing PyCharm with These 14 Essential Plugins

Tech May 14 1

If I had to recommend one indispensable plugin for beginners using PyCharm, it would be Key Promoter X.

This tool acts as a shortcut manager that:

  • Teaches you which keyboard shortcut can replace your current mouse action for better efficiency.
  • Reminds you if a particular operation hasn't been assigned a keyboard shortcut yet.

With Key Promoter X, you'll quickly become proficient with keyboard shortcuts, making mouse usage less necessary.

For example, when using the mouse to open Find in Path, it will show a popup in the bottom right corner indicating the corresponding shortcut.

2. Vim Support in PyCharm

In most scenarios, keyboard shortcuts are more efficient and precise than mouse operations (assuming you're already proficient with them). This is undeniable.

Vi/Vim meets all your text manipulation needs, offering greater efficiency and a more geeky approach compared to visual interfaces. If you're a dedicated Vim user like me, installing the ideaVim plugin after setting up PyCharm is a must. It allows you to use Vim commands within PyCharm.

Installation steps:

  1. Install via the plugin marketplace.
  2. Restart PyCharm for changes to take effect.

3. Markdown Support in PyCharm

Formatting documents with rich text is often frustrating. For programmers, Markdown is the best choice for documentation. All my blog posts and journals are written in Markdown.

Code repositories on GitHub typically include a README.md file, which is a Markdown document.

PyCharm does not come with Markdown support by default, so Markdown files appear as plain text. To view them properly, install the Markdown support plugin.

Two installation methods:

  1. When opening an MD file, PyCharm will prompt you to install the plugin.
  2. Search and install from the plugin marketplace.

4. Jupyter Notebook Integration

Before using Jupyter, install it first:

$ pip install jupyter

Create a new notebook following the instructions shown in the interface to start working.

The UI may differ slightly from standard Jupyter, but functionality remains consistent. Remember these three key shortcuts (Mac-specific, Windows versions vary):

  • Ctrl+Enter: Run current cell
  • Option + Shift + Enter: Debug current cell
  • Shift + Enter: Insert new cell

Once installed, the Python Console automatically switches to Jupyter mode.

5. Regex Tester

Regex Tester is a third-party plugin enabling regex testing within PyCharm.

Install via the plugin marketplace and access through the left-bottom rectangle button in the interface after installation.

After launching, you can test regular expressions. Highlighted matches appear in the results panel. Additional options include case sensitivity and multiline mode. Features also include split and replace functions.

6. Bash on Windows

Windows Command Prompt differs from Linux shell commands. For instance, listing files uses dir on Windows versus ls -l on Linux.

For those accustomed to Linux, Windows' CMD offers a poor experience.

Using Bash provides a comfortable environment where Linux commands work seamlessly.

7. Auto PEP8 Formatting

PEP8 is Python's official style guide. Newcomers might prefer tools like autopep8 to handle code formatting.

Install globally:

$ sudo pip install autopep8

Configure in PyCharm:

Name: AutoPep8
Description: autopep8 your code
Program: autopep8
Arguments: --in-place --aggressive --aggressive $FilePath$
Working directory: $ProjectFileDir$
Output filters: $FILE_PATH$:$LINE$:$COLUMN$:.*

Right-click on a file and select External Tools -> AutoPep8. The difference is noticeable.

While PyCharm has built-in formatting (shortcut: Cmd+Opt+L), autopep8 offers more thorough cleanup.

8. RESTful API Testing

PyCharm includes a built-in tool for testing RESTful APIs with features like GET, POST, PUT, etc., along with sections for headers, parameters, body, response data, and headers.

To demonstrate, create a simple Flask endpoint:

from flask import Flask, request

app = Flask(__name__)

@app.route('/hello')
def index():
    name = request.args.get('name')
    return 'Hello, ' + name

if __name__ == '__main__':
    app.run()

Run the server at http://127.0.0.1:5000/. Access the REST tool via the menu and enter the URL. Click the run button to send requests.

9. Execute Selection in Console

Instead of creating temporary files or using Python Shell, try Execute Selection in Console.

Select code in your editor, right-click, and choose Execute Selection in Python Console or use the shortcut Option + Shift + E (Windows: Alt + Shift + E). PyCharm handles indentation automatically.

10. CodeGlance

If you're familiar with Sublime Text's minimap feature, you'll appreciate this plugin for PyCharm. It adds a preview scrollbar to the side.

Install CodeGlance to enjoy this functionality.

11. Chinese Localization

Many beginners find PyCharm's English interface intimidating. JetBrains now offers an official Chinese plugin named Chinese, with over 400k downloads.

Install via the plugin marketplace and restart PyCharm. The entire interface will switch to Chinese.

12. Performance Profiling

PyCharm supports profiling to identify performance bottlenecks in Python applications.

Example script:

import time

def fun1():
    time.sleep(1)

def fun2():
    time.sleep(1)

def fun3():
    time.sleep(2)

def fun4():
    time.sleep(1)

def fun5():
    time.sleep(1)
    fun4()

fun1()
fun2()
fun3()
fun5()

Run Profile 'Program' from the Run menu. Results show function call counts, total time, and own time in milliseconds. A call graph visualizes function relationships and execution times.

13. JSON Parser

Use the JSON Parser plugin to validate and format JSON strings direct in PyCharm.

Install from the marketplace and restart PyCharm. You'll see a new tab in the right sidebar for JSON parsing.

14. Static Code Inspection

Though Python is interpreted, static analysis helps catch hidden bugs early.

Enable via Inspect Code in the context menu. PyCharm will analyze your project and report issues. Even large projects like Nova show thousands of potential issues.

Tags: PyCharm

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

Implement Image Upload Functionality for Django Integrated TinyMCE Editor

Django’s Admin panel is highly user-friendly, and pairing it with TinyMCE, an effective rich text editor, simplifies content management significantly. Combining the two is particular useful for bloggi...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.