Make sense of your variables at a glance with semantic highlighting

Let’s say you have a really dense function or method, with lots of arguments passed in and lots of local variables. Syntax highlighting helps some, but can PyCharm do more?

In 2017.1, PyCharm ships with “semantic highlighting” available as a preference. What is it, what problem does it solve, and how do I use it? Let’s take a look.

It’s So Noisy

Sometimes you have really, really big functions. Not in your codebase, of course, because you are tidy. But hypothetically, you encounter this in a library:

2016-noselection

PyCharm helps, of course. Syntax highlighting sorts out the reserved words and different kinds of symbols: bold for keywords, gray for unneeded, yellow means suggestion, green for string literals. But that doesn’t help you focus on the parameter “namespaces”. Clicking on a specific symbol highlights it for the rest of the file:

2016-selection

That kind of works, but not only do you have to perform an action for each symbol you want to focus on, it also moves your cursor. It’s a solution to a different problem.

How can my tool help me scan this Python code without much effort or distraction?

IntelliJ Got It

As you likely know, PyCharm and our other IDEs are built atop the IntelliJ IDE platform. In November, IntelliJ landed an experimental cut of “semantic highlighting”:

“Semantic Highlighting, previously introduced in KDevelop and some other IDEs, is now available in IntelliJ IDEA. It extends the standard syntax highlighting with unique colors for each parameter and local variable.”

It wasn’t available in the IDEs, but you could manually enable it via a developer preference. Here’s a quick IntelliJ video describing the problem and how semantic highlighting helps.

With PyCharm 2017.1, the engine is now available to be turned on in preferences. Let’s see it in action.

Crank Up the Signal

Blah blah blah, what does it look like?

2017Our noisy function now has some help. PyCharm uses semantic highlighting to assign a different color to each parameter and local variable: the “namespaces” parameter is now a certain shade of green. You can then let color help you scan through the function to track the variable, with no distracting action to isolate one of them or switch focus to another.

To turn on semantic highlighting in your project, on a per-font-scheme basis, visit the Editor -> Colors & Fonts -> Language Defaults preference:

prefs

Your Colors Make Me Sad

The default color scheme might not work for you. Some folks have visual issues for red and green, for example. Some might have contrast issues in their theme or workspace. Others might simply hate #114D77 (we’ve all been there.)

If you make IDEs for long enough, you learn self-defense, and that means shipping a flexible means of customization:

colorpicker

The pickers let you assign base colors then gradients to tailor a wide number of local symbols to your needs and taste.

Learn More

PyCharm’s goal is to help you be a badass Python developer, and hopefully our use of semantic highlighting helps you make sense of dense code. We’re still working on the idea itself as well as the implementation, so feel free to follow along in our bug tracker across all our products, since this isn’t a PyCharm-specific feature.

And as usual, if you have any quick questions, drop us a note in the blog comments.

Posted in Cool Feature | Tagged | 7 Comments

PyCharm 2017.1 EAP 3 (build 171.2455.3)

We’re happy to announce the next EAP for PyCharm 2017.1, get it now from our website!

