PyCharm#
Overview#
This page is aimed at developers who use PyCharm as their integrated development environment (IDE) for Mantid Imaging development.
It includes:
Opening the Mantid Imaging project in PyCharm
Configuring the project interpreter
Optional save and formatting settings
How-to Guides#
How to open and prepare PyCharm for Mantid Imaging development#
Prerequisites#
Before starting, ensure you have:
An installed copy of PyCharm
A clone of the Mantid Imaging repository
A configured Mantid Imaging developer environment (see Getting Started guide)
Opening the project#
Open PyCharm
Click
Openon the welcome screen (orFile -> Open)Select your local
mantidimagingsource directory
PyCharm will index the project and detect Python files automatically.
Selecting the Python interpreter#
Open
File -> Settings(Windows/Linux) orPyCharm -> Settings(macOS)Navigate to
Python -> InterpreterClick
Add Interpreterand select the environment that matches your Mantid Imaging developer setup (for example,mantidimaging-dev)Apply the changes
Verify that the selected interpreter is correct by checking the interpreter shown in the status bar and by opening the Python Console in PyCharm.
If you are using Pixi, select the interpreter from the local Pixi environment in .pixi/envs/dev.
How to configure save behavior#
PyCharm saves files automatically in most workflows (for example when switching windows or running code). To tune this behavior:
Open
File -> Settings -> Appearance & Behavior -> System SettingsEnable or adjust the save options for your preferred workflow
How to disable auto-format on save#
PyCharm can run formatting actions automatically on save using Actions on Save.
Open
File -> Settings -> Tools -> Actions on SaveDisable actions such as
Reformat codeandOptimize importsif you do not want automatic formatting on save
See Also#
PyCharm Plugins and Keybindings - A list of required and recommended plugins and settings for PyCharm.
Keybindings - Commonly used keyboard shortcuts in PyCharm for efficient coding and navigation.
How to debug Python tests - A guide on setting up and using the debugger for Python development.