Reading stdout from pythonKit

I have found so far just impossible to get stdout from python running via PythonKit as a text. In simple terms I hope to have like integrated python editor and possibility run commands and give output (warnings, print command, anything going to stdout, ...) to user via swiftui. Similar as Blender has integrated python scripts running (and has issue that one has to have started it from console to read stdout).
As a background, idea is to make tests would it be possible/feasible to pack all needed packages (mostly python and latex) into single App with UI for easy startup generating nomographs with Pynomo.

The standard way to run child processes in Swift is the Process class in Foundation. Using it can be a bit tricky. I discuss this in detail in my Running a Child Process with Standard Input and Output post on the Apple Developer Forums.

ps What platform are you targeting?

Share and Enjoy

Quinn “The Eskimo!” @ DTS @ Apple

Thank you! In my understanding this solution is similar as running command "python my_script.py" at command line (because own process) from Swift. Maybe one alternative. Then there would be no need for pythonKit for python integration with Swift. Though, using pythinKit would open many interesting alternatives for future for combining python and Swift. In my tests loading modules via pythonKit takes some time to start but after is very fast to run actual script multiple times.

I'm targeting for MacOS.

As a followup question, not sure does it fit here, but is anyway very generic one: If one wants to encapsulate many open source packages into one distributed macOS App, what is the best way. My specific target:

Build an App, make source-code a public GitHub project and distribute App as a binary to users for easy use. Binary distribution either Github or AppStore (any possibilities with compiled open source included?) The problematic part is inclusion of included binaries that are not part of Xcode build process.

In detail, I have compiled externally CPython and tinyTex from sources and copied them into Xcode project. I have no idea how I could make this compilation a transparent CI for built binaries or part of Xcode project.

\leif

Thanks for the links. I wonder what's that bit about?