[Note] Making use of Stubs

So, the stubs are incredible! Thank you a lot for that. (Best part is they can even be used with other versions ;D )

Here is a little script to help set up the vsCode settings. Copy this in to an executeDat or simply run it once on project setup.

import json
from pathlib import Path
import os, copy
	
emptyConfig = {

}

def onStart():
	
	vsCode_SettingsFile = Path( ".vscode/settings.json")
	if not vsCode_SettingsFile.is_file():
		vsCode_SettingsFile.parent.mkdir(
			parents=True, 
			exist_ok=True
		)
		vsCode_SettingsFile.touch()
		vsCode_SettingsFile.write_text( json.dumps( emptyConfig ) )

	with vsCode_SettingsFile.open("r+") as launchJson:
		launchDict:dict = json.load( launchJson )
		launchDict.setdefault(
			"python.analysis.extraPaths", 
			["TDImportCache/Lib"] # This is to enable code compleation for TD_PIP.
		)

		for potentialPath in ["TDImportCache/Lib"]:
			if potentialPath in launchDict["python.analysis.extraPaths"]: continue
			launchDict["python.analysis.extraPaths"].append( potentialPath )
			
		launchDict["python.defaultInterpreterPath"] = app.pythonExecuteable

		vsCode_SettingsFile.write_text( json.dumps( launchDict, indent=4 ) )
	return

Now, the last thing to do is to set vsCode as your editor, but to open it in your “Workspace”.
in the path for vsCode, append a simple .
so
C:/Users/{USERNAME}/AppData/Local/Programs/Microsoft VS Code/bin/code.cmd
becomes
C:/Users/{USERNAME}/AppData/Local/Programs/Microsoft VS Code/bin/code.cmd .

Voila!

1 Like

Hey Wieland

I’ll be in Berlin for a while starting next week. Let’s get together and go deep on this stuff!