Configure Python IDE Environment - SVF-tools/Software-Security-Analysis GitHub Wiki

1. Prerequisite:

2. Run with VSCode

If you encounter some problem, please check this document Trouble-Shooting-for-IDE.

2.1 Working with VSCode in Docker containers

Install extensions in VSCode

*To install the extension, open the Extensions view (MAC: โ‡งโŒ˜X, Windows: Ctrl+Shift+X, Linux: Ctrl+Shift+X)
  • Extension(1): Docker extension
    • Search for docker to filter results and select Docker extension authored by Microsoft.

width=600px

  • Extension(2): Remote Containers extension
    • Search for dev container to filter results and select extension authored by Microsoft.

width=600px


Load Docker container in VSCode

Right click the container item and select 'Attach Visual Studio Code'

width=600px

If you can't see the working directory, please select file -> open (folder)... then enter the /home/SVF-tools/Software-Security-Analysis

width=600px


Install/Enable Python Debugger extension in container

- To install the extension, open the Extensions view (MAC: โ‡งโŒ˜X, Windows: Ctrl+Shift+X, Linux: Ctrl+Shift+X)

- Search for Python Debugger and select Docker extension authored by Microsoft.

width=600px


2.2 Run and debug your program

  • VSCode's built-in debugger helps your editing, compilation and debugging.

  • Check that python interpreter should be /usr/bin/python3. Click Search - Show and Run Commands - Python: Select Interperter, and choose /usr/bin/python3, which should be Python 3.10.

width=600px width=600px

  • Software-Security-Analysis has prepared configurations in launch.json in .vscode folder to debug test.py in ${workspaceFolder}/python/Assignment-1/Python folder.

width=600px

Switching programs

When working on different labs/assignments, change the "program" and "args" fields in launch.json

Lab/Assignment "program" "args"
Assignment-1 "${workspaceFolder}/python/Assignment-1/Python/Main.py" "-icfg", "Assignment-1/Tests/testcases/icfg/test1.ll"
Assignment-2 "${workspaceFolder}/python/Assignment-2/Python/Main.py" "Assignment-2/Tests/testcases/sse/test1.ll"
Assignment-3 "${workspaceFolder}/python/Assignment-3/Python/Main.py" "Assignment-3/Tests/ae/test1.ll"

3. Run with PyCharm

PyCharm is a powerful Python IDE. This section explains how to set up your project and work with pysvf using PyCharm on Linux/macOS and Windows (via Docker).


3.1 Install PyCharm


3.2 Install Required Python Packages

If you're using Linux or macOS, you can install pysvf directly in PyCharm terminal:

python3 -m pip install pysvf -i https://test.pypi.org/simple/

For Windows users, follow these steps to configure PyCharm with Docker:

  1. Navigate to File > Settings > Project > Python Interpreter

  2. Click Add Interpreter and select On Docker width=800px

  3. Select Pull or use existing, enter svf-tools/software-security-analysis in the Image tag field, then click Next width=800px

  4. If no errors appear in the output field, click Next width=800px

  5. Click Create to finish the setup width=800px

  6. Return to the Python Interpreter settings. If you see Remote Python 3.10.17 Docker(svf-tools/software-security-analysis), the configuration was successful width=800px