Skip to main content

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

Project description

This package provides bindings to the deltachat-core Rust -library which implements IMAP/SMTP/MIME/PGP 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 try to 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 install virtualenv, then create a fresh Python virtual environment and activate it in your shell:

virtualenv venv  # or: python -m venv
source venv/bin/activate

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

For Linux, we automatically build wheels for all github PR branches and push them to a python package index. To install the latest github master branch:

pip install --pre -i https://m.devpi.net/dc/master deltachat

To verify it worked:

python -c "import deltachat"

Running tests

After successful binding installation you can install a few more Python packages before running the tests:

python -m pip install pytest pytest-xdist pytest-timeout pytest-rerunfailures requests
pytest -v tests

This 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](https://mailadm.readthedocs.io/en/latest/).

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 exists only for one hour and then are removed completely. One hour is enough to invoke pytest and run all offline and online tests:

pytest

# or if you have installed pytest-xdist for parallel test execution pytest -n6

Each test run creates new accounts.

Installing bindings from source (Updated: July 2020)

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.

Ensure you are in the deltachat-core-rust/python directory, create the virtual environment and activate it in your shell:

cd python
python3 -m venv venv  # or: virtualenv venv
source venv/bin/activate

You should now be able to build the python bindings using the supplied script:

python install_python_bindings.py

The core compilation and bindings building might take a while, depending on the speed of your machine. The bindings will be installed in release mode but with debug symbols. The release mode is currently necessary because some tests generate RSA keys which is prohibitively slow in non-release mode.

Code examples

You may look at examples.

Building manylinux based wheels

Building portable manylinux wheels which come with libdeltachat.so can be done with docker-tooling.

using docker pull / premade images

We publish a build environment under the deltachat/coredeps tag so that you can pull it from the hub.docker.com site’s “deltachat” organization:

$ docker pull deltachat/coredeps

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

Optionally build your own docker image

If you want to build your own custom docker image you can do this:

$ cd deltachat-core # cd to deltachat-core checkout directory
$ docker build -t deltachat/coredeps scripts/docker_coredeps

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

$ docker images

Troubleshooting

On more recent systems running the docker image may crash. You can fix this by adding vsyscall=emulate to the Linux kernel boot arguments commandline. E.g. on Debian you’d add this to GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub.

Project details


Download files

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

Source Distribution

deltachat-1.68.0.tar.gz (111.7 kB view details)

Uploaded Source

Built Distributions

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

deltachat-1.68.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (9.8 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

deltachat-1.68.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (9.6 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ ARM64

deltachat-1.68.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (9.8 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

deltachat-1.68.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (9.6 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ ARM64

deltachat-1.68.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (9.8 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.17+ x86-64

deltachat-1.68.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (9.6 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.17+ ARM64

File details

Details for the file deltachat-1.68.0.tar.gz.

File metadata

  • Download URL: deltachat-1.68.0.tar.gz
  • Upload date:
  • Size: 111.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: devpi-server/6.3.0 (py3.8.11; linux)

File hashes

Hashes for deltachat-1.68.0.tar.gz
Algorithm Hash digest
SHA256 00684029debb9a11904a64ec996d0782f0c60d3da137dd66ec40851916827cba
MD5 920fba0b19c4d5a72d0e282561f0dd92
BLAKE2b-256 b281497f08e39ff45067b5050a5408f9f8c34cd0eccba0f4c737a8a55040fd99

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for deltachat-1.68.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d3be019325fb375dd92769acd476141c33385acfd28bf862e8d4910f9d86756b
MD5 e039624997942c13954db41ade118a90
BLAKE2b-256 763032a4a51725514bd221ff4d0df6275b97ae76a8a13590d440bb087d7ff3c2

See more details on using hashes here.

File details

Details for the file deltachat-1.68.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for deltachat-1.68.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 38b7e3e2795a18ebb65cc3c4904eb9a9e081bb59f32559536f05e265973bd8ab
MD5 8ce28a754d24fb9ab2651d45802e54c3
BLAKE2b-256 ccb412cae4853f0e9840d1941ba4bb0bf189598a87692bc576994efc7655bc0b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for deltachat-1.68.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 05002df355344861c28a02e015fa13691780b28dae7fb0d51910bae7899864ed
MD5 3b250f32fa90328eab3afbfc1cc3e5a6
BLAKE2b-256 feade2a292c40d9006efe53916925a71d5e878a34abe6be00516840086c5a3fd

See more details on using hashes here.

File details

Details for the file deltachat-1.68.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for deltachat-1.68.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 31b176eaa132cc4833f2e335218d4ba097162ead019659b508afde53a2527f62
MD5 05978b3a562867e4f8ce15b937f00b4f
BLAKE2b-256 8838bac9d18d186acb6a59a306fc3a7a68967767dd057b9bfe9630683c650d5a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for deltachat-1.68.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 080421419868e2dc035639570e2101a320d932112e0e86e7f994fc5c58f02e9d
MD5 a839ce7b0507cd26d905dc3a3078eade
BLAKE2b-256 13b005f3de6a6dd142c3b2f1f3f11fc9d21eef8f403d274a1663688dd12b026a

See more details on using hashes here.

File details

Details for the file deltachat-1.68.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for deltachat-1.68.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 994dad883739e4700456c86940c8497d37ce127b3a6a20baa71d53a247d54f74
MD5 f61c578588a7fd71201aca87caab9481
BLAKE2b-256 d4ce229eabcbafd5cf9b11d1a5c5ca5819dc0b4c65055fcba493689e58e79d31

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