Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Hands-On Application Development with PyCharm
Hands-On Application Development with PyCharm

Hands-On Application Development with PyCharm: Build applications like a pro with the ultimate python development tool , Second Edition

Arrow left icon
Profile Icon Bruce M. Van Horn II Profile Icon Quan Nguyen
Arrow right icon
$19.99 per month
Full star icon Full star icon Full star icon Full star icon Half star icon 4.8 (4 Ratings)
Paperback Oct 2023 652 pages 2nd Edition
eBook
$24.99 $36.99
Paperback
$45.99
Subscription
Free Trial
Renews at $19.99p/m
Arrow left icon
Profile Icon Bruce M. Van Horn II Profile Icon Quan Nguyen
Arrow right icon
$19.99 per month
Full star icon Full star icon Full star icon Full star icon Half star icon 4.8 (4 Ratings)
Paperback Oct 2023 652 pages 2nd Edition
eBook
$24.99 $36.99
Paperback
$45.99
Subscription
Free Trial
Renews at $19.99p/m
eBook
$24.99 $36.99
Paperback
$45.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
Table of content icon View table of contents Preview book icon Preview Book

Hands-On Application Development with PyCharm

Introduction to PyCharm – the Most Popular IDE for Python

Welcome to the second edition of Hands-On Application Development with PyCharm! Most programmers have the objective to build robust, high-quality software that can stand the test of time. The most important step to reach this goal is choosing the correct language. With so many languages out there, which is the best one to choose? A stellar programmer will take many things about the language into consideration. One of the most important aspects of the programming language to consider is the support tools that are necessary for the development stages. The Python programming language is rumored to enable great productivity compared to many other languages. Python’s famous batteries included philosophy embodies this idea by bundling a powerful standard library, a code editor, and a debugger. Everything is built into the language’s normal installer, which is available from https://www.python.org. There’s just one small problem, at least for me – Microsoft.

I know what you’re thinking. You’ve just mentally prepared yourself for a protracted rant from one of those Unix/Linux guys complaining about the big, bad evil that is Microsoft. I’m not going to do that because I’m not sure I’m a Linux guy. I mean, I do have an awful lot of cargo pants in my closet. I can’t help it. They’re just so roomy and you can carry all of your stuff without dragging a bag around with you. I’ll also admit to having a great many T-shirts with emblems, logos, or statements that maybe only 5% of the people I encounter will understand. These T-shirts are very funny, but the only grins I get are from my colleagues. The more I think about it, I’m not a Linux guy. To me, Linux is a tool. Sometimes, it’s the right one, but sometimes, it isn’t. Since I’m not a Linux fanboy, that can’t be the reason for my statement that Microsoft is the problem. The real reason is quite the opposite. About 30 or so years ago, Microsoft did something massively right. They created the first really good commercially available integrated development environment (IDE).

In truth, it may have been more than 30 years ago, and there may have been others before it. However, many “senior developers” in the software business today got their start with a Microsoft product called Visual Basic (VB). OK; this is the part where the language snobs sneer and hold their noses as though they were just presented with a plate of Brussels sprouts, or maybe a dirty diaper, but let’s reel it back in. 30 years ago, most people rocking home computers only had a handful of options. Beginners All-Purpose Symbolic Instruction Code (BASIC) shipped with just about every computer made from 1978 forward. It was an age when not even Apple had a graphical user interface (GUI) on their operating system (OS). That didn’t happen until 1983 when Apple released Lisa. We had mice, and we could create programs capable of working with pointing devices, but the OS didn’t have a windowing system. They didn’t need a windowing system because back then, computers could only run one program at a time.

Writing desktop software for computers that lacked OS-level support for Windows was hard. There were no software development kits (SDKs) or application programming interfaces (APIs) to handle any of the heavy lifting. Writing software was mostly an exercise in tedium. You had to write hundreds of lines of box-drawing boilerplate code in a tool that was barely better than Notepad. Then, one day in 1991, the year I graduated from the University of Oklahoma, it all changed.

Microsoft released a version of BASIC that included the ability to create desktop GUIs right there in the development environment. They called it Visual Basic. The first versions ran in Microsoft’s Disk Operating System (MS-DOS), but later, we got support for Windows, Windows 2, and then Windows 3.1. Windows 3.1 was significant because that’s when we got true multitasking if our PC was equipped with an 80386 processor. PCs were no longer limited to running one program at a time, and the Windows OS made mouse-driven interaction ubiquitous.

Things got interesting with VB. Instead of coding an interface, you drew the interface. The IDE included a palette of components and a window. You could draw buttons, text boxes, and anything else you needed, directly onto the window. After you drew them, you would then “wire them together” with event handlers. What you drew was what showed up when you ran the program. The VB user interface (UI) was ultimately carried over into Microsoft’s Visual Studio. Even today, Visual Studio 2022 continues with the same features that were so groundbreaking in 1991. Figure 1.1 shows the toolkit used to draw visual UIs for Windows:

Figure 1.1: The Visual Studio IDE originated as a product called Visual Basic in 1991. It defined the standards for what a good IDE should be

Figure 1.1: The Visual Studio IDE originated as a product called Visual Basic in 1991. It defined the standards for what a good IDE should be

The VB3 IDE that began my career introduced even more ground-breaking features that my smug, cargo-pants-wearing Unix colleagues could only dream of. They were still fighting over vi’s superiority over Emacs, or vice versa, depending on whom you asked. Meanwhile, VB3 had colored syntax highlighting, support for editing multiple files, a graphical interface editor for drawing buttons and other screen widgets, and a visual programming tool that tied code, events, and GUI elements together. It had a debugging system you could use by simply clicking a line number. Doing so would create a red dot – a breakpoint in the code where the execution would stop during a test run, allowing the developer to inspect the state of the running program. It was pure coder nerd-vana! Love them or hate them, Microsoft’s VB IDEs defined what IDEs are supposed to be today. Nobody who has learned to code using a Microsoft IDE, whether it be a legacy language or a modern one, is willing to accept anything less than that experience.

With every language that I’ve learned since, the first thing I always do is find the very best IDE available that offers those features I can’t live without. When I started working with Python 3 about six years ago, I found PyCharm. I used it to perform a full re-write on a complex software-as-a-service (SaaS) product, which took me about 18 months to complete. It was trial by fire. In this book, I intend to share what I learned, complete with scorch marks.

Throughout this book, we will be learning about the general interface of the PyCharm IDE, along with customizations and extensions to help you adapt your tools to the kind of work you’ll be doing with Python. This first chapter discusses the merits of IDEs in general. I’ll provide a comparison of the most common tools used for Python development. Some of them are very good while others, despite being widely used, are fairly primitive.

