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.61.0.zip (132.2 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.61.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (9.6 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

deltachat-1.61.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (9.5 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ ARM64

deltachat-1.61.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (9.6 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

deltachat-1.61.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (9.5 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ ARM64

deltachat-1.61.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (9.6 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.17+ x86-64

deltachat-1.61.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (9.5 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.17+ ARM64

File details

Details for the file deltachat-1.61.0.zip.

File metadata

  • Download URL: deltachat-1.61.0.zip
  • Upload date:
  • Size: 132.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: devpi-server/6.2.1.dev0 (py3.8.11; linux)

File hashes

Hashes for deltachat-1.61.0.zip
Algorithm Hash digest
SHA256 fbba216769c3e56967c0572cb36a120135e9c54e12a21b9c20930cc2187c24df
MD5 cd65b91e1a731f70ac5a7c5d5ca803d0
BLAKE2b-256 9804f74c264a5526d1907b01359c1de0fb60bfc1f58180f8f9de037da8de77b8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for deltachat-1.61.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 734d80686047ac5d2bd88b74da6768eebadf946323e8cdc1252cfe0111a029cc
MD5 2b972dbd99d3f48f0595865b6f3d5334
BLAKE2b-256 9b4f7009d40235630652214d89fc0fa3541849050b7fa53e99cf96b5b9dd9315

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for deltachat-1.61.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7e5c3958e7adb960e524ef89e717e4fc51bc7429ee58b02fda399f5c006af6f3
MD5 736633e978f1b9870974652076a7219b
BLAKE2b-256 b4d80f5084be2ce8f3289828d549f09c962ba2b30fb9bc1c98f32705ccf61427

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for deltachat-1.61.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 24fbca0f1ce821bfdd55f7308294b6c95534b4daf992a8e11af2b56adc24c019
MD5 43b71d993de84114b043ed9e092d51c2
BLAKE2b-256 ffcefb3def79afe945466cbae07264a25b2a90fb2cd3d485bc0099bc497ccdea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for deltachat-1.61.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2271828d07bed9814ae027246aee8c989536bda037d0888634c0bb50d24d1c16
MD5 eb74dc3880378224c4b206b824a8f485
BLAKE2b-256 55aa65ea2465514004c8898fe8c89e372a505e8a215e2a6923ac6477e8188804

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for deltachat-1.61.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7a1f932b4d929b375bc8ae20455c740f7928d50f4a5239028b5a9f9c04c17b58
MD5 7ec9fc153910a4620806bdbf44f8f212
BLAKE2b-256 bf14363f48608d7f5b8d1c5cf6e2d448d4b6decba751217c40ac579ed16b5ea7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for deltachat-1.61.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 84288a34a4f61d89579c17e23495dc7848e66ef27bd2b22df437fae7c63e906e
MD5 a096721f53ae6e8371350deedbc76dd3
BLAKE2b-256 4d38f9106abc4fffab6ae1548f83c30da22a815b238eff9cc7fea0e85f084cfc

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