This week, we’ve fixed several issues, and added some functionality:

  • If you’d like PyCharm to watch your code style, we hope you’ll appreciate some new style options: closing braces can now be set either to line up with the last item or with the first character of a multi-line definition (Settings | Editor | Code Style | Python | Wrapping and Braces | Hang closing brackets, see PY-10182 for an example) . Also, if you like spaces around your parameters, you can now specify whether or not there should be spaces between the parentheses if a method has no parameters (Settings | Editor | Code Style | Python | Spaces | Within | Empty method call parentheses).
  • Various bugs regarding typing have been fixed
  • The VCS branches popup has been redesigned (Alt+`, option 7 ‘Branches’)
  • External tools after git commit
  • And more, see the release notes for details

Download it now from our website! To keep up-to-date with our EAP releases set your update channel to Early Access Program: Settings | Appearance & Behavior | System Settings | Updates, Automatically check updates for “Early Access Program”

-PyCharm Team
The Drive to Develop

Posted in Early Access Preview | Tagged | 2 Comments

PyCharm 2017.1 EAP 2 (build 171.2272.11)

After the Christmas break we’ve resumed work, and today we’re releasing our second EAP for PyCharm 2017.1. In this version we’ve fixed a couple of issues:

  • If you use Docker on macOS, you’ve probably been using the SOCAT workaround. You don’t need to anymore, we’ve resolved the issues with unix sockets.
  • Code completion now finds Flask modules while you’re adding an import statement for them
  • An issue where a ‘~’ in the path would cause the debugger to raise an exception has been resolved.
  • And more, see our release notes

Furthermore, we’ve added a new feature. If you have a main function in one of your scripts, you can now run it quickly using the ‘run’ icon in the gutter next to your function:

name_main

Get it now from our website!

-PyCharm Team
The Drive to Develop

Posted in Early Access Preview | Tagged | 5 Comments

Webinar: Adding a REST API to a Django Application

Calvin Hendryx-Parker (CTO of sixfeetup, and founder of the Indianapolis-based IndyPy user group) hosted a webinar for us where he showed how to add a REST API to a Django application.

In the webinar, he shows how to use djangorestframework. This library makes adding a REST API to a Django application very easy. The framework supports serving JSON and HTML endpoints by default, but can be extended to support other formats like XML and CSV.

Calvin discusses how to use viewsets and routers to make the code concise and effective. Furthermore he shows how to add authentication to the API.

To follow along with Calvin, you can clone the repository from GitHub. To do this right in PyCharm go to VCS | Checkout from Version Control | GitHub, and then use the following repository URL: https://github.com/sixfeetup/ElevenNote.git

PyCharm Professional Edition has several features which make Django development a lot easier: tight integration with the framework itself for the manage.py console, and tailored run configurations. Other Professional Edition features that make web development easier are for example the REST client, and the built-in database tooling (from DataGrip, the JetBrains database IDE).

Please keep in mind that Calvin uses several features that are available only in PyCharm Professional Edition, if you’re using PyCharm Community Edition you can try these features 30 days for free by downloading the latest version of PyCharm Professional Edition.

If you have any questions or comments about the webinar, feel free to leave them in the comments below, or you can reach us on Twitter. Calvin is on Twitter as well, his Twitter handle is @calvinhp.

-PyCharm Team
The Drive to Develop

Posted in Webinar | Tagged | Leave a comment

PyCharm 2016.3.2 Released

Right before the end of the year we’d like to release our latest and greatest version of PyCharm 2016. This version resolves a few issues:

  • Jupyter Notebooks have been updated to work with the updated Jupyter Notebooks API
  • Conda environments on Windows will now automatically be activated in the terminal
  • Various improvements to the Python console
  • Docker-compose environment variable handling on macOS (TLS verify errors)
  • And various other bugs, see the release notes for details

To get this improved version, you can download it from our website. Once patch updates are ready for your platform, you’ll get a notification, so you can update from within PyCharm, by choosing Help | Check for Updates on Windows and Linux, or by choosing PyCharm | Check for Updates on macOS.

Thank you for your interest in PyCharm, and we’d like to wish you a happy and productive 2017!

-PyCharm Team
The Drive to Develop

Posted in Release Announcements | Tagged | 15 Comments

PyCharm 2017.1 Early Access Program Started

Even though PyCharm 2016.3 was only released last month, we haven’t been idle, and we have been working hard on improving PyCharm. If you want to have a sneak peek at what’s coming in the next version of PyCharm, you can download our Early Access Program (EAP) versions which we will be releasing regularly from now on until the release.

In this first EAP release for PyCharm 2017.1 we’ve included these features:

  • Zero latency typing as a default. Pavel Fatin, a developer at JetBrains, has done extensive research into editor latency. With his improvements, typing in IDEA-based IDEs (like PyCharm) is now faster than it is in editors like Atom, Sublime Text, Emacs and Notepad++.Editor latency in Linux (XML file)
  • Semantic highlighting assigns colors to function parameters so you can see at a glance where they’re being used in the function.semantic-highlighting
  • Breadcrumbs let you know where you are within your project. Very useful when you’re working with deep hierarchies.breadcrumbs
  • Better VCS log viewer: you can now search a commit using regex, and choose whether or not the search is case sensitive.vcs-log
  • Web development improvements from WebStorm: Mocha test integration and ECMAscript 6 array intentions. See the WebStorm blog for more details!

Several bugs have been fixed as well:

  • Flask extension namespaces (deprecation of flask.ext.*) [pro only]
  • Passing arguments from Tox run configuration [pro only]
  • Django test runner hanging on error creating a database [pro only]
  • BDD: Running scenario outlines separately [pro only]
  • A number of fixes for code insight and type checking
  • Hangs on live templates invocation
  • A few fixes for code refactorings
  • Show command line after running a script

We’d like to invite you to try this EAP build and to let us know how you like it. If you encounter any issues with the EAP you can report an issue on our issue tracker. You can also reach out to us by commenting on this blog post, or by tweeting us. If you’d like to let us know about a feature you’d like us to develop, please let us know as well!

Finally, we’d like to wish you a happy 2017, we hope your code in the next year will be better than ever before!

-PyCharm Team
The Drive to Develop

Posted in Early Access Preview | Tagged | 20 Comments

What’s New Webinar, Behind The Scenes

Earlier this month I did a What’s New in PyCharm 2016.3 webinar which toured the new features in 2016.3: Python 3.6, Django, web, VCS, and platform. Rather than a simple feature list, I took a different approach. We received some useful feedback, so I thought I’d write a recap and share some thoughts.

First, these webinars are really fun for me, both on the preparation and the webinar itself. But for full disclosure — it’s a surprising amount of work. Foremost, PyCharm itself is now so mature that the new features include some serious machinery. Branch coverage? If you don’t know it, you can’t cover it (pun intended). I had to spend a good bit of time learning more about coverage, profiling, and more.

I’ve recently been contributing to the arcade package for 2d Python games, so I used it as the testbed for exploring development stuff I should know, but don’t. Along the way, I came to a conclusion about webinars: I should show new features in the context of regular development, rather than a high-speed car chase through new functionality. This is something my boss Hadi Hariri has been pushing us developer advocates on: cover the why as much as the what.

I decided to show the Python features in the regular course of writing a 2d game. It meant, though, that my challenge greatly increased: I needed a sequential script that introduced disparate “What’s New” items without seeming contrived. My sequence went through a lot of throw-away-start-over cycles.

How did it go? It seemed to go well. It certainly felt more valuable — not to mention, more fun — to show “Faster VCS Log Searches” as part of regular open source project coding. The feedback seemed to agree: most of the input zeroed in on this aspect and said they liked it.

Here were some of the better suggestions on how to improve the webinar:

  • It was densely-packed, so provide the outline/transcript in advance, plus reference links.
  • Pause more during execution, to let GoToMeeting (our webinar software) lag catch up.

Our survey also asks for topics for future webinars. Some of the common themes:

  • DataGrip, our IDE-for-Databases that is bundled in PyCharm Professional. I showed a tiny bit of it and I think it blew people away.
  • More Django (in fact, it’s the next webinar)
  • Test coverage, profiling, and other core skills
  • Python for data science
  • Remote development (Vagrant, SSH, Docker, etc.)

Got other webinar ideas? Have something interesting to say and would like to do a webinar? Drop us a note in the comments, or send me an email, and let us know.

All in all, this new approach to doing What’s New webinars via actual development, instead of features-as-laundry-list, looks like a keeper. I’ll refine it to get better in the future. If you have a chance, watch the recording and let us know what you think.

Posted in Uncategorized | Leave a comment

PyCharm 2016.3.2 Release Candidate

We are pleased to announce the release candidate of PyCharm 2016.3.2, get it now from our EAP page.

In this version we’ve fixed bugs in the following areas:

  • Conda environments on Windows will now automatically be activated in the terminal
  • Various improvements to the Python console
  • Docker-compose environment variable handling on macOS (TLS verify errors)
  • And various other bugs, see the release notes for details.

We encourage you to try out this pre-release build, if you encounter any issues while using it please let us know on our issue tracker! If you’d like to suggest to us how we can make PyCharm better, please let us know on the issue tracker as well.

-PyCharm Team
The Drive to Develop

 

Posted in Early Access Preview | Leave a comment

PyCharm Edu 3.5 Early Access Program is Open

The holiday season is a great time to have fun, and it is also a great time to learn something new. That’s why today we’re opening the Early Access Program for PyCharm Edu 3.5 – the next update of our free tool for learning and teaching programming with Python.

What is Early Access Program?

We at JetBrains believe that making tools for developers involves listening carefully and responding to the opinion of everyone using our products – from students and their teachers to novice and experienced developers. The Early Access Program (EAP) allows you to try pre-release versions of our software to evaluate features that will be added in the next release. Your feedback is more than welcome, so please share it here in the comments or report issues to our tracker!

It is important to distinguish EAP from traditional pre-release software. Please note that the quality of EAP versions may at times be far below the usual beta standards. If you are looking for a stable version of PyCharm Edu, please visit our site.

Continue reading

Posted in Cool Feature, Early Access Preview | Tagged | 3 Comments

Webinar: Extending a Django App with REST Capabilities using PyCharm, January 10th

Join us January 10th at 3pm GMT (4pm European time, 10am Eastern time) for our free webinar “Extending a Django App with REST Capabilities”.

  • Tuesday January 10th
  • 16:00 European Time, 10:00 Eastern Time
  • Register here

Django REST Webinar

 

This hands-on webinar will teach you how to leverage Python and Django to extend an existing web application and add REST capabilities. The webinar begins with an overview of an existing Django application built to track notes and then dives into adding REST using the Django REST Framework. Attendees can follow along as we build the Notes web application. We will show case using PyCharm to inspect the database and test our API. We will also look at debugging the application with the powerful PyCharm debugger.

About the presenter

Calvin Hendryx-Parker is the co-founder and CTO of Six Feet Up, a Python web application development company focused on deploying content management systems, intranets and portals, as well as custom web apps using Django, Pyramid and Plone. Under Calvin’s technical leadership, Six Feet Up has served organizations like Amtrak, Eli Lilly, NASA, UCLA and the United Nations.
As an advocate of open source, Calvin is also the founder and organizer of the IndyPy meetup group and Pythology training series in Indianapolis. In 2016 Calvin was nominated for a MIRA Tech Educator of the Year Award.

Register now, and we’ll remind you when it’s about to start.

A recording of this webinar will be placed on YouTube, this will be announced on this blog and our Twitter account.

Posted in Webinar | Tagged | 6 Comments