README.md

conda-mobile

A collection of conda recipes for cross compiling libraries, python, and
python extensions for iOS and Android.

The idea is to be able to easily create a python distribution that works on
Android and iOS by simply using conda install android-<package> or
conda install ios-<package> within an environment created for a specific app.

These recipes have been tested and confirmed working using a dev version of
enaml-native (yet to be released).

Targets

Currently all recipes are built for Python 2.7.15 and 3.6.5 with optional support for openssl and
ctypes for the following targets:

Android (arm (armeabi-v7a), arm64 (arm64-v8a), x86_64, x86 (i686))

iPhone (armv7, aarch64)

iPhone Simulator (x86_64, i386)

Note: All libs and extensions are built as unstripped shared modules. Android strips
libraries automatically.

Packages are installed into the env using a prefix for the target platform as follows

Then install your apps dependencies using the the android or ios prefix.
For example conda install ios-python ios-msgpack

Pure python packages can be installed with pip using the --target to tell it
where to install. pip install tornado --target=$CONDA_PREFIX/iphoneos/python/site-packages
or (preferred) create a conda package for it using enaml-native make-pip-recipe <package>.

Once the packages are installed, the build system (gradle, xcode) can then easily grab
these libraries from the env for the given target and use them as is.

Building recipes

There are three general recipe types that are generally relevant for conda-mobile:

Pure python packages, no extensions

Python package with, with extensions

Non python dependent libs

Pure python packages are prefixed with pip-<package> to distinguish them between regular
conda packages that may exist with the same name. You can create these package (almost)
automatically using the enaml-native-cli's
enaml-native make-pip-recipe <package> command.

Libraries with compiled extensions / cython components are split into separate packages with
the prefix ios-<package> and android-package. Otherwise all packages would need to be
built from mac osx.

If building an extension or c/c++ library install build-essential, autopoint, and texinfo with apt

Run conda-build <recipe-name> (python extensions must be built separately for
2.7 and 3.6 by specifying it as an argument ex conda-build --py 3.6 <recipe-name>)

Then either add a PR or create your own repos with recipes.

Note: If using linux with an encrypted home directory you may have to build in a different
root to avoid "path to long" errors. Add the --croot=/tmp/conda or some other path to
fix this.

Recipe requirements

Now that both python 2.7 and 3.6 are supported all recipes that build python extensions MUST
include py27 or py36 in the build string so conda knows which version to install.
conda will do this automatically if you simply include python in the run
requirements of your recipe (even though the ios / android version is actually used on the
app). Alternatively you can manually set string: py{{CONDA_PY}} under the build section.

In addition to specifying a build string, any requirements that have python extensions must
filter by the build string since conda does not do this automatically at the moment.

Note: This only applies to python extensions. Pure c/c++ libraries do not need to do this!