The py4cl2 Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The py4cl2 Reference Manual

This is the py4cl2 Reference Manual, version 2.4.1, generated automatically by Declt version 3.0 "Montgomery Scott" on Wed Nov 04 14:56:26 2020 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

This is a fork of bendudson/py4cl.

Github Pages

Detailed documentation is available on github-pages (could be a bit outdated).

Releases

Check the Releases section.

Quick Demonstration

(ql:quickload :py4cl2 :silent t)

(py4cl2:defpymodule "numpy" nil :lisp-package "NP")
(py4cl2:defpymodule "scipy.integrate" nil :lisp-package "INTEGRATE")

;; Integrate some ODEs
(defparameter *data*
  (integrate:odeint 
   :func (lambda (y time) 
           (list (aref y 1)       ; dy[0]/dt = y[1]
                 (- (aref y 0)))) ; dy[1]/dt = -y[0]
   :y-0 #(1.0 0.0)   ; Initial state
   :t (np:linspace :start 0.0 :stop (* 2 pi) :num 20)))
                                        ; Vector of times

; (array-dimensions *data*) => (20 2)

;; Make a plot, save and show it in a window
(py4cl2:defpymodule "matplotlib.pyplot" nil :lisp-package "PLT")

(plt:plot *data*)
(plt:xlabel "Time")
(plt:savefig "result.pdf")
(plt:show)

Great thanks to Ben Dudson for starting this project, and documenting it enough to make it more-buildable!


Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 py4cl2

Author

Ben Dudson <benjamin.dudson@york.ac.uk>

License

MIT

Description

Some improvements over py4cl. py4cl is a library for interfacing with python libraries from common lisp, using streams to communicate with the python process. Report the issues at https://github.com/digikar99/py4cl2/issues
(More) Documentation is available at https://digikar99.github.io/py4cl2/

Version

2.4.1

Dependencies
Source

py4cl2.asd (file)

Components

Next: , Previous: , Up: Top   [Contents][Index]

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Next: , Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.1 py4cl2.asd

Location

/home/quickref/quicklisp/dists/quicklisp/software/py4cl2-v2.4.1/py4cl2.asd

Systems

py4cl2 (system)


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.2 py4cl2/package.lisp

Dependency

python-code (file)

Parent

py4cl2 (system)

Location

package.lisp

Packages

py4cl2


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.3 py4cl2/config.lisp

Dependency

package.lisp (file)

Parent

py4cl2 (system)

Location

config.lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.4 py4cl2/reader.lisp

Dependency

config.lisp (file)

Parent

py4cl2 (system)

Location

reader.lisp

Internal Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.5 py4cl2/writer.lisp

Dependency

reader.lisp (file)

Parent

py4cl2 (system)

Location

writer.lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.6 py4cl2/python-process.lisp

Dependency

writer.lisp (file)

Parent

py4cl2 (system)

Location

python-process.lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.7 py4cl2/lisp-classes.lisp

Dependency

python-process.lisp (file)

Parent

py4cl2 (system)

Location

lisp-classes.lisp

Exported Definitions

python-getattr (generic function)


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.8 py4cl2/callpython.lisp

Dependency

lisp-classes.lisp (file)

Parent

py4cl2 (system)

Location

callpython.lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.9 py4cl2/import-export.lisp

Dependency

callpython.lisp (file)

Parent

py4cl2 (system)

Location

import-export.lisp

Exported Definitions
Internal Definitions

Previous: , Up: Lisp files   [Contents][Index]

3.1.10 py4cl2/do-after-load.lisp

Dependency

import-export.lisp (file)

Parent

py4cl2 (system)

Location

do-after-load.lisp


Previous: , Up: Files   [Contents][Index]

3.2 Static


Next: , Previous: , Up: Static files   [Contents][Index]

3.2.1 py4cl2/python-code

Parent

py4cl2 (system)

Location

/home/quickref/quicklisp/dists/quicklisp/software/py4cl2-v2.4.1/py4cl.py


Previous: , Up: Static files   [Contents][Index]

3.2.2 py4cl2/.config

Dependency

do-after-load.lisp (file)

Parent

py4cl2 (system)

Location

/home/quickref/quicklisp/dists/quicklisp/software/py4cl2-v2.4.1/.config


Next: , Previous: , Up: Top   [Contents][Index]

4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 py4cl2

Source

package.lisp (file)

Use List
Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.1 Special variables

Special Variable: *array-type*

(GETF *ARRAYFIERS* *ARRAY-TYPE*) should return a single argument function that converts the ARRAY into the required type.

Package

py4cl2

Source

config.lisp (file)

Special Variable: *arrayfiers*

(GETF *ARRAYFIERS* *ARRAY-TYPE*) should return a single argument function that converts the ARRAY into the required type.

Package

py4cl2

Source

config.lisp (file)

Special Variable: *config*

Configuration variable used to store configuration values for PY4CL2. This variable should be manipulated using CONFIG-VAR and (SETF CONFIG-VAR).

Package

py4cl2

Source

config.lisp (file)

Special Variable: *defpymodule-silent-p*

DEFPYMODULE avoids printing progress if this is T.

Package

py4cl2

Source

import-export.lisp (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.2 Macros

Macro: chain &rest CHAIN
Package

py4cl2

Source

callpython.lisp (file)

Macro: defpyfun FUN-NAME &optional PYMODULE-NAME &key AS LISP-FUN-NAME LISP-PACKAGE SAFETY

Defines a function which calls python
Example
(py4cl:pyexec "import math")
(py4cl:defpyfun "math.sqrt")
(math.sqrt 42) -> 6.4807405

Arguments:
FUN-NAME: name of the function in python, before import
PYMODULE-NAME: name of the module containing FUN-NAME
AS: name of the function in python, after import
LISP-FUN-NAME: name of the lisp symbol to which the function is bound* LISP-PACKAGE: package (not its name) in which LISP-FUN-NAME will be interned SAFETY: if T, adds an additional line in the function asking to import the package or function, so that the function works even after PYSTOP is called. However, this increases the overhead of stream communication, and therefore, can reduce speed.

Package

py4cl2

Source

import-export.lisp (file)

Macro: defpyfuns &rest ARGS

Each ARG is supposed to be a 2-3 element list of
(pyfun-name pymodule-name) or (pyfun-name pymodule-name lisp-fun-name). In addition, when ARG is a 2-element list, then, the first element can be a list of python function names.

Package

py4cl2

Source

import-export.lisp (file)

Macro: defpymodule PYMODULE-NAME &optional IMPORT-SUBMODULES &key LISP-PACKAGE RELOAD SAFETY CONTINUE-IGNORING-ERRORS SILENT

Import a python module (and its submodules) lisp-package Lisp package(s). Example:
(py4cl:defpymodule "math" :lisp-package "M")
(m:sqrt 4) ; => 2.0
"Package already exists." is returned if the package exists and :RELOAD is NIL.
Arguments:
PYMODULE-NAME: name of the module in python, before importing IMPORT-SUBMODULES: leave nil for purposes of speed, if you won’t use the submodules
LISP-PACKAGE: lisp package, in which to intern (and export) the callables RELOAD: whether to redefine and reimport
SAFETY: value of safety to pass to defpyfun; see defpyfun
SILENT: prints "status" lines when NIL

Package

py4cl2

Source

import-export.lisp (file)

Macro: with-python-output &body FORMS-DECL
Package

py4cl2

Source

python-process.lisp (file)

Macro: with-remote-objects &body BODY

Ensures that all values returned by python functions
and methods are kept in python, and only handles returned to lisp. This is useful if performing operations on large datasets.

Package

py4cl2

Source

callpython.lisp (file)

Macro: with-remote-objects* &body BODY

Ensures that all values returned by python functions
and methods are kept in python, and only handles returned to lisp.
This is useful if performing operations on large datasets. Unlike with-remote-objects, evaluates the last result and returns not just a handle.

Package

py4cl2

Source

callpython.lisp (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.3 Functions

Function: chain* &rest CHAIN
Function: (setf chain*) VALUE &rest ARGS
Package

py4cl2

Source

callpython.lisp (file)

Function: config-var VAR

Returns the value associated with VAR in *CONFIG*.
Configuration variables include (all in PY4CL2 package):

- PYCMD: Path to the python binary to be used
- NUMPY-PICKLE-LOCATION: PY4CL2 uses pickled files to transfer large arrays between lisp
and python efficiently. These can have sizes exceeding 100MB. It is recommended that this
be set to path on a ram-disk. See [this](https://unix.stackexchange.com/questions/66329/creating-a-ram-disk-on-linux) for
instructions on creating a ram-disk on linux-based systems.
- NUMPY-PICKLE-LOWER-BOUND: The minimum size of the array for which PY4CL2 should use pickled files.
- USE-NUMCL-ARRAYS: NUMCL uses displaced arrays. If this variable is T and the system PY4CL2+NUMCL is loaded, arrays returned by python process are passed through NUMCL:ASARRAY before returning them to the user.

Package

py4cl2

Source

config.lisp (file)

Writer

(setf config-var) (function)

Function: (setf config-var) NEW-VALUE VAR

Sets the value of VAR to NEW-VALUE in *CONFIG*. For all but PYCMD, the values are saved to a configuration-file for persistence whenever they are changed. To persist PYCMD, call SAVE-CONFIG.

Package

py4cl2

Source

config.lisp (file)

Reader

config-var (function)

Function: export-function FUNCTION PYTHON-NAME

Makes a lisp FUNCTION available in python process as PYTHON-NAME

Package

py4cl2

Source

import-export.lisp (file)

Function: initialize ()

Intended to be called first upon installation. Sets up default python command, and numpy pickle file and lower bounds.

Package

py4cl2

Source

config.lisp (file)

Function: load-config ()

Load to *CONFIG* from /home/quickref/quicklisp/dists/quicklisp/software/py4cl2-v2.4.1/src/../.config

Package

py4cl2

Source

config.lisp (file)

Function: py-cd PATH
Package

py4cl2

Source

config.lisp (file)

Function: pycall FUN-NAME &rest ARGS

Calls FUN-NAME with ARGS as arguments. Arguments can be keyword based, or otherwise.

Package

py4cl2

Source

callpython.lisp (file)

Function: pyeval &rest ARGS

Calls python eval on args; PYTHONIZEs arg if it satisfies PYTHONIZEP. Eg.
> (let ((a 5)) (pyeval a "*" a))
25

Package

py4cl2

Source

callpython.lisp (file)

Writer

(setf pyeval) (function)

Function: (setf pyeval) VALUE &rest ARGS

Set an expression to a value. Just adds "=" and the value to the end of the expression. Note that the result is evaluated with exec rather than eval.
Example:
(setf (pyeval "a") 2) ; python "a=2"
Can be useful for modifying a value directly in python.

Package

py4cl2

Source

callpython.lisp (file)

Reader

pyeval (function)

Function: pyexec &rest ARGS

Calls python exec on args; PYTHONIZEs arg if it satisfies PYTHONIZEP.

Package

py4cl2

Source

callpython.lisp (file)

Function: pygenerator FUNCTION STOP-VALUE
Package

py4cl2

Source

callpython.lisp (file)

Function: pyhelp OBJECT
Package

py4cl2

Source

callpython.lisp (file)

Function: pyinterrupt &optional PROCESS-INFO
Package

py4cl2

Source

python-process.lisp (file)

Function: pymethod OBJECT METHOD &rest ARGS

PYCALLs METHOD of OBJECT with ARGS
Examples:
> (pymethod "’hello {0}’" ’format "world") "hello world"
> (pymethod ’(1 2 3) ’–len–)
3
Note: FUN-NAME is NOT PYTHONIZEd if it is a string.

Package

py4cl2

Source

callpython.lisp (file)

Function: pymethod-list PYTHON-OBJECT &key AS-VECTOR
Package

py4cl2

Source

import-export.lisp (file)

Function: pyslot-list PYTHON-OBJECT &key AS-VECTOR
Package

py4cl2

Source

import-export.lisp (file)

Function: pyslot-value OBJECT SLOT-NAME
Package

py4cl2

Source

callpython.lisp (file)

Function: pystart &optional COMMAND

Start a new python subprocess
This sets the global variable *python* to the process handle,
in addition to returning it.
COMMAND is a string with the python executable to launch e.g. "python" By default this is is set to *PYTHON-COMMAND*

Package

py4cl2

Source

python-process.lisp (file)

Function: pystop &optional PROCESS-INFO

Stop (Quit) the python process PROCESS

Package

py4cl2

Source

python-process.lisp (file)

Function: python-alive-p &optional PROCESS-INFO

Returns non-NIL if the python process is alive
(e.g. SBCL -> T, CCL -> RUNNING).
Optionally pass the process object returned by PYTHON-START

Package

py4cl2

Source

python-process.lisp (file)

Function: python-start-if-not-alive ()

If no python process is running, tries to start it. If still not alive, raises a condition.

Package

py4cl2

Source

python-process.lisp (file)

Function: pyversion-info ()

Return a list, using the result of python’s sys.version_info.

Package

py4cl2

Source

callpython.lisp (file)

Function: raw-pyeval &rest STRINGS

Calls python eval on the concatenation of strings, as they are, without any pythonization or modification.

Package

py4cl2

Source

callpython.lisp (file)

Writer

(setf raw-pyeval) (function)

Function: (setf raw-pyeval) VALUE &rest ARGS
Package

py4cl2

Source

callpython.lisp (file)

Reader

raw-pyeval (function)

Function: raw-pyexec &rest STRINGS

Calls python exec on the concatenation of strings, as they are, without any pythonization or modification.
NOTE: Like usual, there are peculiarities to exec commands.
For instance,
import sys
def foo:
sys.stdout.write(’hello’)
foo()
will result in ’sys’ name not defined PYERROR.

Package

py4cl2

Source

callpython.lisp (file)

Function: save-config ()

Save to /home/quickref/quicklisp/dists/quicklisp/software/py4cl2-v2.4.1/src/../.config from *CONFIG*

Package

py4cl2

Source

config.lisp (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.4 Generic functions

Generic Function: python-getattr OBJECT SLOT-NAME

Called when python accesses an object’s slot (__getattr__)

Package

py4cl2

Source

lisp-classes.lisp (file)

Generic Function: pythonize OBJ

Convert an object into a string which can be written to stream. Default implementation creates a handle to an unknown Lisp object.

Package

py4cl2

Source

writer.lisp (file)

Methods
Method: pythonize (OBJ ratio)

Handle ratios, using Python’s Fraction if available

Method: pythonize (OBJ python-object)

A handle for a python object, stored in a dict in Python

Method: pythonize (OBJ function)

Handle a function by converting to a callback object
The lisp function is stored in the same object store as other objects.

Method: pythonize (OBJ hash-table)

Convert hash-table to python map. Produces a string {key1:value1, key2:value2,}

Method: pythonize (OBJ symbol)

One-to-one mapping between python name and lisp symbol names: symbol : symbol-name : python-name
’foo-bar : "FOO-BAR" : foo_bar
’|Foo-Bar| : "Foo-Bar" : Foo_Bar
’*foo-bar* : "*FOO-BAR*" : FOO_BAR
t : "T" : True
nil : "NIL" : False

Method: pythonize (OBJ string)
Method: pythonize (OBJ cons)

Convert a list. This leaves a trailing comma so that python evals a list with a single element as a tuple

Method: pythonize (OBJ array)
Method: pythonize (OBJ complex)

Create string of the form "(1+2j".
If imaginary part is negative the output is of form "(1+-2j" which is interpreted correctly by python (3.7.2).

Method: pythonize (OBJ real)

Write a real number.
Note that python doesn’t handle ’d’,’f’, ’s’ or ’L’ exponent markers

Method: pythonize OBJ

Previous: , Up: Exported definitions   [Contents][Index]

5.1.5 Conditions

Condition: pyerror ()
Package

py4cl2

Source

callpython.lisp (file)

Direct superclasses

error (condition)

Direct methods

text (method)

Direct slots
Slot: text
Initargs

:text

Readers

text (generic function)

Condition: python-process-startup-error ()
Package

py4cl2

Source

python-process.lisp (file)

Direct superclasses

error (condition)

Direct methods

command (method)

Direct slots
Slot: command
Initargs

:command

Readers

command (generic function)


Previous: , Up: Definitions   [Contents][Index]

5.2 Internal definitions


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.1 Constants

Constant: +py4cl2-config-path+
Package

py4cl2

Source

config.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.2 Special variables

Special Variable: *called-from-defpymodule*

Internal variable used for coordinating between DEFPYMODULE and DEFPYFUN.

Package

py4cl2

Source

import-export.lisp (file)

Special Variable: *current-python-process-id*

A number which changes when python is started. This
is used to prevent garbage collection from deleting objects in the wrong python session

Package

py4cl2

Source

python-process.lisp (file)

Special Variable: *freed-python-objects*

A list of handles to be freed. This is used because garbage collection may occur in parallel with the main thread.

Package

py4cl2

Source

reader.lisp (file)

Special Variable: *function-reload-string*

String pyexec-ed at the start of a DEFPYFUN when SAFETY is T.

Package

py4cl2

Source

import-export.lisp (file)

Special Variable: *handle-counter*
Package

py4cl2

Source

writer.lisp (file)

Special Variable: *in-with-python-output*
Package

py4cl2

Source

python-process.lisp (file)

Special Variable: *is-submodule*

Used for coordinating import statements from defpymodule while calling recursively

Package

py4cl2

Source

import-export.lisp (file)

Special Variable: *lisp-objects*
Package

py4cl2

Source

writer.lisp (file)

Special Variable: *lisp-package-supplied-p*

Internal variable used by PYMODULE-IMPORT-STRING to determine the import string.

Package

py4cl2

Source

import-export.lisp (file)

Special Variable: *lisp-to-python-alist*
Package

py4cl2

Source

writer.lisp (file)

Special Variable: *numpy-pickle-index*

Used for transferring multiple numpy-pickled arrays in one pyeval/exec/etc

Package

py4cl2

Source

writer.lisp (file)

Special Variable: *py4cl-tests*
Package

py4cl2

Source

python-process.lisp (file)

Special Variable: *python*

Most recently started python subprocess

Package

py4cl2

Source

python-process.lisp (file)

Special Variable: *python-code*
Package

py4cl2

Source

python-process.lisp (file)

Special Variable: *python-output-semaphore*
Package

py4cl2

Source

python-process.lisp (file)

Special Variable: *python-output-thread*
Package

py4cl2

Source

python-process.lisp (file)

Special Variable: *python-process-busy-p*

Used by pyinterrupt to determine if python process is waiting for input, or
is busy processing.

A possible workaround is to use strace.
See https://askubuntu.com/questions/1118109/how-do-i-tell-if-a-command-is-running-or-waiting-for-user-input

Package

py4cl2

Source

python-process.lisp (file)

Special Variable: *python-startup-error*
Package

py4cl2

Source

python-process.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.3 Macros

Macro: defvar-doc NAME DOC
Package

py4cl2

Source

import-export.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.4 Functions

Function: %chain* &rest CHAIN
Package

py4cl2

Source

callpython.lisp (file)

Function: %pycall-args &rest ARGS
Package

py4cl2

Source

callpython.lisp (file)

Function: break-into-words CHAR-LIST

Returns ((h e l l o) (W o r l d)), given (h e l l o W o r l d).

Package

py4cl2

Source

import-export.lisp (file)

Function: builtin-p PYMODULE-NAME

Some builtin functions like ’sum’ do not take keyword args.

Package

py4cl2

Source

import-export.lisp (file)

Function: clear-lisp-objects ()

Clear the *lisp-objects* object store, allowing them to be GC’d

Package

py4cl2

Source

writer.lisp (file)

Function: collect-first-word CHAR-LIST

Returns ((h e l l o) W o r l d), given (h e l l o W o r l d).

Package

py4cl2

Source

import-export.lisp (file)

Function: copy-python-object INSTANCE
Package

py4cl2

Source

reader.lisp (file)

Function: defpysubmodules PYMODULE-NAME LISP-PACKAGE CONTINUE-IGNORING-ERRORS
Package

py4cl2

Source

import-export.lisp (file)

Function: delete-freed-python-objects ()
Package

py4cl2

Source

reader.lisp (file)

Function: delete-numpy-pickle-arrays ()

Delete pickled arrays, to free space.

Package

py4cl2

Source

reader.lisp (file)

Function: dispatch-messages PROCESS

Read response from python, loop to handle any callbacks

Package

py4cl2

Source

callpython.lisp (file)

Function: dispatch-reply STREAM VALUE
Package

py4cl2

Source

callpython.lisp (file)

Function: free-handle HANDLE

Remove an object with HANDLE from the hash table

Package

py4cl2

Source

writer.lisp (file)

Function: free-python-object PYTHON-ID HANDLE
Package

py4cl2

Source

reader.lisp (file)

Function: fun-symbol PYFUN-NAME PYFULLNAME LISP-PACKAGE &optional ENSURE-UNIQUE
Package

py4cl2

Source

import-export.lisp (file)

Function: function-reload-string &key PYMODULE-NAME LISP-PACKAGE FUN-NAME AS
Package

py4cl2

Source

import-export.lisp (file)

Function: get-arg-list FULLNAME LISP-PACKAGE

Returns a list of two lists: PARAMETER-LIST and PASS_LIST

Package

py4cl2

Source

import-export.lisp (file)

Function: get-unique-symbol SYMBOL-NAME PACKAGE-NAME
Package

py4cl2

Source

import-export.lisp (file)

Function: lisp-object HANDLE

Get the lisp object corresponding to HANDLE

Package

py4cl2

Source

writer.lisp (file)

Function: lispify-name NAME

Converts NAME to a lisp-like name. Specifically: 1. Replaces underscores with hyphens.
2. CamelCase is converted to CAMEL-CASE

Package

py4cl2

Source

import-export.lisp (file)

Function: make-python-object &key (TYPE TYPE) (HANDLE HANDLE)
Package

py4cl2

Source

reader.lisp (file)

Function: make-python-object-finalize &key TYPE HANDLE

Make a PYTHON-OBJECT struct with a finalizer.
This deletes the object from the dict store in python.

Uses trivial-garbage (public domain)

Package

py4cl2

Source

reader.lisp (file)

Function: numeric-char-p CH
Package

py4cl2

Source

import-export.lisp (file)

Function: object-handle OBJECT

Store OBJECT and return a handle

Package

py4cl2

Source

writer.lisp (file)

Function: pymodule-import-string PYMODULE-NAME LISP-PACKAGE
Package

py4cl2

Source

import-export.lisp (file)

Function: python-object-handle INSTANCE
Function: (setf python-object-handle) VALUE INSTANCE
Package

py4cl2

Source

reader.lisp (file)

Function: python-object-p OBJECT
Package

py4cl2

Source

reader.lisp (file)

Function: python-object-type INSTANCE
Function: (setf python-object-type) VALUE INSTANCE
Package

py4cl2

Source

reader.lisp (file)

Function: pythonize-kwargs ARG-PLIST
Package

py4cl2

Source

import-export.lisp (file)

Function: raw-py CMD-CHAR &rest STRINGS

Intended as an abstraction to RAW-PYEVAL and RAW_PYEXEC. Passes strings as they are, without any ’pythonize’ation.

Package

py4cl2

Source

callpython.lisp (file)

Function: split-point-p PCH CH
Package

py4cl2

Source

import-export.lisp (file)

Function: stream-read-string STREAM

Reads a string from a stream
Expects a line containing the number of chars following e.g. ’5~%hello’
Returns the string or nil on error

Package

py4cl2

Source

reader.lisp (file)

Function: stream-read-value STREAM

Get a value from a stream
Currently works by reading a string then using read-from-string

Package

py4cl2

Source

reader.lisp (file)

Function: stream-write-string STR STREAM

Write a string to a stream, putting the length first

Package

py4cl2

Source

writer.lisp (file)

Function: stream-write-value VALUE STREAM

Write a value to a stream, in a format which can be read by the python subprocess as the corresponding python type

Package

py4cl2

Source

writer.lisp (file)

Function: take-input PROMPT DEFAULT
Package

py4cl2

Source

config.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.5 Generic functions

Generic Function: command CONDITION
Package

py4cl2

Methods
Method: command (CONDITION python-process-startup-error)
Source

python-process.lisp (file)

Generic Function: text CONDITION
Package

py4cl2

Methods
Method: text (CONDITION pyerror)
Source

callpython.lisp (file)


Previous: , Up: Internal definitions   [Contents][Index]

5.2.6 Structures

Structure: python-object ()

A handle for a python object
which couldn’t be translated into a Lisp value.
TYPE slot is the python type string
HANDLE slot is a unique key used to refer to a value in python.

Package

py4cl2

Source

reader.lisp (file)

Direct superclasses

structure-object (structure)

Direct methods

pythonize (method)

Direct slots
Slot: type
Type

string

Initform

""

Readers

python-object-type (function)

Writers

(setf python-object-type) (function)

Slot: handle
Readers

python-object-handle (function)

Writers

(setf python-object-handle) (function)


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   F   L   P   S  
Index Entry  Section

F
File, Lisp, py4cl2.asd: The py4cl2․asd file
File, Lisp, py4cl2/callpython.lisp: The py4cl2/callpython․lisp file
File, Lisp, py4cl2/config.lisp: The py4cl2/config․lisp file
File, Lisp, py4cl2/do-after-load.lisp: The py4cl2/do-after-load․lisp file
File, Lisp, py4cl2/import-export.lisp: The py4cl2/import-export․lisp file
File, Lisp, py4cl2/lisp-classes.lisp: The py4cl2/lisp-classes․lisp file
File, Lisp, py4cl2/package.lisp: The py4cl2/package․lisp file
File, Lisp, py4cl2/python-process.lisp: The py4cl2/python-process․lisp file
File, Lisp, py4cl2/reader.lisp: The py4cl2/reader․lisp file
File, Lisp, py4cl2/writer.lisp: The py4cl2/writer․lisp file
File, static, py4cl2/.config: The py4cl2/․config file
File, static, py4cl2/python-code: The py4cl2/python-code file

L
Lisp File, py4cl2.asd: The py4cl2․asd file
Lisp File, py4cl2/callpython.lisp: The py4cl2/callpython․lisp file
Lisp File, py4cl2/config.lisp: The py4cl2/config․lisp file
Lisp File, py4cl2/do-after-load.lisp: The py4cl2/do-after-load․lisp file
Lisp File, py4cl2/import-export.lisp: The py4cl2/import-export․lisp file
Lisp File, py4cl2/lisp-classes.lisp: The py4cl2/lisp-classes․lisp file
Lisp File, py4cl2/package.lisp: The py4cl2/package․lisp file
Lisp File, py4cl2/python-process.lisp: The py4cl2/python-process․lisp file
Lisp File, py4cl2/reader.lisp: The py4cl2/reader․lisp file
Lisp File, py4cl2/writer.lisp: The py4cl2/writer․lisp file

P
py4cl2.asd: The py4cl2․asd file
py4cl2/.config: The py4cl2/․config file
py4cl2/callpython.lisp: The py4cl2/callpython․lisp file
py4cl2/config.lisp: The py4cl2/config․lisp file
py4cl2/do-after-load.lisp: The py4cl2/do-after-load․lisp file
py4cl2/import-export.lisp: The py4cl2/import-export․lisp file
py4cl2/lisp-classes.lisp: The py4cl2/lisp-classes․lisp file
py4cl2/package.lisp: The py4cl2/package․lisp file
py4cl2/python-code: The py4cl2/python-code file
py4cl2/python-process.lisp: The py4cl2/python-process․lisp file
py4cl2/reader.lisp: The py4cl2/reader․lisp file
py4cl2/writer.lisp: The py4cl2/writer․lisp file

S
Static File, py4cl2/.config: The py4cl2/․config file
Static File, py4cl2/python-code: The py4cl2/python-code file

Jump to:   F   L   P   S  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   %   (  
B   C   D   E   F   G   I   L   M   N   O   P   R   S   T   W  
Index Entry  Section

%
%chain*: Internal functions
%pycall-args: Internal functions

(
(setf chain*): Exported functions
(setf config-var): Exported functions
(setf pyeval): Exported functions
(setf python-object-handle): Internal functions
(setf python-object-type): Internal functions
(setf raw-pyeval): Exported functions

B
break-into-words: Internal functions
builtin-p: Internal functions

C
chain: Exported macros
chain*: Exported functions
clear-lisp-objects: Internal functions
collect-first-word: Internal functions
command: Internal generic functions
command: Internal generic functions
config-var: Exported functions
copy-python-object: Internal functions

D
defpyfun: Exported macros
defpyfuns: Exported macros
defpymodule: Exported macros
defpysubmodules: Internal functions
defvar-doc: Internal macros
delete-freed-python-objects: Internal functions
delete-numpy-pickle-arrays: Internal functions
dispatch-messages: Internal functions
dispatch-reply: Internal functions

E
export-function: Exported functions

F
free-handle: Internal functions
free-python-object: Internal functions
fun-symbol: Internal functions
Function, %chain*: Internal functions
Function, %pycall-args: Internal functions
Function, (setf chain*): Exported functions
Function, (setf config-var): Exported functions
Function, (setf pyeval): Exported functions
Function, (setf python-object-handle): Internal functions
Function, (setf python-object-type): Internal functions
Function, (setf raw-pyeval): Exported functions
Function, break-into-words: Internal functions
Function, builtin-p: Internal functions
Function, chain*: Exported functions
Function, clear-lisp-objects: Internal functions
Function, collect-first-word: Internal functions
Function, config-var: Exported functions
Function, copy-python-object: Internal functions
Function, defpysubmodules: Internal functions
Function, delete-freed-python-objects: Internal functions
Function, delete-numpy-pickle-arrays: Internal functions
Function, dispatch-messages: Internal functions
Function, dispatch-reply: Internal functions
Function, export-function: Exported functions
Function, free-handle: Internal functions
Function, free-python-object: Internal functions
Function, fun-symbol: Internal functions
Function, function-reload-string: Internal functions
Function, get-arg-list: Internal functions
Function, get-unique-symbol: Internal functions
Function, initialize: Exported functions
Function, lisp-object: Internal functions
Function, lispify-name: Internal functions
Function, load-config: Exported functions
Function, make-python-object: Internal functions
Function, make-python-object-finalize: Internal functions
Function, numeric-char-p: Internal functions
Function, object-handle: Internal functions
Function, py-cd: Exported functions
Function, pycall: Exported functions
Function, pyeval: Exported functions
Function, pyexec: Exported functions
Function, pygenerator: Exported functions
Function, pyhelp: Exported functions
Function, pyinterrupt: Exported functions
Function, pymethod: Exported functions
Function, pymethod-list: Exported functions
Function, pymodule-import-string: Internal functions
Function, pyslot-list: Exported functions
Function, pyslot-value: Exported functions
Function, pystart: Exported functions
Function, pystop: Exported functions
Function, python-alive-p: Exported functions
Function, python-object-handle: Internal functions
Function, python-object-p: Internal functions
Function, python-object-type: Internal functions
Function, python-start-if-not-alive: Exported functions
Function, pythonize-kwargs: Internal functions
Function, pyversion-info: Exported functions
Function, raw-py: Internal functions
Function, raw-pyeval: Exported functions
Function, raw-pyexec: Exported functions
Function, save-config: Exported functions
Function, split-point-p: Internal functions
Function, stream-read-string: Internal functions
Function, stream-read-value: Internal functions
Function, stream-write-string: Internal functions
Function, stream-write-value: Internal functions
Function, take-input: Internal functions
function-reload-string: Internal functions

G
Generic Function, command: Internal generic functions
Generic Function, python-getattr: Exported generic functions
Generic Function, pythonize: Exported generic functions
Generic Function, text: Internal generic functions
get-arg-list: Internal functions
get-unique-symbol: Internal functions

I
initialize: Exported functions

L
lisp-object: Internal functions
lispify-name: Internal functions
load-config: Exported functions

M
Macro, chain: Exported macros
Macro, defpyfun: Exported macros
Macro, defpyfuns: Exported macros
Macro, defpymodule: Exported macros
Macro, defvar-doc: Internal macros
Macro, with-python-output: Exported macros
Macro, with-remote-objects: Exported macros
Macro, with-remote-objects*: Exported macros
make-python-object: Internal functions
make-python-object-finalize: Internal functions
Method, command: Internal generic functions
Method, pythonize: Exported generic functions
Method, pythonize: Exported generic functions
Method, pythonize: Exported generic functions
Method, pythonize: Exported generic functions
Method, pythonize: Exported generic functions
Method, pythonize: Exported generic functions
Method, pythonize: Exported generic functions
Method, pythonize: Exported generic functions
Method, pythonize: Exported generic functions
Method, pythonize: Exported generic functions
Method, pythonize: Exported generic functions
Method, text: Internal generic functions

N
numeric-char-p: Internal functions

O
object-handle: Internal functions

P
py-cd: Exported functions
pycall: Exported functions
pyeval: Exported functions
pyexec: Exported functions
pygenerator: Exported functions
pyhelp: Exported functions
pyinterrupt: Exported functions
pymethod: Exported functions
pymethod-list: Exported functions
pymodule-import-string: Internal functions
pyslot-list: Exported functions
pyslot-value: Exported functions
pystart: Exported functions
pystop: Exported functions
python-alive-p: Exported functions
python-getattr: Exported generic functions
python-object-handle: Internal functions
python-object-p: Internal functions
python-object-type: Internal functions
python-start-if-not-alive: Exported functions
pythonize: Exported generic functions
pythonize: Exported generic functions
pythonize: Exported generic functions
pythonize: Exported generic functions
pythonize: Exported generic functions
pythonize: Exported generic functions
pythonize: Exported generic functions
pythonize: Exported generic functions
pythonize: Exported generic functions
pythonize: Exported generic functions
pythonize: Exported generic functions
pythonize: Exported generic functions
pythonize-kwargs: Internal functions
pyversion-info: Exported functions

R
raw-py: Internal functions
raw-pyeval: Exported functions
raw-pyexec: Exported functions

S
save-config: Exported functions
split-point-p: Internal functions
stream-read-string: Internal functions
stream-read-value: Internal functions
stream-write-string: Internal functions
stream-write-value: Internal functions

T
take-input: Internal functions
text: Internal generic functions
text: Internal generic functions

W
with-python-output: Exported macros
with-remote-objects: Exported macros
with-remote-objects*: Exported macros

Jump to:   %   (  
B   C   D   E   F   G   I   L   M   N   O   P   R   S   T   W  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   *   +  
C   H   S   T  
Index Entry  Section

*
*array-type*: Exported special variables
*arrayfiers*: Exported special variables
*called-from-defpymodule*: Internal special variables
*config*: Exported special variables
*current-python-process-id*: Internal special variables
*defpymodule-silent-p*: Exported special variables
*freed-python-objects*: Internal special variables
*function-reload-string*: Internal special variables
*handle-counter*: Internal special variables
*in-with-python-output*: Internal special variables
*is-submodule*: Internal special variables
*lisp-objects*: Internal special variables
*lisp-package-supplied-p*: Internal special variables
*lisp-to-python-alist*: Internal special variables
*numpy-pickle-index*: Internal special variables
*py4cl-tests*: Internal special variables
*python*: Internal special variables
*python-code*: Internal special variables
*python-output-semaphore*: Internal special variables
*python-output-thread*: Internal special variables
*python-process-busy-p*: Internal special variables
*python-startup-error*: Internal special variables

+
+py4cl2-config-path+: Internal constants

C
command: Exported conditions
Constant, +py4cl2-config-path+: Internal constants

H
handle: Internal structures

S
Slot, command: Exported conditions
Slot, handle: Internal structures
Slot, text: Exported conditions
Slot, type: Internal structures
Special Variable, *array-type*: Exported special variables
Special Variable, *arrayfiers*: Exported special variables
Special Variable, *called-from-defpymodule*: Internal special variables
Special Variable, *config*: Exported special variables
Special Variable, *current-python-process-id*: Internal special variables
Special Variable, *defpymodule-silent-p*: Exported special variables
Special Variable, *freed-python-objects*: Internal special variables
Special Variable, *function-reload-string*: Internal special variables
Special Variable, *handle-counter*: Internal special variables
Special Variable, *in-with-python-output*: Internal special variables
Special Variable, *is-submodule*: Internal special variables
Special Variable, *lisp-objects*: Internal special variables
Special Variable, *lisp-package-supplied-p*: Internal special variables
Special Variable, *lisp-to-python-alist*: Internal special variables
Special Variable, *numpy-pickle-index*: Internal special variables
Special Variable, *py4cl-tests*: Internal special variables
Special Variable, *python*: Internal special variables
Special Variable, *python-code*: Internal special variables
Special Variable, *python-output-semaphore*: Internal special variables
Special Variable, *python-output-thread*: Internal special variables
Special Variable, *python-process-busy-p*: Internal special variables
Special Variable, *python-startup-error*: Internal special variables

T
text: Exported conditions
type: Internal structures

Jump to:   *   +  
C   H   S   T  

Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   C   P   S  
Index Entry  Section

C
Condition, pyerror: Exported conditions
Condition, python-process-startup-error: Exported conditions

P
Package, py4cl2: The py4cl2 package
py4cl2: The py4cl2 system
py4cl2: The py4cl2 package
pyerror: Exported conditions
python-object: Internal structures
python-process-startup-error: Exported conditions

S
Structure, python-object: Internal structures
System, py4cl2: The py4cl2 system

Jump to:   C   P   S