Python support in Upsource

The latest Upsource release brings Python code insight functionality to help developers understand new changes in a familiar manner and be more efficient when reviewing them.
The code insight features in Upsource include server-side static code analysis and code-aware navigation. These features allow you to understand code better when browsing through it and perform code reviews more efficiently. Let’s take a look at them.

Navigation

It might seem like a trivial thing, but the ability to navigate through the code is something we simply take for granted when using an IDE. Yet these features are often missing when viewing code in a web-based tool. Upsource, however, lets you click on a symbol to navigate to its declaration.

Python Navigation

When there’s a new change, you most likely would like to see its impact. Say, if a function has been modified, you’d probably want to know how it affected its usages. You can see in the screenshot above that you can simply highlight symbol’s usages in the file when browsing it, or find all usages. When viewing the contents of a commit, in addition to Find Usages action, you can get a usages diff that helps to learn how this change affected the usages of a particular symbol.

Find Usages

Intuitive navigation is great for a reviewer as it lets you browse through the code in a way that’s natural for you, rather than having some arbitrary order imposed on you – it makes it easier to see the context of the changes under review.

Static code analysis

There’s another IDE feature that would be extremely useful during code review – code inspections. You’re probably used to an IDE, like PyCharm, giving you pointers on where the code could be simpler, clearer, and generally a bit better. If your code review tool offered the same kind of advice, it would be easier to evaluate the quality of the code.
Python Code Inspections

Introduced and fixed issues

You can see the static code analysis results for any revision when simply browsing the code or doing a code review. However, when a change is part of a code review, you get additional help from Upsource. It shows what problems have been fixed with the new change and what new possible issues the change introduced.

Introduced issues

Upsource aims to make code review not only as painless as possible but also provide as much help as a tool can, freeing you up to worry about the things that humans are really good at.

Great! How do I get started?

To configure Python support in Upsource, go to the Code Intelligence in your project’s settings. Choose the version of Python and make sure to have python, pip, and virtualenv installed on your Upsource service. Happy reviewing!

This entry was posted in Feature. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *