Posts Tagged ‘Pharo’

How does Glamorous Toolkit’s PythonBridge Work?

Monday, August 5th, 2024

Glamorous Toolkit offers Python interoperability functionality. It allows mixing Python and Smalltalk more-or-less seamlessly in a Lepiter playground. How does that work? Brace yourselves, it’s boutta get ugly.

The main entry point, from the Smalltalk side, into the integration is PBApplication. There are multiple references to PBApplication start as the way to get it going. PBApplication is a part of PythonBridge, forked by Feenk. PythonBridge is based on the general “LanguageLink” abstraction from PharoLink. In any case, through various abstractions, it uses pipenv to create a virtual environment in the PythonBridgeRuntime subdirectory of the Glamorous Toolkit installation directory. Into this virtual environment, the gtoolkit_bridge package is installed (source in PyPI directory of Feenk’s PythonBridge fork).

The LanguageLink abstraction and gtoolkit_bridge have a protocol for exchanging messages. It can go over one of two transports:

(more…)