(Optional) Using VS Code with Python

You can use VS Code with Python.

To take full advantage of VS Code Python tools, you must install the Python extension into the remote ssh session. You must install the extension the first time you connect a newly configured remote session.
  1. Install the Python extension.
  2. With the Extension installed, once you open your first python file, you will be prompted to install pylint Linter.
  3. Click Install.
    VS Code opens a terminal and runs the code needed to install the linter. It's important to note that this is a remote terminal, running on an engine in Cloudera Machine Learning. It's the same as if you launched a terminal inside a running workbench.
  4. If you want to run arbitrary Python code inside VS Code, open a Python file, select some code, right click, and select Run Selection/Line in Python Terminal.
    You can also just hit Shift-Enter in the code editor window. This will open up a new terminal if there isn’t one and run the selected code. Since this is a remote session, you can run pyspark directly inside VS Code.
    For more complex code requirements, you can also use the Python Debugging feature in VS Code.