Skip to main content

Python bindings for the Delta Chat Core library using CFFI against the Rust-implemented libdeltachat

Project description

This package provides Python bindings to the deltachat-core library which implements IMAP/SMTP/MIME/OpenPGP e-mail standards and offers a low-level Chat/Contact/Message API to user interfaces and bots.

Installing pre-built packages (Linux-only)

If you have a Linux system you may install the deltachat binary “wheel” packages without any “build-from-source” steps. Otherwise you need to compile the Delta Chat bindings yourself.

We recommend to first create a fresh Python virtual environment and activate it in your shell:

python -m venv env
source env/bin/activate

Afterwards, invoking python or pip install only modifies files in your env directory and leaves your system installation alone.

For Linux we build wheels for all releases and push them to a python package index. To install the latest release:

pip install deltachat

To verify it worked:

python -c "import deltachat"

Running tests

Recommended way to run tests is using scripts/run-python-test.sh script provided in the core repository.

This script compiles the library in debug mode and runs the tests using tox. By default it will run all “offline” tests and skip all functional end-to-end tests that require accounts on real e-mail servers.

Running “live” tests with temporary accounts

If you want to run live functional tests you can set DCC_NEW_TMP_EMAIL to a URL that creates e-mail accounts. Most developers use https://testrun.org URLs created and managed by mailadm.

Please feel free to contact us through a github issue or by e-mail and we’ll send you a URL that you can then use for functional tests like this:

export DCC_NEW_TMP_EMAIL=<URL you got from us>

With this account-creation setting, pytest runs create ephemeral e-mail accounts on the http://testrun.org server. These accounts are removed automatically as they expire. After setting the variable, either rerun scripts/run-python-test.sh or run offline and online tests with tox directly:

tox -e py

Each test run creates new accounts.

Developing the bindings

If you want to develop or debug the bindings, you can create a testing development environment using tox:

tox -c python --devenv env
. env/bin/activate

Inside this environment the bindings are installed in editable mode (as if installed with python -m pip install -e) together with the testing dependencies like pytest and its plugins.

You can then edit the source code in the development tree and quickly run pytest manually without waiting for tox to recreating the virtual environment each time.

Installing bindings from source

Install Rust and Cargo first. The easiest is probably to use rustup.

Bootstrap Rust and Cargo by using rustup:

curl https://sh.rustup.rs -sSf | sh

Then clone the deltachat-core-rust repo:

git clone https://github.com/deltachat/deltachat-core-rust
cd deltachat-core-rust

To install the Delta Chat Python bindings make sure you have Python3 installed. E.g. on Debian-based systems apt install python3 python3-pip python3-venv should give you a usable python installation.

First, build the core library:

cargo build --release -p deltachat_ffi --features jsonrpc

jsonrpc feature is required even if not used by the bindings because deltachat.h includes JSON-RPC functions unconditionally.

Create the virtual environment and activate it:

python -m venv env source env/bin/activate

Build and install the bindings:

export DCC_RS_DEV=”$PWD” export DCC_RS_TARGET=release python -m pip install ./python

DCC_RS_DEV environment variable specifies the location of the core development tree. If this variable is not set, libdeltachat library and deltachat.h header are expected to be installed system-wide.

When DCC_RS_DEV is set, DCC_RS_TARGET specifies the build profile name to look up the artifacts in the target directory. In this case setting it can be skipped because DCC_RS_TARGET=release is the default.

Building manylinux based wheels

Building portable manylinux wheels which come with libdeltachat.so can be done with Docker or Podman.

If you want to build your own wheels, build container image first:

$ cd deltachat-core-rust # cd to deltachat-core-rust working tree
$ docker build -t deltachat/coredeps scripts/coredeps

This will use the scripts/coredeps/Dockerfile to build container image called deltachat/coredeps. You can afterwards find it with:

$ docker images

This docker image can be used to run tests and build Python wheels for all interpreters:

$ docker run -e DCC_NEW_TMP_EMAIL \
   --rm -it -v $(pwd):/mnt -w /mnt \
   deltachat/coredeps scripts/run_all.sh

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

deltachat-1.114.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.3 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ x86-64

deltachat-1.114.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.3 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ x86-64

deltachat-1.114.0-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.3 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ x86-64

deltachat-1.114.0-cp311-cp311-musllinux_1_1_x86_64.whl (11.5 MB view details)

Uploaded CPython 3.11musllinux: musl 1.1+ x86-64

deltachat-1.114.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.5 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

deltachat-1.114.0-cp310-cp310-musllinux_1_1_x86_64.whl (11.5 MB view details)

Uploaded CPython 3.10musllinux: musl 1.1+ x86-64

deltachat-1.114.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.5 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

deltachat-1.114.0-cp39-cp39-musllinux_1_1_x86_64.whl (11.5 MB view details)

Uploaded CPython 3.9musllinux: musl 1.1+ x86-64

deltachat-1.114.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.5 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

deltachat-1.114.0-cp38-cp38-musllinux_1_1_x86_64.whl (11.5 MB view details)

Uploaded CPython 3.8musllinux: musl 1.1+ x86-64

deltachat-1.114.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.5 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

deltachat-1.114.0-cp37-cp37m-musllinux_1_1_x86_64.whl (11.5 MB view details)

Uploaded CPython 3.7mmusllinux: musl 1.1+ x86-64

deltachat-1.114.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.5 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.17+ x86-64

File details