We’ll cover the following main topics in this chapter:

  • The purpose of PyCharm as a Python IDE and some notable details on its developing company, JetBrains
  • The usage of PyCharm within the community and a breakdown of which professions tend to utilize PyCharm the most
  • A comprehensive outline regarding the advantages and disadvantages of using PyCharm, in comparison to other Python editors/IDEs
  • The differences between the Professional and Community editions of PyCharm and the additional functionalities that the paid edition offers

On the other hand, if you have already decided that PyCharm is the Python IDE for you, feel free to jump to Chapter 2, Installing and Configuring PyCharm, to go through the installation and registration process. If you have already downloaded and successfully set up PyCharm on your system, you might want to begin at the second section of this book, starting from Chapter 3, Customizing Interpreters and Virtual Environments.

Technical requirements

This chapter is introductory, so we won’t be coding yet and the technical requirements are nil. It’s Chapter 1 and I know you’re all fired up and ready to go and nil is boring. So, let’s get moving!

First, here is what you will need to be successful with this book:

  • A computer. I know! It’s obvious, but I pride myself on being complete and leaving nothing to chance!
  • An OS. This works best if it is installed on your computer already since we won’t cover how to do that in this book. Windows, macOS, Linux – it’s all the same as far as this book is concerned because PyCharm works in all three, and the UI is nearly identical in each environment.
  • An installation of Python. We’re going to be using Python 3 exclusively in this book. There are a few different “flavors” of Python 3 but for the most part, the plain old Python 3 from https://www.python.org will be fine. We’ll get into those “flavors” later when we start talking about virtual environments in Chapter 3, Customizing Interpreters and Virtual Environments. If revision numbers give you comfort, the latest release at the time I’m writing this book is 3.11.1. The Python revision I’m using in that production SaaS app I mentioned earlier is 3.8. If your Python 3 installation is older than that, you should update it.
  • At some point, a GitHub account might come in handy since I will be sharing the code from the book using a Git repository.

The continued success of Python

In the first edition of this book, the author titled this section The recent rise of Python. Time has passed and I’m picking up where he left off. I think it’s important to point out that the recent rise has more or less continued since the first edition of this book was published. Python has continued to be one of the most popular and widely adopted languages for some very good reasons. One of those reasons is that Python stresses readability and uses a simple syntax. This allows newcomers to the language, and indeed to the field of software development, a quick path to success. Contrast that with the previously normal experience of forcing college and university students to learn C or C++ as their first language. These languages are terse and complicated and generally have a poor track record when it comes to developer productivity. Sure, C and C++ are powerful languages and can produce the most performant software available. However, in my experience, a language that can take you from “Hello World” to being able to produce useful software in a short period trumps the performance gains in all but the most extreme cases. Guido van Rossum, the creator of Python, compares the quickness of Python to other languages in his paper OMG-DARPA-MCC Workshop on Compositional Software Architecture. In the paper, van Rossum states that development in Python is estimated to be 3-5 times faster than that in Java, and 5-10 times faster than that in C/C++. Keeping this difference in mind, we can easily understand why Python is being so widely adopted. After all, time is money. You can find Guido van Rossum’s complete essay here: http://www.python.org/doc/essays/omg-darpa-mcc-position/.

The comparison between Python and Java or C/C++ is a weak one since these languages are designed and used for different applications. C and C++ are used when very high performance is required. Most OSs are written in C++, as are real-time systems such as those you’d find in a Tesla automobile or modern spacecraft. It isn’t necessarily fair to compare specific productivity between Python and C++ because they aren’t used to make the same types of applications.

Java, on the other hand, is used to develop the same types of applications for which you might use Python: enterprise and web applications. Java, though, requires a lot of boilerplate. This means a developer has to create a lot of code and structures just to support the application’s existence before they can even think about writing code for the application itself. This boilerplate is largely absent from Python. Furthermore, Java relies on a very rigid, static object-oriented paradigm. Python, in contrast, is far more flexible, offering a dynamic programming model. Even though the two languages are used to make the same type of application, Python gives you some serious shortcuts, owing to its more flexible paradigm.

These factors that comprise Python’s strengths, along with many others, have coalesced to form a very accessible development language supported by a community of raving fans. That community is still growing by introducing coding to a gamut of fields and professions distinct from those of us who historically focus solely on traditional application development. At the time of writing, the TIOBE Index, a ranking system for the popularity of programming languages, ranks Python as the number one language, as seen in Figure 1.2:

Figure 1.2: TIOBE rankings show Python to be the most popular language

Figure 1.2: TIOBE rankings show Python to be the most popular language

Python has a huge standard library that provides anything you might need to build any kind of software you can imagine. If that statement proves false for your specific project, there is a vast third-party and largely open source ecosystem consisting of hundreds of thousands of libraries upon which you can build. You can find a catalog of these libraries at https://pypi.org. Taking all this together, a new software developer can go from idea and zero Python experience to a production application very quickly. This process can be greatly accelerated by a good IDE.

The philosophy of IDEs

Back when I was your age, things were different. That is, of course, unless we are the same age, in which case everything was the same. We didn’t have the internet. When we wanted to learn new coding languages and techniques or understand the history of our craft, we were required to take a sacred pilgrimage. One year, I smuggled in a Polaroid. You can see the pictures I took in Figure 1.3. You should understand that all of what I am about to tell you is both true and a closely guarded industry secret. Just so we’re clear, you didn’t hear this from me.

Hidden somewhere in a mystic range of mountains, seekers of great coding wisdom would ascend the 10,000 stairs by the light of the full moon in search of the Master. The journey was not easy, and the wisdom imparted had to be hard-earned. It was on one such crusade that I learned why good IDEs are so important. The Master said, “If you know the language, and you know the IDE, you need not fear the result of a hundred deployments.”

Figure 1.3: High in the sacred mountains, up the 10,000 stairs, lies the monastery where I learned to code

Figure 1.3: High in the sacred mountains, up the 10,000 stairs, lies the monastery where I learned to code

The Master often speaks in riddles, so let me explain. Deployment refers to a published iteration or an increment of your software. In most professional circumstances, the objective is to publish your software. If our objective is to publish, the next sticking point is that we must know a programming language. I assume you have at least a tacit understanding of programming in Python. That just leaves the Master’s reference to the IDE.

There are several classes of tools a developer might use to develop Python code. The Python language can be considered an interpreted language. We could argue that when it runs, some of the code is optimized into C code and cached, but at this stage, we aren’t worried about that level of detail. The point is that a Python program exists as simple plain text files and can be executed in that form. Contrast this with statically compiled languages such as C, C++, C#, Java, or Go. Those and many other languages require the code in the text files to undergo a compilation phase where a new executable file is produced. In C#, you can’t simply execute a .cs file. You need to compile it into a binary, then execute the binary. Since Python executes its code directly via the Python interpreter, the level of tooling needed to work on Python can be very simple. Essentially, any text editor will do. There are three levels of editor capability to choose from.

