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.0.0.tar.gz (33.6 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.0.0-py3-none-any.whl (39.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: reahl_parseltongue-3.0.0.tar.gz
  • Upload date:
  • Size: 33.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for reahl_parseltongue-3.0.0.tar.gz
Algorithm Hash digest
SHA256 db9ae0cddb2546bb7865145155fb96903d1852e0c21fd8d35f0104b3213b6841
MD5 904363dda7ae5864e740cf0389930d18
BLAKE2b-256 ed912abb2305df1a9978ef855fb9f8f21328a4fc69b2d75bd1a1693699933efb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for reahl_parseltongue-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5101c6f6a6c522e02eab18b86eb1d9a79b35c20ff90882e9109660b39ae400e5
MD5 f1604edb7698b6942a500c7b09ba2bae
BLAKE2b-256 9455ee8719d026f9fc71ffbe304a6164a1829c277ca9b0f26e3fe9c7c90204cb

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