Details for the file deltachat-1.114.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for deltachat-1.114.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a23ed29db21219dbb51920169f44fa0b22050b2966ee68a159072c77721a725c
MD5 7379ed94c8b3634d55b6e949e7a3a259
BLAKE2b-256 00a625b30ab0ff5fb61230ff85db0975dbe515b854d99dacfa145f639d1f048c

See more details on using hashes here.

File details

Details for the file deltachat-1.114.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for deltachat-1.114.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0609116ec01ecea047db3eb208f7fdab161f33a38e277c870cebcaabde49ea75
MD5 b62a241b1d38356cd8f2b8f3bff5f41a
BLAKE2b-256 efe751aa315bc2dfeb6b7af0ed1bf64164f34e365a60c04d949fbbe3ab717b7d

See more details on using hashes here.

File details

Details for the file deltachat-1.114.0-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for deltachat-1.114.0-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f152b9201c5d24f912ecc26af3bce57a53e94fb124c120ef499e36537a2dbd23
MD5 5c392629533efde8f51448dab67cbbe1
BLAKE2b-256 eee04f9aa75766b90dec7b34d7687f103cb4a4546fdc46fc2f8bf6054886460b

See more details on using hashes here.

File details

Details for the file deltachat-1.114.0-cp311-cp311-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for deltachat-1.114.0-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 fe7e5b3717c1d837b0471faeb776efc9bb906ed2bd280decc5e6d85f9412f4e3
MD5 5417140b172a73aa6dfcf9de6d328e4a
BLAKE2b-256 9b4b8e7b1267cd30cad3bbdba6a22623a131164605834fe48ced0af8cae799b9

See more details on using hashes here.

File details

Details for the file deltachat-1.114.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for deltachat-1.114.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 12b0d3f3d7a8024920398e3fb752622e7e895c36dda3001041b39db9b6c0cf62
MD5 fa834074129049b13e4b8c6dfd510941
BLAKE2b-256 1bbbe59e4a730d0d529a1de80fce94da3922f1ad2b15ce67ddccf91d67c26e28

See more details on using hashes here.

File details

Details for the file deltachat-1.114.0-cp310-cp310-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for deltachat-1.114.0-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 5c7bab004f2ca6db1a026dd34db25ace28aca08667a9c38c6e0c94ddf2e5d8d7
MD5 79c4b3a641bf52474e9c6cad5c43053b
BLAKE2b-256 46249feda059bac459ead6c6e3a7ec138897a4304d60af68ae625669f0b687de

See more details on using hashes here.

File details

Details for the file deltachat-1.114.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for deltachat-1.114.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 aae96c8e531ccc9060475938e5b73eaede327413db9a2ef4aeaa19a992158d20
MD5 84bbb5b16d91a9148395fcd55e6554f9
BLAKE2b-256 4277d9a78aa901ee4d35ec3e9ecbbd557c418fee9c677a0670bb15c733f0d168

See more details on using hashes here.

File details

Details for the file deltachat-1.114.0-cp39-cp39-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for deltachat-1.114.0-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 80ceac20df52cda00dd2a2e42b349875f4ef2c06d2de2bf9d91a78971c4c71a7
MD5 512dc89019a8c6c4b410319bdf2b0c7e
BLAKE2b-256 4eb7b812d99a26cf7bf96faf3e83b4d415d440630f4aa8cd99a920f6cd62720a

See more details on using hashes here.

File details

Details for the file deltachat-1.114.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for deltachat-1.114.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a72974c06ad55d7946e600d1538ac357b00c25371e4659a699f7af7951069328
MD5 4590a07dee7f2c9980d50b6b70dc4d4e
BLAKE2b-256 cd0a42363ba381a933e408f623d79b34fc71d05f48000ea52d2b026b0bea9db6

See more details on using hashes here.

File details

Details for the file deltachat-1.114.0-cp38-cp38-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for deltachat-1.114.0-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 2bb792c02e1d750ad41501931daac23c9527d9926fe3129e9404fc0617f1c87e
MD5 7e43044e80e608678d3cdc7d974af3cc
BLAKE2b-256 7705adbbb901befaf6b7761940f4873a8a671a94b9cfebc2d36b9d1ae23c57d8

See more details on using hashes here.

File details

Details for the file deltachat-1.114.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for deltachat-1.114.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 27075e09a9f4e01589283ac32f1cc8fce540cc6493cc45f8dd1daf4d27a35278
MD5 5d764b597ec7a377bd58a35eb05f6386
BLAKE2b-256 1168e840a7508020b3b18f7b7778224232cefac3a01fe88543239b4aecd94554

See more details on using hashes here.

File details

Details for the file deltachat-1.114.0-cp37-cp37m-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for deltachat-1.114.0-cp37-cp37m-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 b077c2107c67daef8a1e74a850fc833262ec4335a956548065b190c21ecb5de9
MD5 c9b49f045e4ac774abbb3670cd55312d
BLAKE2b-256 47eb1a2231ab478d938bc278bf6c4facacd644c7d50d194061a80e3e5fb204f0

See more details on using hashes here.

File details

Details for the file deltachat-1.114.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for deltachat-1.114.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b892d854ef656bd57bd20cc3f88cb47902d6b7422820f27e1fe9dcf0628cdfdc
MD5 61af3de778ef95c9e80965afde0f314c
BLAKE2b-256 c402d8643f1493e65a655f4315006962f46d6dee0cfb5b86fe5647b27d75bab0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page