The first is a simple text editor. Simple text editors are generally limited to opening, editing, and saving text. They are generic tools designed to work with any kind of text file, from grocery lists to systemd configurations. In Windows, you might know it as Notepad. On a Mac, you might use TextPad, and if you are rocking a Linux desktop such as Ubuntu, you’ll easily find Text Editor. If you are not a fan of GUIs on your OS, then you have no doubt heard of editors such as vi, vim (vi improved), Emacs, and nano. All these programs fall into the category of simple text editors. If you’re not sure what a systemd configuration is, don’t sweat it; it’s a system administration file on Linux. I just needed something that sounded complicated to characterize the more complex end of the text file gamut.

The second evolution of programming editors is called enhanced editors. These editors are purposefully designed to work with technical files. Some popular examples include the following:

  • Visual Studio Code
  • Atom
  • Notepad++
  • UltraEdit
  • Sublime Text
  • JetBrains Fleet
  • Bluefish Editor
  • IDLE (the editor that ships with Python)

These tools are designed to work with a wide range of programming languages and can generally be easily customized to add support for emerging languages. Enhanced editors offer some common features that make a developer’s life a little nicer, such as these:

  • Syntax highlighting, which color codes keywords and other semantic elements in your code.
  • Macros, which allow the developer to record and play back common keystrokes
  • Project and file organization to allow easy switching between multiple files that make up a project
  • Rudimentary code completion to reduce the amount of typing needed to write your code
  • Plugin support for other niceties such as linters, spell checkers, file previews for your code, and more

Over time, some of these enhanced editors have become very robust because you can customize and expand their capabilities. When you consider these tools as they are right out of the box, they are more useful and specialized than general text editors, but they fall short of qualifying as IDEs.

At the top of the code editor food chain is the IDE. If you were to look inside the cockpit of a fighter plane from the World War I era, you’d see a few simple controls and nothing more. If that’s a text editor, the IDE is the cockpit of a Boeing 747 aircraft. Every tool a developer could ever desire or need is crammed into a comparably complex UI. IDEs contain all the features of an enhanced text editor, but usually offer the following additional enhancements:

  • Some easy ways to run your code right from the editor.
  • Tooling to help manage your source code repository, such as Git or Subversion.
  • An integrated, easy-to-use debugger, which allows you to pause the execution of a running program and inspect or alter its current state.
  • Tools to help you write automated tests such as unit tests and run and visualize the results.
  • Complex code completion is based on the introspection or indexing of the code in your project. In modern IDEs, this is enhanced using artificial intelligence (AI).
  • Profiling tools to help you find execution bottlenecks.
  • Integrated tooling to help with supplementary systems, such as databases.
  • Tools for deploying your code to a server or cloud environment right from the IDE.

Some popular examples of IDEs include the following:

  • Visual Studio (this is different from Visual Studio Code)
  • PyCharm
  • IntelliJ IDEA
  • NetBeans
  • Apple Xcode
  • Xamarin Studio
  • Eclipse

As you can see, the IDE is the most powerful weapon in your coding arsenal. It is important to use the best one available to you. If you are new to software development, or maybe even not-so-new, you might wonder why the enhanced editors are so popular. At the time of writing, roughly 50% of developers use Visual Studio Code, which is not on my list of IDEs.

Many developers prefer a more “lightweight” development environment. This is especially true of frontend web developers who swear by Sublime Text and Visual Studio Code. In truth, they need all the features of the IDE, and they use them, but they are spread out across different tools they use throughout the day. A frontend developer relies on profilers and debuggers that run in web browsers and they don’t need those tools in an IDE. Instead, they can get a simpler editor that downloads quickly, installs simply, and runs instantly when they click the icon in their OS.

I submit that if you are doing full stack web development or mobile development, or you need to work servers or containers, an IDE is a better choice.

There exists a certain class of software developer who swears you should never use anything other than the simplest possible tools. They believe that reliance on a tool to do coding and related hard work diminishes the overall mastery and accomplishment needed to be considered proficient. I couldn’t disagree more. One year, while at the monastery, the Master told me a story of a great swordsman from Japan named Miyamoto Musashi. In his day, every samurai knew of Musashi as the greatest living swordsman and all the samurai wanted to take a shot at defeating him. Back then, duels were usually fought to the death. One day, a dueling challenger met Musashi as he was getting off a boat. Musashi was unarmed. The challenger waited until Musashi could fashion a wooden sword, called a bokken, from one of the boat’s oars, which he intended to use in the dual. Legend has it Musashi made a fool of that challenger and left him alive, much to the challenger’s disgrace. Musashi, the Master said, was the finest warrior who ever lived, and his skill with a sword has never since been matched. However, if the objective were simply to defeat him, I could have easily done so with a machine gun.

In my opinion, limiting the tools you use owing to a sense of pride in your capability, or lack thereof, is foolish. The objective of a software developer is to ship software, usually on an unforgiving deadline. It isn’t to waste time trying to prove yourself to someone else’s standards, unless, of course, you’re a degree-seeking student. I’m sure there are a few of you reading this book. Play the game and do what your professors say. You should realize that once you graduate, everything changes. You will be expected to produce code quickly, accurately, and consistently. This is best achieved via the automation available in a good IDE. You should choose the best tool for the job at hand. I found PyCharm helped me to become productive while I was learning the Python language. When you start, and you’re not using an editor that corrects your line spacing and indents, you’re going to make a lot of silly mistakes. It’s frustrating. I’d think to myself, “If I were using C#, I’d be done by now.” I was even tempted to abandon Python and PyCharm for something more comfortable. However, that’s not what I wanted to do.

PyCharm will underline all those silly mistakes for you and correct them with the touch of a button! I learned, after seeing those mistakes underlined over and over, what to do when I’m using an editor without code inspection. Today, when I am working in other languages, I still use Python rules. Having learned Python with the help of PyCharm, I was able to ship faster, learn faster, and improve my code in other languages and tools. Do me a favor and never let anybody tell you you’re not a real developer because you didn’t do something their way. If they persist, tell them nano is better than vi or Emacs, and just walk away. Such a statement will probably cause their head to explode.

I’d like to make one more comment about Visual Studio Code. This editor has evolved through plugins to the point where it can compete with a fully featured IDE. However, this comes at a cost compared to a professionally developed IDE such as PyCharm. To get the identical features you’d find in PyCharm in Visual Studio Code, you’d need to install a large number of plugins. These plugins are all written by the community, which means they are all independent development efforts. These plugins will never work as cohesively as the base features you will find in an IDE such as PyCharm. This is also true when comparing Visual Studio with Visual Studio Code. Try creating a C# project in Visual Studio versus Visual Studio Code and you’ll find the process is dreamy and smooth in Visual Studio. Visual Studio Code, on the other hand, requires a lot of command-line work and lots of weird plugin installations. The experience just isn’t the same. The same observation holds with other editors such as vim, which can be heavily customized. You’ll spend a week messing with plugins and open source scripts to achieve, at best, partial parity with an IDE’s out-of-the-box functionality.

