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.85.0.tar.gz (115.3 kB view details)

Uploaded Source

Built Distributions

deltachat-1.85.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.7 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

deltachat-1.85.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (8.7 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

deltachat-1.85.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.7 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

deltachat-1.85.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (8.7 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ ARM64

deltachat-1.85.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.7 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

deltachat-1.85.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (8.7 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ ARM64

deltachat-1.85.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.7 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.17+ x86-64

deltachat-1.85.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (8.7 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.17+ ARM64

File details

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

File metadata

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

File hashes

Hashes for deltachat-1.85.0.tar.gz
Algorithm Hash digest
SHA256 145caa28482b308415c009b2d1eee3d7bdb2be24083cf9c11144f2d1549b4a9d
MD5 62716925358812bf96f85d5452eb9d11
BLAKE2b-256 6b82a6c16c79af445b782271d1eac4b2db48896b29d1829a40469e42a3a0713c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for deltachat-1.85.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c91642b58c90eee86daf85168bc29683ef029ebcd1ee3506214b4b101d9ca039
MD5 5ee9e9f2d204f6559eeec9c4e3494cc6
BLAKE2b-256 0653c90846b6c26694c53bea58f85d08be71fd437933a4745e7d3182f2143966

See more details on using hashes here.

File details

Details for the file deltachat-1.85.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for deltachat-1.85.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 bd2e4e3b31d1e7c865e39c88b25653407400e28a123b17a64bf6f368bfcfe9d4
MD5 32a08dad82db13479a69334bf6f5bf46
BLAKE2b-256 3fb8e76e2259d6c48fd7fc3d10f50c71a3881a72d4816060c7325d7059477f4d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for deltachat-1.85.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ae02641692cc6148d875cee0b94826ad24e5ba576507cb87536f43cbc0d49d74
MD5 411228cf408d156ca3943a56111ef25c
BLAKE2b-256 10f4185570fc3fd15b3368d022df363f3da8af496f8f4458ff6d5546f4b48c05

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for deltachat-1.85.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d539b34c1f400b20318c9cf3f8f964b8547322f0a1d6788c7056e6e26165d37c
MD5 4cbeefe8015f7f66ac331df1394b0a09
BLAKE2b-256 54106e82d2103b54612a09944e6f6e2499289239c7d035af755a67745e4dddd7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for deltachat-1.85.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8f59a5694d3aa55cb424a8212a078e806b8ebca61666b54c0326b7379990872d
MD5 6733dcb34d8200415915b42a177abfe0
BLAKE2b-256 5e39970415be6725254506d8e6d3a027f2e36b774bfe1283769f74883853984f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for deltachat-1.85.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 42d25fadd9066492b8af3a4697bb78a4d475b8ad4c5526fec0b5c29a501a6548
MD5 4a721e6a555ca01a4133d3d3a7e200c6
BLAKE2b-256 023848e9afd9e6cb2de797fd1ebc9e9a655bb1768d9d5671d5bcd24da45b0545

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for deltachat-1.85.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 da6d413c95892f04ded094381b4f87524139bd495141fc556961161439ce5846
MD5 29ae22bcbdc9e197dafd493fb1a77178
BLAKE2b-256 7ab827230a9b8e0c887a9a94b85e359b1f57d820eff72c9e477f65a9a7041467

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for deltachat-1.85.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 09efa91160b1100838554cc01a81b4b82440b1897398a934e9c5888a094d714e
MD5 fba8b19670ac845680b3cf0e998a358c
BLAKE2b-256 c5acd4b148fdda56f3a353c9db4b4506183b1c9edfa7680ddb4905238b8da90a

See more details on using hashes here.

Supported by

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