Skip to main content

Python bindings for GemStone/S 64 Bit

Project description

Parseltongue is a library that lets Python programs execute methods on objects inside a GemStone Smalltalk server.

See also

Sessions

Log in by creating a session. You can choose between an RPCSession or a LinkedSession:

linked_session = LinkedSession('DataCurator', 'swordfish')

assert linked_session.is_logged_in
assert not linked_session.is_remote
assert linked_session.is_current_session

linked_session.log_out()

Multiple RPCSessions can exist simultaneously, but only a single instance of a LinkedSession is allowed per process.

Resolving objects

Looking up a Smalltalk symbol from the usual symbol dictionaries results in a GemObject object being returned which represents that object in Python:

date_class = session.resolve_symbol('Date')
assert isinstance(date_class, GemObject)

Calling methods

A GemObject object forwards method calls to its counterpart in the Gem. It returns other GemObject objects (and if the method takes arguments, those must also be GemObject objects):

today = date_class.today()
assert isinstance(today, GemObject)
assert today.isKindOf(date_class)

Transferring basic objects

Some basic objects can be transferred between GemStone and Python. These include unicode strings, various numbers and booleans:

gem_number = session.from_py(1)
long_ago = date_class.fromDays(gem_number)

long_ago_string = long_ago.asString()
python_string = long_ago_string.to_py

assert python_string == '1901/01/02'

Automatic translation of arguments

Some arguments to Gemstone method calls can be turned into GemObject instances automatically:

long_ago = date_class.fromDays(1)

long_ago_string = long_ago.asString()
python_string = long_ago_string.to_py

assert python_string == '1901/01/02'

Method name mapping

In Python, method names are spelt differently. Each ‘:’ in a Smalltalk method symbol is replaced with a ‘_’ in Python. When calling such a method, you must pass the correct number of arguments as Python positional arguments:

user_globals = session.resolve_symbol('UserGlobals')
some_key = session.new_symbol('akey')
gem_number = session.from_py(123)

user_globals.at_put(some_key, gem_number)

License

Parseltongue is licensed under the GNU Lesser General Public License v3.0 or later (LGPL-3.0-or-later).

This means you can:

  • Use Parseltongue in commercial applications

  • Modify Parseltongue privately

  • Distribute Parseltongue as part of your applications

If you modify Parseltongue itself, you must distribute those modifications under the terms of the LGPL.

For the full license text, see the LICENSE file or visit: https://www.gnu.org/licenses/lgpl-3.0.html

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

reahl_parseltongue-3.1.1.tar.gz (34.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

reahl_parseltongue-3.1.1-py3-none-any.whl (40.8 kB view details)

Uploaded Python 3

File details

Details for the file reahl_parseltongue-3.1.1.tar.gz.

File metadata

  • Download URL: reahl_parseltongue-3.1.1.tar.gz
  • Upload date:
  • Size: 34.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for reahl_parseltongue-3.1.1.tar.gz
Algorithm Hash digest
SHA256 4c22fdf74aa722a722490def8415cc41bd1bb2552e2378aba001041cd0e57eba
MD5 3dfd7611076c19de968f18603a8e53f5
BLAKE2b-256 f353ecb38c0fc2d3a4347a4dc944b972d90da145d723fd7d52a88f85c655e67e

See more details on using hashes here.

File details

Details for the file reahl_parseltongue-3.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for reahl_parseltongue-3.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e70fcbf72cf392e4e61dffe97e1d76532426ced63d0a8e17f17dd02ca00c95be
MD5 5473f7d9eb8505b6612dbeb0abb7a8f1
BLAKE2b-256 d253b73191351c58814e132ed2a4a1ee6e91bef5ec9355de05222edaae35c4b4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page