PyCharm as a Python IDE

It’s all well and good to talk about tool comparisons common to other languages. But we don’t care about that, do we? We want to know our options for Python! The best IDEs are typically specialized. PyCharm is specialized in working with Python. That’s it. When you create a new project in PyCharm, you’ll see options for Python projects and nothing else. Contrast this experience with Visual Studio. In my opinion, Visual Studio is the only close competitor to PyCharm when it comes to working with Python projects. When a project is created in Visual Studio, you will most likely spend a good five minutes trying to wade through the myriad of options. The IDE supports dozens of languages, and that is compounded by a dozen project types such as web, desktop, and others. Visual Studio is trying to be all things to all developers. PyCharm only wants to play with Python developers.

PyCharm itself was created with a few design goals in mind:

  • Intelligent coding assistance
  • Streamlined programming tools
  • Web development options
  • Scientific computing support
  • Visual debugging and performance profiling

We’ll take a look at each of these design goals in turn, but first, I need to point something out. At the time I’m writing this, PyCharm is about to go through a big change. JetBrains is working on a brand-new user experience. By the time this book is published, there is a strong chance that this new UI will be the default. If you’re new to PyCharm, you should understand that you’re going to see it in two different ways for a while. The classic UI will continue to be available in the product for a time, allowing us to ease into the new experience. I’ve decided I’m going to embrace the new UI given the time between the first edition and this one is a few years. That said, it bears mentioning that you’re going to see the classic UI alongside the new UI until probably late 2024 when the old UI is no longer maintained. It will become deprecated and one day will disappear into the sands of time like Shelley’s fabled statue of Ozymandias:

Figure 1.4: The new UI (top) compared to the classic UI (bottom)

Figure 1.4: The new UI (top) compared to the classic UI (bottom)

Figure 1.4 shows the two UIs side by side. The design objective of the new UI is to reduce the clutter in the interface. They’re not wrong on that point. As the tool has grown over the years, more and more features have been crammed into the menus, making the UI a little bit daunting for new users. The biggest thing to realize is that most of the things you’d find in the menu are still there, but the menu system itself is hidden beneath the hamburger icon in the top-left corner of the screen. Don’t worry; I’ll cover this in detail later. As I write this, there is a setting we’ll review in Chapter 2, Installing and Configuring PyCharm, that allows you to toggle between the classic and new UIs.

I wanted to point this out now because you’re about to see some screenshots, and if you’ve seen the old UI, you might think you’ve picked up the wrong book. You haven’t. Just the opposite. If I time this right, you’ll be the only one with the right book.

Intelligent coding assistance

I’m going to tell you something my wife says all the time. I’m very lazy. Wait. That came out wrong. She is saying that I’m lazy. I’m not saying that she is saying she is lazy. Sheesh. Writing is hard! I almost dug a hole there, didn’t I?

She’s not wrong. As a developer, I am essentially very lazy. I refuse to spend hours or even minutes doing something the long way. The Greeks had a legend about a guy named Sisyphus who was cursed to push a stone up a steep hill. As soon as he reached the top, the stone would roll back down the hill. Sisyphus was stuck in an infinite loop with no Cmd/Ctrl + C option on his keyboard.

Here’s one thing I know: Sisyphus was not a software developer! Any software developer would have rolled that stone exactly twice, after which they would have spent eternity devising a system of pulleys and cranes controlled by an IoT device. Naturally, the microcontroller would be running a Python script. I digress.

What some (I say in my head looking in my unsuspecting wife’s direction) might call lazy, I call efficient! As a developer, I want to create maximum effect with minimal effort in everything I do. Writing code is complicated. You are writing instructions for the most stubborn and unintelligent object ever devised. Coding is worse than trying to teach a 2-year-old to tie their shoes. Trust me, I’ve done both! Coders must be extremely specific and verbose in their explanation of any operations they want to perform. Furthermore, things are made worse by the language developers out there who tend to want to force users to write a bunch of boilerplate code. I’m talking about the excise code that has nothing to do with the code you want to write or the problem you want to solve. Python generally avoids this, so let me give an example of possibly the worst offender: Java.

Back in the day when I was a wee lad, Java was all the rage. There was this caste of corporate programmers involved with Java who thought up something called Enterprise Java Beans (EJBs). EJBs were supposed to be the epitome of module programming with reusable objects. It was an absolute beating to implement. Rather than simply making a class, which is all you need, you had to create a special file structure with various folders and manifest files to expose what was in the bean, and it was all compiled into a special format. It turned out that the special format was nothing more than a ZIP file. It took a lot of work just to make an EJB, which meant developers had to make a ton of files and write a lot of code just to get started on the functionality they needed to express to get their work done. That’s what we mean by boilerplate. Boilerplate is generally useless but necessary because, without it, the code doesn’t work.

All IDEs have evolved because of this phenomenon. PyCharm evolved from JetBrains’ Java IDE, IntelliJ. Python doesn’t usually have a lot of boilerplate required for your code to work, but it does come up. There are two kinds of boilerplate. The boilerplate needed to make old-school EJBs work is the bad kind. The boilerplate generated as a means to jumpstart your project is the good kind. As we’ll see, PyCharm, as with most IDEs, generates a folder structure, a set of files, and some basic code to get you started. That can be considered boilerplate. But in this case, that code isn’t retained. It is replaced by the real code for your project. The code generated by the IDE is just a mental prompt to get you going. It prevents you from having to create your project’s starting point by hand.

All this is great, but boilerplate code generation isn’t what we usually think about when we hear “intelligent coding assistance.” We usually think of the feature pioneered by Microsoft called IntelliSense. If you’ll allow me to anthropomorphize the IDE for a moment, this feature watches as you type your code. All the while, the IDE is thinking about what you’re trying to do. When it sees a way it can help, such as by completing a word or line for you automatically, it presents that as an option. I have an intelligent person completing all my sentences for me: she’s my wife. When she completes my sentences for me, they are usually more organized and intelligent than they would have been if I were on my own. (This might be another reason she thinks I’m lazy.)

I want to point out that not all tools with an IntelliSense-like feature are created equally. When you see this feature in an enhanced editor, it usually works differently than it would in an IDE. In enhanced editors, they use keyword lists to highlight and autocomplete the elements of a language. Really good enhanced editors might index your code and recognize variable and function names and use statistics to give you the most likely completion first. That option is generally followed by a long list of noise comprising every possibility that exists for a given completion. Code completion is becoming very advanced with the introduction of AI tools, and this makes the difference between IDEs and enhanced editors a little muddier, at least on this point. Tools such as GitHub’s Copilot can not only autocomplete variable names and keywords but also write entire sections of your code automatically.

