wolframclient.language package

Submodules

wolframclient.language.decorators module

wolframclient.language.decorators.safe_wl_execute(function, args=(), opts={}, export_opts={}, exception_class=None)[source]
wolframclient.language.decorators.to_wl(exception_class=None, **export_opts)[source]

wolframclient.language.exceptions module

exception wolframclient.language.exceptions.WolframLanguageException(payload, exec_info=None)[source]

Bases: wolframclient.serializers.serializable.WLSerializable, Exception

The most generic exception raised by the Wolfram Client Library.

This class is WLSerializable and will automatically serialize to a failure box when evaluated in Wolfram Desktop.

failure_code()[source]
failure_meta()[source]
failure_parameters()[source]
failure_tag()[source]
failure_template()[source]
set_traceback(exc_type, exc_value, tb)[source]
show_traceback()[source]
to_wl(*args, **opts)[source]

Return the serialized form of a given Python class.

The returned value must be a combination of serializable types.

wolframclient.language.expression module

class wolframclient.language.expression.WLSymbol(name)[source]

Bases: wolframclient.language.expression.WLExpressionMeta

Represent a Wolfram Language symbol in Python.

name
class wolframclient.language.expression.WLFunction(head, *args, **opts)[source]

Bases: wolframclient.language.expression.WLExpressionMeta

Represent a Wolfram Language function with its head and arguments.

args
head
class wolframclient.language.expression.WLSymbolFactory(name=None)[source]

Bases: wolframclient.language.expression.WLSymbol

Provide a convenient way to build objects representing arbitrary Wolfram Language expressions through the use of attributes.

This class is conveniently instantiated at startup as wl, Global and System. It should be instantiated only to represent many symbols belonging to the same specific context.

Example:

>>> dev = WLSymbolFactory('Developer')
>>> dev.PackedArrayQ
Developer`PackedArrayQ

Alternative:

>>> wl.Developer.PackedArrayQ
Developer`PackedArrayQ
class wolframclient.language.expression.WLInputExpression(input)[source]

Bases: wolframclient.language.expression.WLExpressionMeta

Represent a string input form expression.

wolframclient.language.side_effects module

wolframclient.language.side_effects.wl_print(*payload)[source]
wolframclient.language.side_effects.wl_side_effect(payload)[source]

wolframclient.language.traceback module

wolframclient.language.traceback.serialize_traceback(exc_type, exc_value, tb, **opts)[source]

Module contents

wolframclient.language.wl

A factory of WLSymbol instances without any particular context.

This instance of WLSymbolFactory is conveniently used by calling its attributes. The following code represents various Wolfram Language expressions:

# Now
wl.Now
# Quantity[3, "Hours"]
wl.Quantity(3, "Hours")
# Select[PrimeQ, {1,2,3,4}]
wl.Select(wl.PrimeQ, [1, 2, 3, 4])

Represent symbols in various contexts:

>>> wl.Developer.PackedArrayQ
Developer`PackedArrayQ

>>> wl.Global.f
Global`f

Specify a context and a subcontext:

>>> wl.MyContext.MySubContext.SymbolName
MyContext`MySubContext`SymbolName
wolframclient.language.System

A factory of WLSymbol instances having System` context.

See WLSymbolFactory for more details.

Represent a symbol in the System context:

>>> System.ImageIdentify
System`ImageIdentify
wolframclient.language.Global

A factory of WLSymbol instances having Global` context.

See WLSymbolFactory and WLSymbolFactory for more details.

Represent a symbol in the Global context:

>>> Global.mySymbol
Global`mySymbol

Represent a function call to a function:

>>> Global.myFunction('foo')
Global`myFunction['foo']
wolframclient.language.wlexpr

alias of wolframclient.language.expression.WLInputExpression