Webinar: “Live Development of a PyCharm Plugin” with Joachim Ansorg

Update: Joachim has made a repo available with the contents he will show in the webinar.

PyCharm comes with a lot of functionality, yet perhaps something you’d like is missing. Luckily it’s made to be enhanced by plugins to be suitable for a much wider range of users. This webinar with noted IntelliJ/PyCharm plugin consultant Joachim Ansorg will show you how such a plugin is built for PyCharm.

  • Tuesday, January 15, 2019
  • 6:00 PM – 7:00 PM CET (12:00 PM – 1:00 PM EST)
  • Register here
  • Aimed at intermediate/advanced PyCharm users

r-2

Speaking to You

Joachim is a self-employed software developer, specializing in IntelliJ plugin development.

Born in 1982, he studied CS at a small university in Germany. After that he worked for a year as a software developer on the beautiful island of Crete in Greece. He failed to learn Greek there but is able to read and write the simpler alternatives like Java, Kotlin, and Go.

When he moved back to Germany he joined a smaller software company for about 8 years as a Java developer. He became self-employed in early 2017 to create plugins for IntelliJ and is enjoying this a lot.

Joachim is happily married to his wife Lisa and is living in southern Germany, about 15 minutes away from Basel/Switzerland.

Posted in Webinar | 1 Comment

PyCharm 2018.3.2

PyCharm 2018.3.2 is now available. This version comes with a couple of small improvements. Get it now from our website.

Improved in This Version

PyCharm splits F-strings for you

In PyCharm 2018.3, we improved a lot of things in F-strings, and we’ve just improved them a little further. When splitting an F-string in previous versions of PyCharm, this is the behavior:

F-strings 2018.3.1

Although this behavior is in line with what you’d expect from a text editor, wouldn’t it be nice if PyCharm could help you a little further? So we’ve made sure that breaking up an F-string in PyCharm 2018.3.2 leaves you with a valid Python file:

F-strings 2018.3.2

Further improvements

Interested?

Get PyCharm now on our website

If you’re on Ubuntu 16.04 or later, you can use snap to keep your PyCharm up to date. You can find the installation instructions on our website. Snap also works for various other Linux distros.

On Windows, macOS, and Linux, you can use our helpful Toolbox App to keep all of your JetBrains IDEs up to date. Read more about the app on our website

Posted in Release Announcements | Tagged | Leave a comment

Webinar Recording: “Automating Build, Test and Release Workflows with tox” with Oliver Bestwalter

Last Thursday we had a special webinar in our Munich offices with Oliver Bestwalter, talking about tox and release automation. The recording is now available.

w

Many thanks to Oliver for covering quite a lot of material with a good audience in just over an hour. I found the webinar very valuable: lots of things I need to know, that would be hard to figure out on my own, conveniently packaged and delivered by the maintainer of tox.

If you have any questions for us or for him, please feel free to leave comments below on this blog post.

-PyCharm Team-
The Drive to Develop

Posted in Video, Webinar | Tagged | Leave a comment

PyCharm 2018.3.2 RC

PyCharm 2018.3.2 Release Candidate is now available. This version comes with a couple of small improvements. Get it now from our Confluence page.

Improved in This Version

PyCharm splits F-strings for you

In PyCharm 2018.3, we improved a lot of things in F-strings, and we’ve just improved them a little further. When splitting an F-string in previous versions of PyCharm, this is the behavior:

F-strings 2018.3.1

Although this behavior is in line with what you’d expect from a text editor, wouldn’t it be nice if PyCharm could help you a little further? So we’ve made sure that breaking up an F-string in PyCharm 2018.3.2 leaves you with a valid Python file:

F-strings 2018.3.2

Further improvements

Interested?

Download the RC from our confluence page

If you’re on Ubuntu 16.04 or later, you can use snap to get PyCharm RC versions and stay up to date. You can find the installation instructions on our website.

The release candidate (RC) is not an early access program (EAP) build, and does not bundle an EAP license. To use PyCharm Professional Edition RC, you will need a currently active PyCharm subscription. If none is available, a free 30-day trial will start.

Posted in Early Access Preview | Tagged | Leave a comment