It is important to remember, at least as I write this, that those AI features are not part of the IDE or enhanced editor. They are implemented as plugins. Since this is true, I’ll continue espousing the merits of IDEs, and PyCharm in particular, based solely on the merits of the software by itself. We’ll discuss plugins in Chapter 16, More Possibilities with PyCharm Plugins.

While enhanced editors might present you with a long list of possibilities for your code completion, PyCharm can analyze your code and perform more intelligent autocompletion. You also get code analysis, such as duplicate code warnings. A common antipattern in software development is copying and pasting code across or even within the same project. It’s a terrible but common thing to see. PyCharm will spot duplicate code and flag it for you so that you can be reminded to refactor the duplicated code into a function or module that can be reused and maintained in one location.

PyCharm can also perform a static analysis of your code. This type of analysis is looking for antipatterns within the code itself; for example, PyCharm will detect dead code like that shown in Figure 1.5. Concerning Python development, PyCharm will automatically format your indentations and give you critical feedback on how your code conforms to PEP-8 conventions, which are stylistic requirements you must meet to be considered pythonic (that’s a good thing).

For example, if you were to type the following code into a new file in PyCharm, you’d see PyCharm’s warning that you have created unreachable code on line 13. The text on that line is highlighted. Hovering your mouse over this highlighted line reveals what is wrong:

def print_hi(name):
  print(f'Hi, {name}')
  for x in range(25):
    print(str(x))
    if x == 12:
      return
      print("You'll never make it here")
if __name__ == '__main__':
  print_hi('PyCharm')

The print_hi function starts innocuously enough by printing to the console whatever is passed into the function within the name argument. After that, we create a loop that will run 25 times. On each run of the loop, we print out x, which contains the current iteration. When the counter variable, x, reaches 12, the loop exits via the return function, which, as luck has it, is on line 12. I assure you, this is purely a coincidence. Since the loop returns on line 12, the code on line 13 will never be reached:

Figure 1.5: PyCharm will highlight many common coding mistakes such as this one. The code on line 13 is unreachable, which is indicated when you hover your mouse over the highlighted code

Figure 1.5: PyCharm will highlight many common coding mistakes such as this one. The code on line 13 is unreachable, which is indicated when you hover your mouse over the highlighted code

PyCharm also allows you to navigate between files in a complex project by helping you find where functions, variables, and classes are defined, as well as where they are used. Over time, you’ll learn a set of keystrokes that will allow you to move anywhere in your project without your fingers leaving the keyboard.

In essence, PyCharm’s intelligent coding assistance allows you to worry less about mistakes and more about your logic and requirements, which allows you to complete your code more quickly with fewer mistakes.

Streamlined programming tools

Writing code is but one activity a developer performs each day in pursuit of a project deadline. Great developers also spend time debugging, testing, and profiling their products to produce the best possible result. We also need to deal with pushing code to testing servers, refactoring (other people’s) bad code, working with databases, and dealing with containers. There is tooling in PyCharm for each of these processes and more. When I write complicated web applications in PyCharm, the only tools I usually have open are PyCharm and a web browser: two tools each on their own monitor.

The PyCharm debugger

My favorite feature and the one that got me excited the first time I used PyCharm is the debugger. PyCharm’s debugger is great. It is much better than the standard debugger you get with Python itself. Python ships with a debugger called Python Debugger (pdb). In my humble opinion, I’d rather eat bugs off the sidewalk than use this tool. I alluded to this earlier in this chapter. I grew up using Microsoft debuggers and simply nothing else will do. PyCharm’s debugger works exactly as I would expect. Click your mouse at the line where you want execution to stop to make a breakpoint and click the debug button in the IDE, and the program runs and stops at the indicated line. You will get a screen where you can inspect both the state of the stack as well as the terminal output. It’s very simple to use, and I’ll be showing you how to do so in Chapter 6, Seamless Testing, Debugging, and Profiling.

Running tests with the graphical test runner

Testing tools are integrated in the form of test runners. PyCharm supports all the major testing frameworks, including pytest, nose, and the regular unit test features from the standard library. Again, I’m coming from experiencing some very good IDEs, and in this case, I’m remembering Eclipse and Visual Studio, which both include graphical test runners. The adage If the bar is green, the code is clean is visually implemented in PyCharm. You can see an example in Figure 1.6. You can run your tests and see a list display showing what passed and what failed, though it is a list rather than a bar. You can then rerun your failing tests until they work.

I’ll give you a simple example. In main.py within this chapter’s source code, I have one file called main.py and another called test_main.py. The content of main.py is a simple function that adds two numbers together:

def add_two_numbers(a: int, b: int) -> int:
  return a + b

Within the test_main.py file, there is a simple unit test:

from unittest import TestCase
from main import add_two_numbers
class Test(TestCase):
  def test_add_two_numbers(self):
    self.assertTrue(add_two_numbers(a=5, b=6) == 11, \
      "Should be 11")
  def test_show_a_fail(self):
    self.fail()

The Test class contains two tests: one that will pass and one that will automatically fail. I usually make the automatically failing test first just to make sure I have my test class set up properly. Then, later, I remove the fail because of my dopamine addiction, which is only satisfied by green checkmarks in the test runner, as seen in Figure 1.6. If I right-click on test_main.py, as seen in Figure 1.5, I’ll get an option to run the tests within the file:

Figure 1.6: Right-click the test_main.py file and click Run ‘Python tests in test…’ to run the unit tests contained within the file

Figure 1.6: Right-click the test_main.py file and click Run ‘Python tests in test…’ to run the unit tests contained within the file

Look to the lower-left corner in Figure 1.7, which shows the test run’s completion, and you’ll see a list of tests that passed or failed with either a green check or a yellow X showing failure. Like all figures in this book, which are printed in black and white, you won’t see the colors. Color ink is expensive, and your father is right, money doesn’t grow on trees:

Figure 1.7: PyCharm’s built-in test runner shows a traditional pass/fail list (lower-left pane) to indicate passing and failing tests

Figure 1.7: PyCharm’s built-in test runner shows a traditional pass/fail list (lower-left pane) to indicate passing and failing tests

PyCharm’s profiling tools

Similarly, code profiling is built in and easy to use. You can click the Profile button to run the code. When the program exits, you will get a graph of each function call, along with the time and resources consumed by the call. This makes it easy to spot unrealized opportunities for improvement concerning the speed of execution and resource consumption.

