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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for deltachat-1.86.0-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf34ef5d45336dd843435ab15e771d3018024a579bc0df5278759a536bd971ba |
|
MD5 | 6ea9d2c46d0285baa8eb40fb0758a6b5 |
|
BLAKE2b-256 | 23e819af12da59ef00adee94a33a9fefad0be38a1f8da2987d388cd99aba03b9 |
Hashes for deltachat-1.86.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a9f220b6406b8c47568d571de33d4e183eedc6d6ab7dca0fe0a34dc85f1d3c98 |
|
MD5 | 11dd34e7dd41dbef48307ef99340aab6 |
|
BLAKE2b-256 | e19f6e03b831255947821cf9905306497856e63fb31f80345f0864a64c6b9a82 |
Hashes for deltachat-1.86.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0e5f5f7e29c582f0eda5d40a39643c9fc835c72b5e5d929bd2ee6bd7be26ede |
|
MD5 | 3eb01b5c6b64c58934a0a5a000371bc8 |
|
BLAKE2b-256 | 5f87182e013d8164d550d218b497420ffce30409254d4e36d02e987909f91a6a |
Hashes for deltachat-1.86.0-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 012ebe56851cc41387999cdabeb947620d66c95a74697aaeb4aad17409fb485d |
|
MD5 | d6d25c1e9e1cae703c3f842b860966b8 |
|
BLAKE2b-256 | fbd17a73647c393491aac3d71697e0d1d20ab843bbf03e283665f2ec9f96e037 |
Hashes for deltachat-1.86.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd2d6ff5e898d530bb228e63c41e8f4773c6d133b19720d871845b4c93505c3b |
|
MD5 | e7ceb9c59bf4205bed3726023145e2fd |
|
BLAKE2b-256 | da2e06061d9036d9d8d8ac5ac5f1643a8d3cc91d4dfd737c796b3813c9d2ba83 |
Hashes for deltachat-1.86.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93c105b448f8cb91f166ba2c0507e3180a59093507dc0322f94df481bc1bbfa6 |
|
MD5 | f254aa33efcbc391a702c37d1d67978a |
|
BLAKE2b-256 | c3badcdfd6fed1620bf344ec9028c14e51a242b6d673e4848d0e6407e38c178c |
Hashes for deltachat-1.86.0-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cee44e11fda3f5af6b26223c101d6cd40d863384da573a114f9a783cb8094d4e |
|
MD5 | 3358730a8218f1d0bfd04ca72a9a361f |
|
BLAKE2b-256 | 73411f69bcdf69c9786bd5e7f0a405e51fac83290ccdc8e9d8a8b6488f9a4a6b |
Hashes for deltachat-1.86.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0ff6076bd534629e5c45312e1d386bf878bfeb8e5e6aec010866d5c83f69490 |
|
MD5 | 394d9c372c295bba71da7d6a8ed01402 |
|
BLAKE2b-256 | 7682f65c4ccb866ea1fb7d623f5ff978614b4e1c2690f6d7f4d5966c777b8b97 |
Hashes for deltachat-1.86.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e45ebc1874e1c1047ae49168c35bb15cf876e02a79f55d761171013b036b4e3 |
|
MD5 | 77c65aded7fe2266c99383069d35b8a7 |
|
BLAKE2b-256 | 43531898b17e1e99999252b3f9982ec8fe8dbb5862184ea3e59fddfb16a184df |
Hashes for deltachat-1.86.0-cp37-cp37m-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1cf3666bfe1691a99dc316d22e9cc4772f3f89b496ff3a742fb7978fb76c251 |
|
MD5 | 02f97484515aab0efb9181cda8cbd164 |
|
BLAKE2b-256 | 06f851eb68c2616c848dc76a86ac917eb742f3365f341e499b0afb569b8c3b2b |
Hashes for deltachat-1.86.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c1ee6060fc97491885766083c8c28b2a8cbc0a3391a87bd32b07afe14a827b5 |
|
MD5 | 0b457671b41dbfea7bed58b22194ba25 |
|
BLAKE2b-256 | b5f0f53240f1a15e7000fd4a9b96091204e7bcc25a8d99ddd2085434b55efd32 |
Hashes for deltachat-1.86.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc7683bc117f710f69c5d30f88406b436c5e25d62739b13b6425d686410913f3 |
|
MD5 | f1ebbe29144e73d092eadd4c8edacf1e |
|
BLAKE2b-256 | 1194b6966615660d5cf6483fced5853d5d5daabf5ff240a6fe875beffaa4117a |