Reminder: Webinar this Thursday, “Automating Build, Test and Release Workflows with tox” with Oliver Bestwalter

Interested in testing and release automation? We’re doing a webinar with Oliver Bestwalter of tox fame, this Thursday. Join us to learn more about test isolation with tox as well as how it fits in with a larger ecosystem of repeatable release processes.

  • Thursday, December 13
  • 4:00 PM – 5:00 PM CET (10:00 AM – 11:00 PM EST)
  • Register here
  • Aimed at intermediate Python developers

Webinar Bestwalter Register

Agenda

We will look at what is necessary to automate all important workflows involved in building, testing and releasing software using tox.

We’ll cover how to use tox to …

  • run static code analysis, automatic code formatting/fixing as a separate stage orchestrated by the pre-commit framework
  • run tests with pytest
  • measure and report test coverage
  • build and upload packages to pypi/devpi/artifactory

All this can be run and debugged locally from the command line or programmatically.

Posted in Webinar | Leave a comment

Interview: Oliver Bestwalter for tox webinar next week

Python has long distinguished itself with a culture of testing. In the last decade, two libraries have combined to give powerful testing in isolation — pytest and tox. The latter combines easily with pytest to give you a clean environment across test runs, including across multiple versions of Python.

tox certainly counts as one of those things lots of PyCharm customers know they should know, but don’t yet know. To make it easy to break the ice we’ve invited Oliver Bestwalter to introduce tox in a PyCharm webinar. Oliver is the maintainer of tox and advocate for release automation in projects.

Webinar Bestwalter Register

Here’s our interview with Oliver. As background, Oliver was previously interviewed on The Mouse vs. Python blog and the Test & Code podcast.

Give us a sneak peak on what you’re going to discuss in the webinar and what audience it is aimed at.

I want to do a time lapse journey through a hypothetical project that grows tests and automation over its lifetime. The focus will be on how to use tox to bundle all these development and automation tasks into a workflow that works well locally and on CI.

Let’s go back in time. Can you give us your Python origin story?

The short version is: I stumbled over the tutorial in 2006 and fell in love. The longer version is in the interview you linked :)

You are a core maintainer of tox. What’s it like running a large, popular open source project?

When I joined the project, Holger Krekel (the original author) and the first generation of contributors had started to move on to other projects. Work around tox had cooled down, so I thought I’d help out a bit. There were quite a few open pull requests and issues that needed addressing. So I did that and after a while Holger asked me if I want to handle releases as well. I also made contact with plugin authors to gather tox plugins into the tox-dev organization to raise their visibility. My main focus was on keeping the project alive, fixing annoying bugs and creating a welcoming atmosphere. That’s a lot of work that doesn’t result in very much code, but I still think it was the right thing to do rather than to just hack away at the code.

Over the past few months I wasn’t quite able to even follow what is going on in the issue tracker for a number of private and professional reasons. At the moment my activities are concentrated more on teaching Python with a focus on testing and automation (with pytest and tox obviously). Luckily Bernát Gábor joined as a maintainer this year and is currently very active in the project (thank you Bernát!).

So to answer the question: in the beginning it was a good feeling to keep an important project alive and improve its processes, but for quite a while now it has also meant feeling guilty a lot of the time, because I can’t do more “direct” work for tox a lot of the time.

Testing is one part of your release automation vision. Can you discuss how other parts — pre-commit hooks, black, CI — fit together?

I think of all test and automation tools as helpers to build lines of defense (against bugs) in a development process. The first line of defense is static code analysis. Ideally the most obvious problems are already pointed out directly in the editor when they happen. PyCharm inspections and quick fixes are great for that if you crank them all up to 11. The next line of defense are linters and automatic fixers (like flake8 and black). The pre-commit framework wraps that and more into a neat package that can prevent you from accidentally committing code that has obvious problems. If you don’t use it locally the first stage in CI will fail where the same checks are run. The next line of defense are automatic tests. Depending on the nature of the project there might be more (like running tests against the deployed environment on different stages).

