This is the easiest setup (compared to mobile development). I am using
this to develop Kivy apps on FreeBSD.
You either need to have Kivy system packages installed or create a
dedicated Python Virtual Environment, activate it first, then run your
application. Python Virtual Environment allows you to install local
versions of packages when you have no root on the computer (i.e.
remote server) or if you do not want to use and/or modify system wide
packages. You can have multiple Python Virtual Environment each one
dedicated for a given project, each one with a different packages
different versions for testing etc. Quite convenient :-)
I have some scripts to setup and work with the pyvenv environment.
Maybe these could be added to the source tree and extended to ease
Kivy bootstrap :-)
1. Config file (located in scripts/ subdir of my project).
2. Python Requirements file (says what to install into venv).
3. Bootstrap script (setup the Python VEnv, located in scripts/ subdir
of my projects, uses scripts/config).
4. Python Virtual Environment activator script (if you want to play
inside pyvenv by hand).
5. Application launch (if you "just want the app to run"^TM).
1. scripts/config:
#!/bin/sh
PYTHON=python3.9
VENVLOC=$(dirname $(realpath $0))/../python
2. requirements.txt:
pip
virtualenv
cython
kivy[full]==2.1.0
buildozer==1.4.0
kivymd==1.0.2
gitpython
3. scripts/bootstrap.sh (note you will have to add Linux section
according to your distro):
#!/bin/sh
set -e
. $(dirname $(realpath $0))/config
OS=`uname`
echo "=== BOOTSTRAPPING THE KIVY DEVEL ENVIRONMENT ==="
echo "DETECTED OS: $OS"
case $OS in
"darwin" )
echo "== Installing BREW Open-Source Package Manager for macOS =="
if [ ! -e /usr/local/bin/brew ]; then
/bin/bash -c "$(curl -fsSL
https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
else
echo "BREW is already installed, skipping install!"
fi
echo "== Updating BREW =="
brew update
brew upgrade
echo "== Installing utilities with BREW =="
brew install git openssl pkg-config autoconf automake sdl2
sdl2_image sdl2_mixer sdl2_ttf
;;
"FreeBSD" )
echo "== Installing required system packages ==="
sudo pkg update
sudo pkg install git libressl pkgconf autoconf automake sdl2
sdl2_image sdl2_mixer sdl2_ttf
;;
*)
echo "ERROR: Unknown OS $OS! Please install system dependencies by hand!"
echo " Required: git openssl pkgconfig autoconf automake sdl2*"
exit 1
esac
echo "== Setting up local Python VirtualEnv =="
$PYTHON -m venv --copies $VENVLOC
echo "== Activating Python Virtualenv =="
. $VENVLOC/bin/activate
echo "DONE"
echo "== Installing Python Dependencies =="
pip install -U pip
pip install -r requirements.txt
echo "=== ALL IS SET ==="
echo
echo " REMEMBER TO ACTIVATE PYTHON VIRTUAL ENVIRONMENT"
echo " ONCE EACH TIME AT YOUR DEVELOPMENT SESSION START"
echo " ./scripts/venv.sh"
4. scripts/venv.sh:
#!/bin/sh
. $(dirname $(realpath $0))/config
. $VENVLOC/bin/activate
if [ "$SHELL" == *"zsh"* ]; then
$SHELL -f
else
bash
fi
5. apprun.sh:
#!/bin/sh
. python/bin/activate
python main.py
If is always good to read the project Documentation at first:
https://kivy.org/doc/stable/
There is a dedicated section "Getting Started":
https://kivy.org/doc/stable/gettingstarted/index.html
Where you will find a section "Installing Kivy":
https://kivy.org/doc/stable/gettingstarted/installation.html
Have fun! :-)
--
CeDeROM, SQ7MHZ,
http://www.tomek.cedro.info