Getting started with Python
This tutorial helps you get started with Python development in JetBrains Fleet. It covers installation, project setup, and working with Python code.
Prerequisites
Download and install JetBrains Toolbox
Download and install JetBrains Toolbox.
For macOS, you can also download the installer that matches your processor type: Apple Silicon or Intel. Ensure you select the correct option based on your system's processor.
Download and install JetBrains Fleet
In JetBrains Toolbox, click Install next to the JetBrains Fleet icon.
Python environment
JetBrains Fleet supports the following Python versions:
Supported Python versions: 2.7 and 3.6 through 3.11.
Download the version of Python that matches your operating system from the official website.
If you are on Windows, you can also download Python from the Microsoft Store.
Supported Python virtual environments: .venv/ or venv/ directories, or projects that contain a Pipfile or a Poetry pyproject.toml file.
Set up a workspace
A workspace is the directory that contains your project. It includes both project files and settings. You can either open an existing project or start a new one by opening an empty directory.
Open a workspace
Press ⌘ O or select File | Open from the main menu.
In the file browser, navigate to the folder containing your code and click Open.
Configure a Python interpreter
In Smart Mode, which is 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
A Poetry pyproject.toml file
Otherwise, you can configure a Python interpreter manually, as described below.
Configure a Python interpreter for the workspace
Do one of the following:
Click the Python interpreter selector in the bottom-right corner of the JetBrains Fleet window:
Press ⌘ ,, switch to the project settings tab, and click the Python drop-down in the Toolchains | Python section:
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 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.
JetBrains Fleet provides a variety of coding assistance features. Below are a few examples to help you get a sense of how they work in practice. This is not a complete list, but a good starting point for exploring what JetBrains Fleet can do.
Use quick-fixes and intention actions
Press ⌥ ⏎ to access actions that Fleet suggests in the current context.
Refactor code
Place the caret at a literal or select an expression, press ⌃ R, and enter the new name for the variable.
Navigate the codebase
Navigate to a symbol’s declaration by pressing ⌘ B.
Use code interlines to navigate to usages and hierarchy members.
Navigate between errors using ⌘ E and ⌘ ⇧ E.
Running your code
With Smart Mode enabled and a configured Python interpreter, you can run your project. You can use the gutter icon in the editor or create a run configuration to fine-tune how your application is executed.
Run from the editor
Navigate to the entry point of your application and click the run icon in the gutter. Select Run `main`.