The role that CI plays for me is quite simple: CI is just a task execution and report collection tool and should contain as little process knowledge as possible. So nothing fancy should happen there that isn’t easily reproduced on a developer box. CI simply runs everything that the developers run locally and makes artifacts available for release. This means that the process knowledge needs to be encoded in the tox configuration and the automation scripts that live alongside the production code. The real world is often a bit more complicated and this isn’t always completely possible (often due to security considerations) but that’s the aim.

What’s been your experience using an IDE like PyCharm to visualize testing and the other pieces?

I am with Brian Okken on this: PyCharm is a really good GUI for pytest (see or better listen: Episode 48 of Test & Code)

The Test runner tab provides a good overview of the tests that were run and I also appreciate the many ways how I can navigate from the results back in to the relevant code sections. What I appreciate even more is the convenience of running the tests right from the code rather than having to switch to the command line. Also: auto-test – very handy. It’s also great that PyCharm even supports code completion and navigation for pytest fixtures in recent releases.

Look ahead 3 years from now. What’s next for tox and the release automation field?

My crystal ball is at the repair shop at the moment, but I’ll try :)

In respect to tox that really depends who steps up to the plate and champions the development of new features and improvements. If I get the chance, I want to improve interpreter discovery and squash some bugs. I also want to improve the documentation and make tox more accessible to newcomers. Regarding the recent changes in packaging (PEP-517 and PEP-518) tox already has everything in place. Projects using flit and other tools that leverage the sudden freedom from setup.py and setuptools can use tox, but I am sure there will be some kinks to iron out along the way. tox also needs to grow native support for pyproject.toml (meaning that you won’t need a tox.ini anymore and configure it there alongside all the other tools). In three years tox will also be 100% bug-free and powered by renewable energy :)

Regarding the greater landscape I really hope that the development will go even further into the direction we are already heading: making build, test and deploy automation as easy and accessible to the masses as possible. I’ll do my best to help with that.

Posted in Interview | Leave a comment

PyCharm 2018.3.1

PyCharm 2018.3.1 is now available, with various bug fixes. To update, choose Help | Check for Updates in the IDE, or download it from our website.

Improved in This Version

  • A fix for the recently added WSL support in PyCharm 2018.3
  • An issue where PyCharm couldn’t correctly authenticate over SSH using a passphrase-protected private key has been resolved
  • A few fixes for Docker and Docker Compose
  • Fixes for the embedded terminal
  • Many fixes coming from WebStorm, DataGrip and IntelliJ IDEA; see the release notes for details

Interested?

Get PyCharm now on our website

If you’re on Ubuntu 16.04 or later, you can use snap to keep your PyCharm up to date. You can find the installation instructions on our website. Snap also works for various other Linux distros.

On Windows, macOS, and Linux, you can use our useful Toolbox App to keep all of your JetBrains IDEs up to date. Read more about the app on our website

Posted in Release Announcements | Tagged | 2 Comments

PyCharm 2018.3.1 RC Out Now

PyCharm 2018.3.1 Release Candidate is now available, with various bug fixes. Get it now from our Confluence page.

Improved in This Version

  • A fix for the recently added WSL support in PyCharm 2018.3
  • A few fixes for Docker and Docker Compose
  • Fixes for the embedded terminal
  • Many fixes coming from WebStorm, DataGrip and IntelliJ IDEA; see the release notes for details

Interested?

Download the RC from our confluence page

If you’re on Ubuntu 16.04 or later, you can use snap to get PyCharm RC versions and stay up to date. You can find the installation instructions on our website.

The release candidate (RC) is not an early access program (EAP) build, and does not bundle an EAP license. To use PyCharm Professional Edition RC, you will need a currently active PyCharm subscription. If none is available, a free 30-day trial will start.

Posted in Early Access Preview | Tagged | 2 Comments

Let PyCharm Do Your Import Janitorial Work

What’s something you do all the time in Python? Import modules from packages. Not just that, you also fiddle with the formatting to make the style nannies happy. And remove unused imports. And bunches of other janitorial tasks.

Let PyCharm be your janitor. PyCharm has tons of support to take over this mundane drudgery, from auto-import to re-organizing your import lines, with settings to customize its work.

This support is both super-helpful and underappreciated. Let’s solve that with a deep dive on PyCharm’s import support, including new import styling features in PyCharm 2018.3.

Zen Coding