Consider the possibility that you have an algorithm in your program that might not be performing as you’d like. I know, I know, it would never happen to you, so supposed you just got hired, and the person they fired wrote this horribly performing algorithm. Maybe pretend it is 1956, and the guy who got fired from your new employer, New York Life Insurance Company, was one Edward Harry Friend. Friend wrote a paper titled Sorting on Electronic Computer Systems, which is likely the first published instance of an algorithm we know today as bubble sort. If Friend had written his algorithm in Python 3, it might look a little like this:

def bubble_sort(input_array):
  length_of_array = len(input_array)

Friend has just created a function that accepts a list as an argument, which in our case will be an array of integers. The objective is to sort these numbers. To do this, let’s create two loops, one inside the other:

  for i in range(length_of_array):
    for j in range(0, length_of_array - i - 1):
      if input_array[j] > input_array[j + 1]:
        input_array[j], input_array[j + 1] = \
        input_array[j + 1], input_array[j]

Within these loops, each number is compared with the number before it. If it is determined those two numbers are out of order, they are swapped. In the next run of the loop, this happens again with the next two numbers, and this continues until it reaches the end of the list.

If you’ve studied algorithms at all, you’ve probably heard of bubble sort, and you’ve been warned as to why it is not used. It is very slow. We have a for loop within another for loop, which is fine if the size of your unsorted list is small. But this algorithm slows down at a logarithmic rate as the list of numbers grows. Algorithm performance is measured using big O notation. I don’t want to turn this into an algorithm book, so I’ll just tell you that a loop inside another loop will scale poorly in terms of performance. In big O notation, we classify this algorithm as O(n2). That’s bad.

In plain English, this means that if you double the count of numbers to sort (n), then your algorithm will take 22 or 4 times longer to process. If you multiply your count’s size by 5, then it becomes 52 or 25 times slower. The bigger the list, the slower it sorts.

To show off the performance tool, we’re going to give this test run a list of 100,000 numbers to sort. Now is a good time to point out I’m running an Intel i9 processor. If you’re a student or some other budget-constrained consumer rocking an i3 processor (or worse), you might want to take the list of numbers down a few zeros if you want to try this out. It takes a good while on my i9:

test_array = []
for x in range(100000):
  test_array.append(random.randint(1, 10000))

Let’s finish the test code by calling the function and printing the results:

bubble_sort(test_array)
print("The result of the sort is:")
for i in range(len(test_array)):
  print(test_array[i])

We’ll cover the profiling tool extensively in Chapter 6, Seamless Testing, Debugging, and Profiling, but for now, let’s just run this code with the profiler and review the result. To run the profiler on the performance.py file, simply right-click the file and click More Run/Debug, then Profile ‘performance’, as shown in Figure 1.8:

Figure 1.8: Right-click the file you’d like to profile and click More Run/Debug | Profile ‘performance’ to see a performance profile

Figure 1.8: Right-click the file you’d like to profile and click More Run/Debug | Profile ‘performance’ to see a performance profile

Remember, if you use the same code I did, this will take a long time to run, especially on a slower computer. Feel free to adjust the size of the list downward if it’s taking too long to run. The result is a .pstat file that displays as a table in PyCharm. Again, we’ll cover this more extensively in Chapter 6, Seamless Testing, Debugging, and Profiling. You can see the performance report in Figure 1.9:

Figure 1.9: PyCharm’s resource profiler shows the performance bottlenecks in a running program

Figure 1.9: PyCharm’s resource profiler shows the performance bottlenecks in a running program

As you can see, 84.4% of the program’s time is spent in the bubble_sort function, which is the bottleneck. PyCharm has told you where to concentrate your refactoring efforts to improve the performance of your program.

Publishing from the IDE

When you need to publish your code to a testing server, and you aren’t using a continuous integration system for that, you can use PyCharm. To be clear, you should use a continuous integration system, but I often use the PyCharm features early in a project before the continuous integration system is operational to get code up for stakeholders to play with. You can deploy using file transfer protocol (FTP) or secure file transfer protocol (SFTP), or copy directly to a network share for a quick and easy way to share your progress with anyone who might want to review it.

Refactoring tools

PyCharm has robust refactoring tools you’d expect from a proper IDE. If you want to change a variable name, or even a method signature on a function, right-click and select the Refactor tool. Rest assured the changes you make will carry over to all related instances in your project, not just in the file you are editing. Figure 1.10 shows an example of this in action:

Figure 1.10: PyCharm has a full selection of refactoring tools available

Figure 1.10: PyCharm has a full selection of refactoring tools available

In addition to renaming a variable or function, there are other actions you can perform, such as changing the method signature and changing the structure of your object-oriented classes.

Working with databases in PyCharm

If you work with databases, the Professional edition of PyCharm includes a graphical table editor and SQL support for dozens of popular databases. Check it out in Figure 1.11. I’ll talk more about the Professional edition of PyCharm a little later in this chapter; we’ll have a whole chapter on the database features in Chapter 11, Understanding Database Management with PyCharm:

Figure 1.11: PyCharm has a robust and complete set of tools for working with relational databases such as Oracle, SQL Server, Postgres, and many more

Figure 1.11: PyCharm has a robust and complete set of tools for working with relational databases such as Oracle, SQL Server, Postgres, and many more

As you can see, a great many relational and NoSQL databases are directly supported.

Remote development, containers, and virtual machines

Finally, but not exhaustively, PyCharm has features for working with remote systems via SSH, local virtual machines using HashiCorp’s Vagrant, and extensive support for Docker containers.

This isn’t an exhaustive list of what PyCharm can do for you, but by now, you get the point. Every tool you might need is integrated into the development environment. That’s probably why they called it an integrated development environment.

Web development options

I’d wager that more than half the developers working in Python need, at some point, a web project. Whether you’re like me and you’re making a SaaS offering as a fully realized web application, or you are doing rocket science and you need a way to visualize and interactively share your latest fast-Fourier transform on deep space radio emissions data, web projects are usually inevitable. I’m not a scientist and I made that up. If the last sentence made sense to anyone, it was pure coincidence.

Working with web projects offers a new and separate layer of complexity. Most use three-tier designs commonly expressed with the model-view-controller (MVC) pattern. If you’re not sure what this means, stay tuned because there’s a whole section of this book dedicated to web development. For now, this means the application has a frontend where the user can interact, a middle tier containing connective logic, and a database tier for structured data storage and retrieval. Only the middle tier is done in Python. We’ll extensively cover web development in later chapters, but for now, I want to tell you about the level of tooling you get with PyCharm.

The company that made PyCharm, JetBrains, makes a variety of IDEs targeted at different languages. One of their IDEs is specifically targeted toward web development. It is called WebStorm. I said earlier that good IDEs target one language. WebStorm targets JavaScript; specifically, we’re talking about full stack JavaScript. Modern JavaScript execution occurs in two places. Traditionally, JavaScript was always executed in the browser. About 10 years ago, Node.js was released and JavaScript was released from the confines of the browser window and allowed to run on the backend.

