- Install the recommended VSCode extensions. This includes
pylint
(Python linting) andblack
(Python formatting). VSCode is setup via thesettings.json
to format on save.
Tip
I've specified recommended extensions, you can install them in VSCode by using the "recommended" filter.
-
Install
SageMath
as described here. -
Access the
sage
shell by typingmamba activate sage
and thensage
in your terminal. Then install thepylint
package:pip install pylint
. Otherwise, you won't be able to format/lint the Python code. -
After that, reload the VSCode window and Pylint should be good to go even inside Jupyter notebooks. With the cursor positioned in a Jupyter notebook code cell (not inside a markdown cell), press
Ctrl + Alt + L
(orShift + Alt + F
if the first one is not working) to format/lint the code. If none of these shortcuts are working, open the command palette in VSCode (Ctrl + Shift + P
) and typeFormat Document
orFormat Cell
.