DEV Community

Cover image for 3 Tips to be Effective In Pycharm
Max Ong Zong Bao
Max Ong Zong Bao

Posted on • Originally published at maxongzb.com

3 Tips to be Effective In Pycharm

Introduction

I had been using PyCharm for a very long time whenever I am developing in Python.

It's one of the best IDEs for Python out there that I had encountered.

Which I am coming from realms of Visual Studio, Netbeans & Eclipse in other programming languages.

What blew me away for Visual Studio the most is their debugger & their IntelliSense.

This made me set a high bar for selecting an IDE for any new programming language.

It must have an excellent debugger and great IntelliSense.

Tip 1 - Time Saving Shortcuts

I highly suggest you to look at 42 Tips & Tricks of PyCharm, PyCharm for Productive Python Development or Mastering PyCharm

It gives you a great list of shortcuts that allows you to improve your productivity in PyCharm.

I really like the reformat code button which reformats your code to the coding style you had selected.

Tip 2 - Learn to Use the Debugger

As mentioned, I choose PyCharm as my IDE is because the debugger works like what I had used in the past for visual studio.

Here are the steps to start debugging in Pycharm:

Add a red colour breakpoint by left-clicking your mouse in the line on where you would like the debugger to stop at.

adding breakpoint 1

Now click on the "debugger" button that which is just beside the "run" button for PyCharm to execute in the debug mode.

execute debug mode 1

If you are running the debug mode for the first time. It might prompt you to install something for the debugger to make it run faster.

Now you have a bunch of arrows in the bottom of Pycharm.

Which is called Stepping.

This allows you to step through the execution of your program.

From the line by line (Step Into) execution to jumping directly to the next breakpoint (Step Out).

debugger stepping 1

Tip 3 - Using a Testing Framework

You can choose to change a different testing framework, which the default test runner is unittest.

You do it by going to Settings -> Tools -> Python Integrated Tools -> Default test runner.

Once your there, a prompt will ask you to fix the problem by clicking fix to install the testing framework if you had not done so previously.

change default test runner 1

Another favourite of mine for PyCharm is the autorun test toggle button in the red circle.

toggle auto test 1

This allows you to set time delays to automatically run your test cases, after writing a piece of code which is quite useful for TDD.

Conclusion

I hope the tips are useful for making yourself more productive in using PyCharm.

Besides that regarding on testing portion for PyCharm. You can look at a video called Productive pytest with PyCharm that is created by both Jetbrians and Brian Okken.

Brian is the author of the book called Python Testing with pytest.

I pick up a few neat tricks in Pycharm when I'm selecting the default test runner as Pytest.

Especially the part in adding the verbose option when running test cases for it.

If you like this article sign up for my Adventurer's Newsletter for a weekly update in the area of Python, Startup and Web Development.

You can also follow me to get the latest update of my article on Dev

The original post was on 3 Tips to be Effective In Pycharm - Reading Time: 3 Mins and cover image by Photo by Web Donut on Unsplash

Reference

Top comments (0)