First be sure you can run rotki locally using the build from source install directions
- Open the root rotki folder in a vscode instance
- Install the
Pythonvscode extension - Create a new launch configuration (
Run -> Add configuration...) of typePython - Update the
launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python Backend",
"type": "python",
"request": "launch",
"module": "rotkehlchen",
"env": {
"GEVENT_SUPPORT": "True"
},
"args": [
"--api-port",
"4242",
"--api-cors",
"http://localhost:8080",
// "--data-dir",
// "${workspaceFolder}\\data-dir"
]
}
]
}- Press
Ctrl+Shift+Pand selectPython:Select Interpreter - Select your phython virtual environment for the rotki app
- Verify in the status bar at the bottom of vscode that the virtual env and correct debug configuration is selected
- Set a breakpoint in the unlock_user function in
rotkehlchen.py(Press Ctrl+P to search for files) - Open the
Runpanel, selectPython Backendfrom the dropdown in the header and press the green arrow to start debugging - Vscode should open a new "Python Debug Console" terminal window and you should see the message
Rotki API server is running at: 127.0.0.1:4242
- Open a new instance of vscode and open the
electron-appdirectory - Ensure the
Debugger for Chromevscode extension is installed - Follow the instructions here
- Add the env section to the "Electron:Main" configuration (updating the
VIRTUAL_ENVdirectory as necessary):
"env": {
//"IS_TEST": "true",
"VIRTUAL_ENV": "C:\\Users\\Charlie\\Envs\\rotki",
"SKIP_PYTHON_BACKEND": "True"
},- Update your vue.config to point to the
dist_electrondirectory -OR- update your launch.jsonargsandoutFilesto point to the./distdirectory - Set a breakpoint at the first line of the
createPyProcfunction inpy_handler.ts - Set a breakpoint at the first line of the
createdlifecycle handler inApp.vue
TIP: Be sure to shutdown any Chrome instances that you have running that were started in debug mode
- Open the
Runpanel, selectElectron Allfrom the dropdown in the header and press the green arrow to start debugging - Vscode will start an
electron-debugtask terminal and you should see the app building
TIP: If you update any of the electron-app
.tsfiles that run outside of the packaged vue app (e.g.py-handler.ts) you should pressCtrl+Cthenspacebarin theelectron-debugtask terminal so that the electron app is rebuilt
- Your breakpoint should be hit in
py-handler.tsand if you step through you should see it skipping starting the python child process - Press
F5to continue running the electron app then you should see the Rotki app start up and present the login with Developer Tools window started as well - Click View->Reload in the Rotki app and you should see the breakpoint hit in the
App.vuecreatedhandler, press F5 to continue running - Log in to Rotki and you should see the breakpoint hit in the python backend vscode debugger process