Module Py

include Py__.Py_base

Py

type pyobject
val pyobject : pyobject Ctypes.typ
type op =
| LT
| LE
| EQ
| NE
| GT
| GE

The op type is used in calls to Object.compare

exception Invalid_type
exception Invalid_object
exception Python_error of string
exception End_iteration
module C = Py__.Py_base.C

C makes the underlying Python C libraries available

module Object = Py__.Py_base.Object

Object defines functions for working with generic Python objects

val wrap : pyobject -> Object.t
val wrap_status : int -> unit
module PyNumber = Py__.Py_base.PyNumber
module PyIter = Py__.Py_base.PyIter
module PyDict = Py__.Py_base.PyDict
module PyList = Py__.Py_base.PyList
module PySet = Py__.Py_base.PySet
module PyTuple = Py__.Py_base.PyTuple
module PySlice = Py__.Py_base.PySlice
val get_module_dict : unit -> Object.t
module PyModule = Py__.Py_base.PyModule
module PyCell = Py__.Py_base.PyCell
module PyWeakref = Py__.Py_base.PyWeakref
module PyThreadState = Py__.Py_base.PyThreadState
val new_interpreter : unit -> PyThreadState.t
val end_interpreter : PyThreadState.t -> unit
module PyBytes = Py__.Py_base.PyBytes
module PyUnicode = Py__.Py_base.PyUnicode
module PyBuffer = Py__.Py_base.PyBuffer
module PyByteArray = Py__.Py_base.PyByteArray
type t =
| Ptr of Object.t
| Cell of Object.t
| Nil
| Bool of bool
| Int of int
| Int64 of int64
| Float of float
| String of string
| Bytes of Stdlib.Bytes.t
| List of t list
| Tuple of t array
| Dict of (t * t) list
| Set of t list
| Slice of t * t * t
val to_object : t -> Object.t
val initialize : ?⁠initsigs:bool -> unit -> unit
val finalize : unit -> unit
val exec : string -> bool

Execute a string for side-effects only

val locals : unit -> Object.t option
val globals : unit -> Object.t option
val builtins : unit -> Object.t
val eval : ?⁠globals:t -> ?⁠locals:t -> string -> Object.t

Evaluate a string and return the response

val run : Object.t -> ?⁠kwargs:(t * t) list -> t list -> Object.t
val (!$) : t -> Object.t
val ($) : Object.t -> t list -> Object.t
val ($.) : Object.t -> t -> Object.t
val (<-$.) : (Object.t * t) -> t -> unit
val ($|) : Object.t -> t -> Object.t
val (<-$|) : (Object.t * t) -> t -> unit
val append_path : string list -> unit
val prepend_path : string list -> unit
val pickle : ?⁠kwargs:(t * t) list -> Object.t -> bytes
val unpickle : ?⁠kwargs:(t * t) list -> bytes -> Object.t
val print : ?⁠kwargs:(t * t) list -> t list -> unit
val c_function : (Object.t -> Object.t -> Object.t) -> Object.t -> name:string -> Object.t

c_function fn obj ~name returns a Python function. When this function is called on some arguments args, fn obj args is called.

module Numpy = Py__.Py_base.Numpy
module CamlModule = Py__.Py_base.CamlModule
module PyWrap = Py__.Py_wrap
module PyType = Py__.Py_type
val of_object : Object.t -> t