JetBrains Fleet 1.42 Help

Getting started with Python

This tutorial gets you up to speed with Python development in JetBrains Fleet. It covers the installation, project setup, and working with code.

Prerequisites

  • JetBrains Toolbox 1.22.10970 or later: the Download page.

  • Supported Python versions: 2.7 and from 3.6 up to the version 3.11.

  • Supported Python virtualenv: .venv/ or venv/ directories, projects that contain Pipfile or Poetry pyproject.toml files

Installing software

Download and install Python

  • Download the version of Python that corresponds to your operating system: https://www.python.org/downloads/

    If you are on Windows, you can download Python from the Microsoft Store.

Download and install Fleet

  1. Download and install JetBrains Toolbox.

  2. In JetBrains Toolbox, click Install near the JetBrains Fleet icon.

    Download and install Fleet

Set up a workspace

Workspace is the directory where your project resides. It contains the project files and settings. You can open an existing project or start a new project by opening an empty directory.

Open a workspace

  1. Press ⌘ O or select File | Open from the menu.

  2. In the file browser, navigate to the folder containing your code and click Open.

  3. The directory content appears in the Files panel. The workspace is added to list of the recently viewed workspaces.

    Open an existing workspace

Configure a Python interpreter

In Smart mode, which will be covered later, JetBrains Fleet automatically detects a virtual environment and configures a Python interpreter if your project workspace contains any of the following:

  • .venv/ or venv/ directories

  • Pipfile

  • Poetry pyproject.toml file

If none of the above is found, JetBrains Fleet will look for a Python executable in default locations.

Otherwise, you can configure a Python interpreter manually as described below.

Configure a Python interpreter for the workspace

  1. Do one of the following:

    • Click the Python interpreter selector in the bottom-right corner of the JetBrains Fleet window:

      Selecting a Python interpreter in the widget
    • Press ⌘ , and switch to the tab with the project settings. Then click the Python drop-down in the Toolchains | Python section:

      Selecting a Python interpreter for the workspace
  2. Do one of the following:

    • Select one of the previously configured Python interpreters

    • Click Add, and then specify the path to a Python executable.

Enabling Smart Mode

You can use JetBrains Fleet as a smart text editor, rather than a full-fledged code editor. However, if you need code intelligence features, you can enable them by turning the Smart Mode on.

Enable smart mode

  • In the top-right corner of the window, click Smart Mode, then Enable.

    After you click the Enable button, you may have to wait for some time, while the backend is being prepared.

    Smart mode popup

Here's what you can do in Smart Mode. The below is not an exhaustive list of Smart Mode features, rather a couple of examples that'll help you to get the feel of how it works in Fleet.

Use quick-fixes and intention actions

  • Press ⌥ ⏎ to access actions that Fleet suggests in the current context.

    invoke intention actions

Refactor code

  • Place the caret at a literal or select an expression, press ⌃ R, and enter the new name for the variable.

    renaming a variable
  • Navigate to the declaration of a symbol with ⌘ B.

  • Use code interlines to navigate to usages and hierarchy members.

  • Skim over the errors with ⌘ E and ⌘ ⇧ E.

Running your code

With Smart Mode enabled and a configured Python interpreter, you can run your project. For that, you can use a gutter icon in the editor, or you can create a run configuration that will allow you to fine-tune the way your application should be run.

Run from the editor

  • Navigate to the entry point of your application and click the run icon in the gutter. Select Run `main`.

    Running a script using a gutter icon

    The results of script execution are shown in the bottom panel.

    Script is executed in the bottom panel

As mentioned before, another way to run a program is to use a run configuration. For more information, refer to Create and launch a run configuration.

Last modified: 26 May 2024