Earlier, I alluded to a robust set of features in PyCharm for working with databases. JetBrains also has an IDE that targets SQL database developers called DataGrip. As it happens, the Professional edition of PyCharm includes the entire feature set available in WebStorm and DataGrip. When you buy the Professional edition, you’re getting three JetBrains products in one package: PyCharm, WebStorm, and DataGrip. When you use PyCharm to work on web projects, you need all three feature sets and they are there for you in the Professional edition.

Scientific computing support

The growth of the data science field has played an important role in the growth of Python itself, and Python is now the most common programming tool used in scientific projects (even more common than R). Notable functionalities included in PyCharm that facilitate data science work are the integration of IPython, Jupyter notebooks, and an interactive console. The support for scientific computing in PyCharm is detailed in section four of this book, starting from Chapter 13, Turning On Scientific Mode. PyCharm also provides a customized view that optimally organizes workspaces in a scientific project called SciView, which is shown in Figure 1.12:

Figure 1.12: SciView in PyCharm grants access to scientific visualization tools via a slick interface

Figure 1.12: SciView in PyCharm grants access to scientific visualization tools via a slick interface

Understanding the Professional, Community, and Educational editions

There are three editions to PyCharm. I’ve alluded to two, because the third is a special version that is only useful to teachers, and the focus of this book is application development, not software development instruction. I’ll tell you about each, but I know what you want is a feature comparison chart. You’ll find it in Figure 1.13:

PyCharm Professional

PyCharm Community

Cost

Paid

Free

Intelligent Python editor

Checkmark with solid fill

Checkmark with solid fill

Graphical debugger and test runner

Checkmark with solid fill

Checkmark with solid fill

Code navigation and refactor tools

Checkmark with solid fill

Checkmark with solid fill

Code inspection

Checkmark with solid fill

Checkmark with solid fill

Git, Subversion, and other source control tools

Checkmark with solid fill

Checkmark with solid fill

Scientific tools

Checkmark with solid fill

Web development with HTML, JavaScript, CSS, and so on

Checkmark with solid fill

Python web framework support

Checkmark with solid fill

Performance profiling

Checkmark with solid fill

Remote development, containers, and so on

Checkmark with solid fill

Database and SQL support

Checkmark with solid fill

Figure 1.13: A feature comparison chart showing the features contained in the free Community edition versus the paid Professional version

The Community edition is free but only offers a limited set of features compared to the Professional edition. It is perfect for working on projects that only entail working with Python. The product I work on has a set of Python scripts that batch-process large amounts of data. Everything happens in Python and this is the perfect use case for the Community edition. If all you need is a terrific Python IDE, use the free version. The Community edition is also perfect if you are just working on automation scripts, such as graphics pipelines for 3D computer graphics, or general IT task automation.

The Professional edition has all the features of the free version but adds web development, database, remote development, containerization, and scientific project types. This is aimed at professionals who produce publishable software projects. While it is not free, JetBrains is pretty good about keeping it affordable with several pricing options, depending on how you are using the tool. Solo developers may obtain licenses at a lower price point than corporate developers. There are also ways to get the Professional edition free of charge, such as proving that you are using PyCharm on a fully open source software (FOSS) project. Start-up companies might be eligible for a 50% discount, and if you’re teaching in a code boot camp or a university setting, you may also qualify for free professional licenses. Since these things can fluctuate over time, you should check the JetBrains website for full details at https://www.jetbrains.com/pycharm/.

I said earlier there are three editions of PyCharm, and we’ve only covered two. The Educational edition is aimed at teachers and university professors developing curricula to teach Python. This edition can create and play back interactive lessons right in the IDE. It is only valuable to teachers, instructors, and content creators.

In this book, I will focus on the features present in the Community edition and the Professional edition.

Summary

In this chapter, we introduced the Python language itself, as well as the background behind Python IDEs in general and, specifically, PyCharm.

We also discussed the usability of PyCharm for Python programmers. Specifically, to be able to take full advantage of all the features and functionalities that PyCharm offers without becoming too dependent on the IDE, a programmer should first master the fundamentals of the Python language and its core syntax. We also looked at comparisons between PyCharm itself and various other Python editors/IDEs and the reason why PyCharm is considered the best development environment of them all.

Finally, we compared the two editions of PyCharm that are available for download: the paid Professional edition and the free Community edition. If you are working with large, complex projects with many moving parts, including database management, web development languages, and viewability in scientific reports, then you will most likely benefit from using the Professional edition.

In the next chapter, you will learn how to download PyCharm, set it up on your system, and configure its environment for your Python projects. This will serve as the first step in getting started with PyCharm, after which we will start discussing the specific features PyCharm offers that this book covers.

Questions

Answer the following questions to test your knowledge of this chapter:

  1. Programmers typically develop their code with an editor or an IDE. What is the difference between the two, and which one is PyCharm?
  2. Why might some think that an IDE for Python development might be inappropriate or unnecessary?
  3. What are some key features of PyCharm? Of those features, which give PyCharm an edge over other editors/IDEs?
  4. What advantage does PyCharm have over editors such as Visual Studio Code or vim, which can be configured to perform many of the same features offered by PyCharm?
  5. What are the three editions of PyCharm? What are the key differences between them?

Further reading

Be sure to check out the companion website for this book at http://pycharm-book.com. To learn more about the topics that were covered in this chapter, take a look at the following resources:

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Learn basic to advanced PyCharm concepts to improve developer efficiency on your Python projects
  • Learn with practical examples that focus on efficient application development
  • Explore features such as code automation, graphical debugging, and remote development
  • Purchase of the print or Kindle book includes a free PDF eBook

Description

In the quest to develop robust, professional-grade software with Python and meet tight deadlines, it’s crucial to have the best tools at your disposal. In this second edition of Hands-on Application Development with PyCharm, you’ll learn tips and tricks to work at a speed and proficiency previously reserved only for elite developers. To achieve that, you’ll be introduced to PyCharm, the premiere professional integrated development environment for Python programmers among the myriad of IDEs available. Regardless of how Python is utilized, whether for general automation scripting, utility creation, web applications, data analytics, machine learning, or business applications, PyCharm offers tooling that simplifies complex tasks and streamlines common ones. In this book, you'll find everything you need to harness PyCharm's full potential and make the most of Pycharm's productivity shortcuts. The book comprehensively covers topics ranging from installation and customization to web development, database management, and data analysis pipeline development helping you become proficient in Python application development in diverse domains. By the end of this book, you’ll have discovered the remarkable capabilities of PyCharm and how you can achieve a new level of capability and productivity.

Who is this book for?

This book is for Python practitioners and learners looking to boost their productivity and proficiency by harnessing the features and capabilities of PyCharm, all while gaining insights into best practices for modern application development. Basic knowledge of Python is required, making the book accessible to both newcomers and experienced Python developers.

