Skip to content

Commit 4f37403

Browse files
authored
Readme: v0.7 new features
1 parent 551209a commit 4f37403

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

README.md

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,50 @@ Python adapter via callout for InterSystems Data Platforms.
33

44
# Installation
55

6-
0. [Install Python 3.6.7 64 bit](https://www.python.org/downloads/release/python-367/).
7-
1. Load ObjectScript code (i.e. `do $system.OBJ.LoadDir("C:\InterSystems\Repos\Python\isc\py\","*.cls",,1)`).
8-
2. Place [callout DLL/SO/DYLIB](https://github.com/intersystems-ru/PythonAdapter/releases) in the `bin` folder of your InterSystems IRIS installation. Library file should be placed into a path returned by `write ##class(isc.py.Callout).GetLib()`.
6+
1. [Install Python 3.6.7 64 bit](https://www.python.org/downloads/release/python-367/).
7+
2. Install `dill` module: `pip install dill` (required for context harvesting)
8+
3. Load ObjectScript code (i.e. `do $system.OBJ.LoadDir("C:\InterSystems\Repos\Python\isc\py\","*.cls",,1)`).
9+
4. Place [callout DLL/SO/DYLIB](https://github.com/intersystems-ru/PythonAdapter/releases) in the `bin` folder of your InterSystems IRIS installation. Library file should be placed into a path returned by `write ##class(isc.py.Callout).GetLib()`.
910

1011
## Windows
1112

12-
3. Check that your `PYTHONHOME` environment variable points to Python 3.6.7.
13-
4. Check that your SYSTEM `PATH` environment variable has `PYTHONHOME` variable (or directory it points to).
13+
5. Check that your `PYTHONHOME` environment variable points to Python 3.6.7.
14+
6. Check that your SYSTEM `PATH` environment variable has `PYTHONHOME` variable (or directory it points to).
1415

15-
## Linux && Mac
16+
## Linux
1617

17-
3. Check that your SYSTEM `PATH` environment variable has `/usr/lib` and `/usr/lib/x86_64-linux-gnu`, preferably at the begining. Use `/etc/environment` file to set environment variables.
18+
5. Check that your SYSTEM `PATH` environment variable has `/usr/lib` and `/usr/lib/x86_64-linux-gnu`, preferably at the begining. Use `/etc/environment` file to set environment variables.
19+
6. In cause of errors check Troubleshooting section `undefined symbol: _Py_TrueStruct` and specify PythonLib property.
20+
21+
## Mac
22+
23+
5. Only python 3.6.7 from [Python.org](https://www.python.org/downloads/release/python-367/). is currently supported. Check `PATH` variable.
1824

1925
If you modified environment variables restart your InterSystems product.
2026

2127
## Docker
2228

2329
1. To build docker image:
2430
- Copy `iscpython.so` into repository root (if it's not there)
25-
- Execute in repository root `docker build --force-rm --tag irispy/iris:2019.1 .`
31+
- Execute in repository root `docker build --force-rm --tag intersystems-community/irispy:latest .`
2632
2. To run docker image execute:
2733

2834
```
2935
docker run -d \
3036
-p 52773:52773 \
3137
-v /<HOST-DIR-WITH-iris.key>/:/mount \
3238
--name irispy \
33-
irispy/iris:2019.1 \
39+
intersystems-community/irispy:latest \
3440
--key /mount/iris.key \
3541
```
3642
3. Test process `isc.py.test.Process` saves image aftifact into temp directory. You might want to change that path to a monted directory. To do that edit annotation for `Correlation Matrix: Graph` call, specifying valid filepath for `f.savefig` function.
3743
4. For terminal access execute: `docker exec -it irispy sh`.
38-
5. Access SMP with SuperUser/SYS or Admin/SYS users.
44+
5. Access SMP with SuperUser/SYS or Admin/SYS user/passowrd.
3945
6. To stop container execute: `docker stop irispy && docker rm --force irispy`.
4046

4147
# Use
4248

43-
1. Call: `set sc = ##class(isc.py.Callout).Setup()` once per systems start (add to ZSTART: [docs](https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=GSTU_customize#GSTU_customize_startstop), [sample](https://gist.githubusercontent.com/eduard93/412ed81e2bf619269ab4a49d939d2304/raw/c9d5f922827db5052b6e1195616d333ffe7dc1ec/%2525ZSTART)).
49+
1. Call: `set sc = ##class(isc.py.Callout).Setup()` once per systems start (add to ZSTART: [docs](https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=GSTU_customize#GSTU_customize_startstop), sample routine available in `rtn` folder).
4450
2. Call main method (can be called many times, context persists): `write ##class(isc.py.Main).SimpleString(code, variable, , .result)`
4551
3. Call: `set sc = ##class(isc.py.Callout).Finalize()` to free Python context.
4652
4. Call: `set sc = ##class(isc.py.Callout).Unload()` to free callout library.
@@ -58,13 +64,16 @@ Generally the main interface to Python is `isc.py.Main`. It offers these methods
5864
- `SimpleString(code, returnVariable, serialization, .result)` - for cases where both code and variable are strings.
5965
- `ExecuteCode(code, variable)` - execute `code` (it may be a stream or string), optionally ser result into `variable`.
6066
- `GetVariable(variable, serialization, .stream, useString)` - get `serialization` of `variable` in `stream`. If `useString` is 1 and variable serialization can fit into string then string is returned instead of the stream.
61-
- `GetVariableInfo(variable, serialization, .defined, .type, .length)` - get info about variable: is it defined, type,and serialization length.
67+
- `GetVariableInfo(variable, serialization, .defined, .type, .length)` - get info about variable: is it defined, type,and serialization length.
6268
- `GetStatus()` - returns last occured exception in Python and clears it.
6369
- `GetVariableJson(variable, .stream, useString)` - get JSON serialization of variable.
6470
- `GetVariablePickle(variable, .stream, useString)` - get Pickle serialization of variable.
6571
- `ExecuteQuery(query, variable, type)` - create resultset (pandas `dataframe` or `list`) from sql query and set it into `variable`.
6672
- `ImportModule(module, .imported, .alias)` - import module with alias.
6773
- `GetModuleInfo(module, .imported, .alias)` - get module alias and is it currently imported.
74+
- `GetFunctionInfo(function, .defined, .type, .docs, .signature, .arguments)` - get function information.
75+
- `ExecuteFunction(function, positionalArguments, keywordArguments, variable, serialization, .result)` - execute Python function or method, write result into Pyhton `variable`, return chosen serialization in `result`.
76+
- `ExecuteFunctionArgs(function, variable, serialization, .result, args...)` - execute Python function or method, write result into Pyhton `variable`, return chosen serialization in `result`. Builds `positionalArguments` and `keywordArguments` and passes them to `ExecuteFunction`. It's recommended to use `ExecuteFunction`. More information in [Gateway docs](Gateway.md).
6877

6978
Possible Serializations:
7079
- `##class(isc.py.Callout).SerializationStr` - Serialization by str() function
@@ -123,7 +132,7 @@ set sc = ##class(%UnitTest.Manager).RunTest(,"/nodelete")
123132

124133
# ZLANGC00
125134

126-
Install [this ZLANG routine](https://gist.githubusercontent.com/eduard93/2c3159c7dc71f03c4081a99093d8ff37/raw/3bc83f2dc7348ea11ab982b0e3d54cfcef198d17/%2525ZLANGC00.xml) to add `zpy` command:
135+
Install ZLANG routine from `rtn` folder to add `zpy` command:
127136

128137
```
129138
zpy "import random"

0 commit comments

Comments
 (0)