-
Notifications
You must be signed in to change notification settings - Fork 2
Python Developer Setup
Connor Jakubik edited this page Nov 11, 2024
·
17 revisions
| Simulation Development Workflow → Python Developer Setup |
|---|
Written by Connor Jakubik
Prerequisites:
NOTE: You really cannot skip any steps when going through this, besides the steps marked things like "ONLY IN PLATFORM VERSIONS _" when your version / OS does not apply. You need to read all of the bullet points as you are going through or you will encounter issues that make the process take longer.
-
2024/11/11Transferred newer setuo instructions from Lunar SAR API docs. -
2023/09/14Initial copy from internal developer documentation.
- For Windows:
- Enable long path lengths (Run terminal as admin) (https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=powershell#enable-long-paths-in-windows-10-version-1607-and-later)
- (Optional) File Explorer
-
OneDrive / Backup & Sync with Google Drive
- Be very wary of whether these affect the directories you place Platform files in! Many developer projects are VERY MUCH NOT friendly with these file syncing programs, as they have lots of tiny files that get regenerated often, and many huge files that result in a slow sync. It's not useful to have a backup of Platform files or any other GitHub repo, because once you commit and push changes, they're already backed up in GitHub. It's often very difficult or tedious to remove these files from the sync'd data once they've been sync'd.
- You might want to disable these services in their entirety.
-
AppData/LocalandAppData/LocalLoware typically not synced by default.
There are several ways to do python development; here is one way that is the typical way we at SimDynamX set it up.
- Install Visual Studio Code https://code.visualstudio.com/ and open it
- Do
Open FoldertoC:\Users\YOUR WINDOWS USERNAME\AppData\Local\SimDynamX\STPro\Assets - Open one of the .py files in
Repos/, or create one yourself and open it. - If prompted, install the recommended python extensions, and wait for those installs to complete
- Set your Python interpreter to the one that was installed during setup
- While having a python file open, click the python version number in the bottom right of the screen
- At the top of the screen, click
Enter interpreter path...
- Click
Find... - Navigate to
AppData\Local\SimDynamX\STPro\Versions\(the highest version number in there)\py\Scriptsand selectpython.exe, thenSelect Interpreter
- Should now be switched to the correct python interpreter
- And you should get syntax highlighting for the
spaceteamspython module.
- While having a python file open, click the python version number in the bottom right of the screen
- Editing Python scripts that use the
spaceteamsmodule to interface with either SimConfig / EntityConfig objects or Entities in a running simulation. - Modifying a Sim Config to:
- Declare a System Instance of
Pythontype that uses a particular python script as itsSourcepath. - Assign that System Instance's
Nametagto theSystemson any Entities it should "see"/affect.
- Declare a System Instance of
- Run that simulation through one of a number of methods.