<commit_before>
Getting Started
===============

Getting up and running on python-for-android (p4a) is a simple process
and should only take you a couple of minutes. We'll refer to Python
for android as p4a in this documentation.

Concepts
--------

- requirements: For p4a, your applications dependencies are
  requirements similar to the standard `requirements.txt`, but with
  one difference: p4a will search for a recipe first instead of
  installing requirements with pip.

- recipe: A recipe is a file that defines how to compile a
  requirement. Any libraries that have a Python extension *must* have
  a recipe in p4a, or compilation will fail. If there is no recipe for
  a requirement, it will be downloaded using pip.

- build: A build refers to a compiled recipe.

- distribution: A distribution is the final "build" of all your
  compiled requirements, as an Android project that can be turned
  directly into an APK. p4a can contain multiple distributions with
  different sets of requirements.

- bootstrap: A bootstrap is the app backend that will start your
  application. Your application could use SDL2 as a base, or Pygame,
  or a web backend like Flask with a WebView bootstrap. Different
  bootstraps can have different build options.


Installation
------------

Installing p4a
~~~~~~~~~~~~~~

p4a is now available on on Pypi, so you can install it using pip::

    pip install python-for-android

You can also test the master branch from Github using::

    pip install git+https://github.com/kivy/python-for-android.git

Installing Dependencies
~~~~~~~~~~~~~~~~~~~~~~~

p4a has several dependencies that must be installed:

- git
- ant
- python2
- cython (can be installed via pip)
- a Java JDK (e.g. openjdk-7)
- zlib (including 32 bit)
- libncurses (including 32 bit)
- unzip
- virtualenv (can be installed via pip)
- ccache (optional)

On recent versions of Ubuntu and its derivatives you may be able to
install most of these with::

    sudo dpkg --add-architecture i386
    sudo apt-get update
    sudo apt-get install -y build-essential ccache git zlib1g-dev python2.7 python2.7-dev libncurses5:i386 libstdc++6:i386 zlib1g:i386 openjdk-7-jdk unzip ant ccache

On Arch Linux (64 bit) you should be able to run the following to
install most of the dependencies (note: this list may not be
complete). gcc-multilib will conflict with (and replace) gcc if not
already installed. If your installation is already 32-bit, install the
same packages but without ``lib32-`` or ``-multilib``::

    sudo pacman -S jdk7-openjdk python2 python2-pip python2-kivy mesa-libgl lib32-mesa-libgl lib32-sdl2 lib32-sdl2_image lib32-sdl2_mixer sdl2_ttf unzip gcc-multilib gcc-libs-multilib

Installing Android SDK
~~~~~~~~~~~~~~~~~~~~~~

You need to download and unpack the Android SDK and NDK to a directory (let's say $HOME/Documents/):

- `Android SDK <https://developer.android.com/sdk/index.html#Other>`_
- `Android NDK <https://developer.android.com/ndk/downloads/index.html>`_

Then, you can edit your ``~/.bashrc`` or other favorite shell to include new environment variables necessary for building on android::
<commit_msg>Remove the excessive ccache in the command<commit_after>
Getting Started
===============

Getting up and running on python-for-android (p4a) is a simple process
and should only take you a couple of minutes. We'll refer to Python
for android as p4a in this documentation.

Concepts
--------

- requirements: For p4a, your applications dependencies are
  requirements similar to the standard `requirements.txt`, but with
  one difference: p4a will search for a recipe first instead of
  installing requirements with pip.

- recipe: A recipe is a file that defines how to compile a
  requirement. Any libraries that have a Python extension *must* have
  a recipe in p4a, or compilation will fail. If there is no recipe for
  a requirement, it will be downloaded using pip.

- build: A build refers to a compiled recipe.

- distribution: A distribution is the final "build" of all your
  compiled requirements, as an Android project that can be turned
  directly into an APK. p4a can contain multiple distributions with
  different sets of requirements.

- bootstrap: A bootstrap is the app backend that will start your
  application. Your application could use SDL2 as a base, or Pygame,
  or a web backend like Flask with a WebView bootstrap. Different
  bootstraps can have different build options.


Installation
------------

Installing p4a
~~~~~~~~~~~~~~

p4a is now available on on Pypi, so you can install it using pip::

    pip install python-for-android

You can also test the master branch from Github using::

    pip install git+https://github.com/kivy/python-for-android.git

Installing Dependencies
~~~~~~~~~~~~~~~~~~~~~~~

p4a has several dependencies that must be installed:

- git
- ant
- python2
- cython (can be installed via pip)
- a Java JDK (e.g. openjdk-7)
- zlib (including 32 bit)
- libncurses (including 32 bit)
- unzip
- virtualenv (can be installed via pip)
- ccache (optional)

On recent versions of Ubuntu and its derivatives you may be able to
install most of these with::

    sudo dpkg --add-architecture i386
    sudo apt-get update
    sudo apt-get install -y build-essential git zlib1g-dev python2.7 python2.7-dev libncurses5:i386 libstdc++6:i386 zlib1g:i386 openjdk-7-jdk unzip ant ccache

On Arch Linux (64 bit) you should be able to run the following to
install most of the dependencies (note: this list may not be
complete). gcc-multilib will conflict with (and replace) gcc if not
already installed. If your installation is already 32-bit, install the
same packages but without ``lib32-`` or ``-multilib``::

    sudo pacman -S jdk7-openjdk python2 python2-pip python2-kivy mesa-libgl lib32-mesa-libgl lib32-sdl2 lib32-sdl2_image lib32-sdl2_mixer sdl2_ttf unzip gcc-multilib gcc-libs-multilib

Installing Android SDK
~~~~~~~~~~~~~~~~~~~~~~

You need to download and unpack the Android SDK and NDK to a directory (let's say $HOME/Documents/):

- `Android SDK <https://developer.android.com/sdk/index.html#Other>`_
- `Android NDK <https://developer.android.com/ndk/downloads/index.html>`_

Then, you can edit your ``~/.bashrc`` or other favorite shell to include new environment variables necessary for building on android::

{'fraction_non_alphanumeric': 0.0901301174230403, 'fraction_numerical': 0.018724214535068232, 'mean_word_length': 3.9629921259842518, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6479086', 'n_tokens_mistral': 1912, 'n_tokens_neox': 1773, 'n_words': 845}