Additional Python Libraries on Windows
Description
I host a BombSquad server on an Ubuntu droplet and the scripts have custom requirements that I just install with pip and the server is able to detect and import it. I would also like if the windows builds were able to load python3.8 installed packages when python3.8 is installed on the device, if I have to test on my own laptop for now I do make build and then move the package files from the python packages library folder to BombSquad directory's lib folder and then run the executable so it can find and successfully import it. That's not the end of the day though, I can work with that but again when I run make target after script updates and new adds the command deletes that folder from the lib folder and I have to copy it there again every time I make a build.
Solution
I want windows server and GUI builds to be able to import python3.8 pip installed packages.
Alternatives
Alternatively, I guess the make target command on windows could be modified to not delete any folder/file from the lib folder that is not used/managed by ballistica. That way I would only have to copy the folder whenever I make the target for the first time or when the folder doesn't exist.
Your alternative variant is already ready: just put these libraries into assets/src/ba_data/python and run make update (check this if you never used this command).
I know that command of course else how would I even add new scripts to my builds. And I could indeed do that, but remember I use my windows laptop for local testing before pushing the changes to the server, and if I use this method it will update the server makefile and manifest versions too. And I do not want to have the Ubuntu server include the packages's copy from my windows laptop in the ballistica's build's python data directory and have that same package's file in the python's library folder.
Also, by the way, I have set up the Ubuntu droplet to update the BombSquad server automatically using bash scripts and service so as soon as I push an update the server fetches the update and updates the server's build automated and I don't do a thing on the server.
I'm wondering what the right way to address this would be. The big difference with the Windows builds versus the Linux builds is that Windows includes the full Python distribution with itself whereas Linux just assumes you've got a Python 3.x install on your system that it can use. So on Linux it picks up standard site directories (and thus Pip installs) but on Windows it only sees its own bundled dirs.
You can see how this works if you take a look at the Reset() function in src/ballistica/python/python.cc. On Linux it does a pretty standard Python config but on Windows it does an 'Isolated' config and sets all paths itself.
Perhaps we could support an environment variable or something that would tell the app to use an existing Python installation on Windows instead of its own embedded one. (Perhaps by providing a path to it? Or is there a standard Python install location on Windows? Admittedly most of my experience with Python on Windows has been fully-embedded situations like this)
Anyway, I think all the code needed to test this should be exposed here if anyone wants to experiment with this idea.
Hello Eric, thank you for your update. I know that windows build use embedded python distribution, I have worked on BombSquad projects on windows with different versions, but not completely understand how.
And unfortunately, I do not know about c/c++ so I am unable to understand the c code files and I can not do any experimenting with them. I am only working on the python scripts layer in the ballistica projects.
One thing more I am unsure about is that though I can add new files in the root BombSquad folder in windows GUI builds and root folder + the dist folder in headless server builds those are not removed by the make command. But why the make command removes new files from the lib folder at each command on windows?
Will bombsquad on Windows correctly resolve dependencies installed into some virtual environment, like venv? If so, this might be the solution.