mirror of
https://github.com/chatmail/core.git
synced 2026-04-26 09:56:35 +03:00
this pr keeps and refines documentation added in #4951, however, reverts the api introduced by #4951 which turns out to be not useful for UI in practise: UI anyway check for chat/no-chat beforehand, so a simple condition in profiles as `green_checkmark = chat_exist ? chat_is_protected() : contact_is_verified()` is more useful in practise and is waht UI need and did already in the past. (https://github.com/deltachat/deltachat-android/pull/2836 shows a detailed discussion) (as a side effect, beside saving code, this PR saves up to three database calls (get contact from chat in UI to pass it to profile_is_verified(), get chat from contact in core, load is_protected in core) - instead, core can use already is_protected from already loaded chat object) /me did check rust-tests, fingers crossed for python tests /me should re-setup python tests on local machine at some point :)
Delta Chat RPC python client
RPC client connects to standalone Delta Chat RPC server deltachat-rpc-server
and provides asynchronous interface to it.
Getting started
To use Delta Chat RPC client, first build a deltachat-rpc-server with cargo build -p deltachat-rpc-server
or download a prebuilt release.
Install it anywhere in your PATH.
Create a virtual environment if you don't have one already and activate it.
$ python -m venv env
$ . env/bin/activate
Install deltachat-rpc-client from source:
$ cd deltachat-rpc-client
$ pip install .
Testing
- Build
deltachat-rpc-serverwithcargo build -p deltachat-rpc-server. - Run
PATH="../target/debug:$PATH" tox.
Additional arguments to tox are passed to pytest, e.g. tox -- -s does not capture test output.
Using in REPL
Setup a development environment:
$ tox --devenv env
$ . env/bin/activate
$ python
>>> from deltachat_rpc_client import *
>>> rpc = Rpc()
>>> rpc.start()
>>> dc = DeltaChat(rpc)
>>> system_info = dc.get_system_info()
>>> system_info["level"]
'awesome'
>>> rpc.close()