Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
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
$45.99
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
$45.99
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 Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
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
Estimated delivery fee Deliver to Argentina

Standard delivery 10 - 13 business days

$12.95

Premium delivery 3 - 6 business days

$40.95
(Includes tracking information)

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 Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to Argentina

Standard delivery 10 - 13 business days

$12.95

Premium delivery 3 - 6 business days

$40.95
(Includes tracking information)

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
Banner background image

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 the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact [email protected] with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at [email protected] using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on [email protected] with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on [email protected] within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on [email protected] who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on [email protected] within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela