- Intro
- Dependencies
- Test dependencies
- Foreign dependencies
- API
- Examples
- Author(s)
- Maintainer(s)
- Version
- License
- Tags
This package provides an experimental interface to Python 3, based on Ivan Raikov's package for CHICKEN Scheme.
None from Cyclone, but it needs python3-dev or similar. In Debian Linux
you should run:
$ sudo apt install python3-devNone
None
The API provides a set of high-level procedures and another with low-level ones. Only high-level procedures are documented here.
Mandatory to run it before any other procedure from this package. Run only once.
Mandatory to run after any other procedure from this package to avoid memory leaking. Run only once.
This is the simplest way to run Python code. We can, for example, run:
(py-run-simple-string "print(1+2)")
;; => 3But note that this procedure does not return data. Use py-value or py bellow to get the return value in Scheme format.
If we already have a Python project, we can use this procedure to run it. See the run-file.scm example.
Evaluates var and returns it. See the test file for example of usage.
This macro converts a Python procedure into a Scheme one. The name can be a string or a list (not quoted) with a string (the Python procedure name) and a symbol (the Scheme name for the procedure). arg1 is optional.
This macro converts a Python object method into a Scheme procedure.
The name can be a string or a list (not quoted) with a string (the Python method name) and a symbol (the Scheme name for the created procedure). arg1 is optional.
The generated procedure is called with the method's parent object as the first parameter and has a rest parameter, so other arguments can be passed.
See the h5py.scm and swriter.scm for examples.
This macro converts a Python object attribute into a Scheme procedure. If you want to set the attribute into a variable, use py-value instead.
The generated procedure is called with the attribute's parent object as the first parameter. If a second parameter is given, the attribute is set to it.
The name can be a string or a list (not quoted) containing a string (the Python attribute name) and a symbol (the Scheme name for the created procedure). arg1 is optional.
See the h5py.scm and swriter.scm for examples.
This is the quickest form to retrieve Python values from module procedures or attributes. See the test file for example of usage.
A wrapper around the high-level commands above that runs (py-start) and (py-stop) automatically.
(with-python
(py-import "math")
(py-value "math.pi"))is equivalent to
(py-start)
(py-import "math")
(py-value "math.pi")
(py-stop)- Ivan Raikov
- Arthur Maciel
Arthur Maciel
"0.3.0"
BSD
FFI