You’re coding away, in the zen flow, and then…you want to use the requests library. It’s installed in your virtualenv, you just need to import it. So away you go, up to the top of the file, looking for the right place to manually import it.

Manual

Instead, let PyCharm do it for you. Start typing part of requests and type Ctrl-Space-Space. PyCharm will offer a completion. When you accept it, PyCharm will complete the symbol and also generate the import.

CtrlSpaceSpace

Sometimes you cut-and-paste some code and already have requests typed out completely. Or, perhaps you can type faster than doing autocomplete. Put your cursor somewhere in requests and hit Alt-Enter to bring up the Code Inspection. PyCharm has a choice to Import this name. As with Ctrl-Space, PyCharm generates the import:

AltEnter

If you already have an import from that package, PyCharm merges into the existing import line:

Merge Import

PyCharm calls this the Import Assistant. You stay where you are, it manages the import.

Generating the import is half the annoyance. Equally frustrating? Constant gardening of the long list of imports: re-sorting, pruning unused imports, joining or splitting. Janitorial work like that is what PyCharm lives for.

First, let’s put our imports into a messy state: bad sorting and unused imports.

Use the Optimize Imports action to let PyCharm clean this up. You can trigger this action with Ctrl-Alt-O but, if you haven’t memorized that, use Find Action. The result: nice import lines:

Optimize Imports

PyCharm can optimize imports in a single file. But you can also optimize imports across the entire project. Select the folder at your project root, then trigger Optimize Imports (from the menu, the shortcut, or Find Action.)

Working with Packages

That’s two drudgeries in the bag already — generating imports and gardening the import list. Here’s another: what if you don’t have the package installed yet?

We saw with imports the zen mode: you start typing and tell PyCharm to do the work. Same here: type your import, hit Alt-Enter, and choose Install and import package:

Maya

This is explained further in the tip on the help page.

Thus, in the middle of using the import, rather than interrupt your flow, tell PyCharm to go install the package into your project interpreter. As a bonus, if you have a setup.py or requirements.txt registered with your project, then PyCharm can record this package as an entry. That’s a nice flow.

07 Requirements Poster

Import Preferences

PyCharm follows PEP 8’s guidance on import style. For example, PyCharm will warn you if you have an import mixed into your module code, instead of at the top. By default, Optimize Imports will do the joining and sorting from PEP 8. And finally, if you generate another import from an already-imported package, PyCharm will add the new symbol to the existing import line.

What if you want some flexibility? PyCharm’s project preferences let you change sorting and the joining behavior:

Preferences

I have a colleague who wants easier-to-track diffs by putting each import on its own line. PyCharm lets you toggle this setting, switching from joining imports to splitting them.

Split Imports

JavaScript and CSS Too

But wait, there’s more. If you do frontend development (JavaScript, HTML, CSS) in PyCharm Professional, then you get all of this and even a little more, on that side of the fence: imports in ES6, CSS, SASS, and more.

Narrated Video

We often say that a big part of PyCharm’s value is how it does the janitorial work for you. Managing imports is a perfect example of that.

Posted in Cool Feature, Tutorial | Tagged | 2 Comments

PyCharm 2018.3 Out Now

PyCharm 2018.3 is now available: Windows Subsystem for Linux (WSL) support, multiline TODOs, improved search everywhere, and more.

Download PyCharm 2018.3

New in PyCharm

  • For those of you on Windows who are developing applications that run on Linux: Windows Subsystem for Linux is a quick and easy way to always have a Linux environment available. PyCharm 2018.3 can now be configured to use a Python interpreter inside WSL.
  • One of the most-requested features in our issue tracker were multiline TODOs, and we’re happy to announce that these are now available in PyCharm 2018.3.
  • Even though search everywhere (double-shift) is not at all a new feature, we’ve made some great usability improvements, and now it’s easy to see how you can narrow down the results.

Read more about new features on our website. You can also find the full release notes here.

Upgrade Now

To get the new version of PyCharm, upgrade in one of the following ways:

Do you have questions, complaints, or suggestions? Please reach out to us! Send questions to our support team, report bugs and suggestions on our issue tracker, or just connect with us on Twitter.

Posted in Release Announcements | Tagged | Leave a comment