What you will learn

  • Explore basic and advanced PyCharm features
  • Set up, configure, and customize your Python projects in PyCharm
  • Develop web applications with Flask, Django, FastAPI, and Pyramid
  • Discover PyCharm's capabilities for database management and data visualization
  • Explore code automation, debugging, and remote development in PyCharm
  • Perform data science tasks using Jupyter notebooks, NumPy, and pandas

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Oct 20, 2023
Length: 652 pages
Edition : 2nd
Language : English
ISBN-13 : 9781837632350
Category :
Languages :
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

Publication date : Oct 20, 2023
Length: 652 pages
Edition : 2nd
Language : English
ISBN-13 : 9781837632350
Category :
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 117.96 141.97 24.01 saved
Python Real-World Projects
$31.99 $45.99
Hands-On Application Development with PyCharm
$45.99
50 Algorithms Every Programmer Should Know
$39.98 $49.99
Total $ 117.96 141.97 24.01 saved Stars icon

Table of Contents

23 Chapters
Part 1: The Basics of PyCharm Chevron down icon Chevron up icon
Chapter 1: Introduction to PyCharm – the Most Popular IDE for Python Chevron down icon Chevron up icon
Chapter 2: Installing and Configuring PyCharm Chevron down icon Chevron up icon
Part 2: Improving Your Productivity Chevron down icon Chevron up icon
Chapter 3: Customizing Interpreters and Virtual Environments Chevron down icon Chevron up icon
Chapter 4: Editing and Formatting with Ease in PyCharm Chevron down icon Chevron up icon
Chapter 5: Version Control with Git in PyCharm Chevron down icon Chevron up icon
Chapter 6: Seamless Testing, Debugging, and Profiling Chevron down icon Chevron up icon
Part 3: Web Development in PyCharm Chevron down icon Chevron up icon
Chapter 7: Web Development with JavaScript, HTML, and CSS Chevron down icon Chevron up icon
Chapter 8: Building a Dynamic Web Application with Flask Chevron down icon Chevron up icon
Chapter 9: Creating a RESTful API with FastAPI Chevron down icon Chevron up icon
Chapter 10: More Full Stack Frameworks – Django and Pyramid Chevron down icon Chevron up icon
Chapter 11: Understanding Database Management in PyCharm Chevron down icon Chevron up icon
Part 4: Data Science with PyCharm Chevron down icon Chevron up icon
Chapter 12: Turning On Scientific Mode Chevron down icon Chevron up icon
Chapter 13: Dynamic Data Viewing with SciView and Jupyter Chevron down icon Chevron up icon
Chapter 14: Building a Data Pipeline in PyCharm Chevron down icon Chevron up icon
Part 5: Plugins and Conclusion Chevron down icon Chevron up icon
Chapter 15: More Possibilities with Plugins Chevron down icon Chevron up icon
Chapter 16: Your Next Steps with PyCharm Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.8
(4 Ratings)
5 star 75%
4 star 25%
3 star 0%
2 star 0%
1 star 0%
N/A Nov 26, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
"Hands-On Application Development with PyCharm" is a stellar guide that seamlessly demystifies JetBrains' PyCharm, transforming its myriad features into an accessible and empowering experience. From installation to advanced features like code automation and virtual environment management, the book offers a systematic and hands-on approach. The author's emphasis on practical coding techniques accelerates Python application development, making this guide invaluable for both beginners and experienced developers. The coverage of web development and data science, including Django integration and support for IPython and Jupyter Notebook, reflects the book's commitment to contemporary applications. What sets this guide apart is its focus on not just imparting knowledge but ensuring readers develop practical skills. By the end, I felt not only well-versed in PyCharm but also eager to implement its features in my projects. "Hands-On Application Development with PyCharm" is a must-read for anyone seeking to master PyCharm and elevate their Python programming skills. I wholeheartedly award it five stars!
Feefo Verified review Feefo
Dr. Matthias Nagel Nov 27, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Ok
Amazon Verified review Amazon
Krishnan Raghavan Dec 25, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Most software developers use IDE for software development. Some use it for learning a new language, some for daily coding. There are many IDEs that one can choose from depending on the programming language that one uses. For most Python developers, the choice of IDE is either PyCharm from JetBrains or VSCode. There are other IDEs as well that developers use but these two seem to be the front runners as far as choice of IDEs goes for most. This book is about how to use PyCharm for application development.This book is for all types of audiences. Whether you are an experienced professional with knowledge of Python or a newbie starting your journey in software development with Python, there is something for everyone here. The book starts with an introduction to PyCharm and what one can learn from the book in the next few chapters. This sets the expectation as well as a roadmap for the readers. The second chapter is about the installation along with the customization of PyCharm. The author has shown both methods of installing PyCharm, i.e. the traditional way of downloading PyCharm from the website and installing it or installing PyCharm using JetBrains ToolBox. I prefer using the ToolBox as I am used to the same. Chapter 3 is about customizing your Python environment and Chapter 4 talks about how to set up PyCharm's features like editing and formatting options, something that is very useful for every developer. Chapter 5 is about setting up version control with Git. Chapter 6 will help the reader set up the PyCharm with Unit Testing Framework to directly work from the IDE.Till Chapter 6, the reader can perform all that is being described by the author using the community version of PyCharm but from Chapter 7 onwards, the reader might have to use the professional version of PyCharm.Chapters 7 and 8 will help the readers understand how PyCharm can be used for Web Development using HTML, CSS, JavaScript, and Flask. Chapter 9 is about creating Restful API using FatsAPI. Chapter 10 speaks about more full-stack frameworks like Django and Pyramid. Chapter 11 will help the reader understand how to use PyCharm to access and work with databases (relational as well as NoSQL). Chapters 12 to 14 will help the reader understand how to use PyCharm for data science. Chapter 15 will help the reader understand and use the marketplace to access more plugins. The last chapter, Chapter 16, discusses how JetBrains is working on making PyCharm more robust. This chapter talks about some of the features that are in active development at JetBrains.At the end of the chapters, some questions test the reader's understanding of the topic covered in the chapter. This is very useful and highly recommended. Also, the Further Reading Section is very useful.This is one of the few books that I have seen that is completely dedicated to a tool that helps developers understand and become better at a programming language. Kudos to the authors for writing this book.
Amazon Verified review Amazon
marc du Fayet Feb 08, 2024
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
Pretty good book, from the basics (installation) and creating projects (well explained) to programing tricks, including debugging and also Django, SQL, web development, CSS and the rest of it.Not exactly what you would expect from a short "Pycharm Pocket Guide" but rather from a 600+ pages PyCharm Bible.Content is OK but the printing of the screen copies could be improved by making them darker.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.