A 💯% Python
application using the KivyMD
framework, integrating Artificial Intelligence features. The goal is to have a single Python
codebase that can be built and deployed on all major native platforms: Android
, iOS
, macOS
, Linux
and Windows
.
Some of the goals:
KivyMD
app skeleton pattern including classique UI elements (navbar menu, top navbar, responsive, material design...)Python
development environmentOpenAI
ChatGPT
APIStability AI
text to image
APIPlatform | About screen | Chat session | Settings |
---|---|---|---|
Android | |||
iOS | |||
Linux | |||
Windows | |||
macOS |
You may have some OS core dependencies to install (dll
on Windows, system lib on Ubuntu, etc.) so follow the official Kivy install instructions depending on your operating system(s):
Example: for Ubuntu you have to set the following environnement variable
export USE_X11=1
and install the listed OS libraries
Then you can install the Open Mindset app dependencies as follow. First create and activate your virtual environment:
python -m venv venv
. venv/bin/activate
Use pip-tools
to generate requirements.txt
file from requirements.in
:
python -m pip install pip-tools
pip-compile requirements.in
Update the virtual environment dependencies:
pip-sync
pip install pygame
pip install kivy==2.2.1
Normal startup
python main.py
With hot-reload enabled
DEBUG=1 python main.py
Know issue in DEBUG
mode:
Normal startup
MOBILE_SIMULATION=1 python main.py
Combined with hot-reload
DEBUG=1 MOBILE_SIMULATION=1 python main.py
python scripts/icons/main.py
This native Python app makes usage of SQLite3 as it's persistence mechanism (preferences, chat session...). Although you can visualize raw data using command lines like sqlite3 chat_sessions.db
we recommand using the DB Browser for SQLite which is a high quality, visual, open source tool to create, design, and edit database files compatible with SQLite.
Inside the .kivy
file just add this:
canvas.before:
Color:
rgba: 0, 1, 0, 1
Line:
width: 1
rectangle: self.x, self.y, self.width, self.height
Some usefull brew commands
brew update
brew config
brew leaves | xargs brew desc --eval-all
brew cleanup
brew install cython
echo 'export PATH="/opt/homebrew/opt/cython/bin:$PATH"' >> ~/.zshrc
Then change your .zshrc
aliases as explained here
python ./scripts/certificates/install_certifi.py
First install the following dependencies:
Then install these python dependencies:
pip-compile
pip-sync
If pip-sync
fails you may have to use the classic way once requirements.txt
is generated by pip-compile
:
pip install -r requirements.txt
Ensure both kivy
and kivymd
are up to date (see below reference for more detail)
pip install https://github.com/kivy/kivy/archive/master.zip
pip install https://github.com/kivymd/KivyMD/archive/master.zip
buildozer android clean
buildozer android debug deploy run
python ~/Library/Python/3.8/lib/python/site-packages/buildozer init
python ~/Library/Python/3.8/lib/python/site-packages/buildozer android debug deploy run
python ~/Library/Python/3.11/lib/python/site-packages/buildozer init
python ~/Library/Python/3.11/lib/python/site-packages/buildozer android debug deploy run
Ugly workaround for ssl issue: code /Library/Frameworks/Python.framework/Versions/Current/lib/python3.10/ssl.py
sdkmanager path does not exist, sdkmanager is not installed
See seperate iOS build instructions here.
Why is Kivy not popular?
Basically runs on donation from people like you and me and some organisations and this is unlike other frameworks that are (or were) backed by giants like Google (Flutter) or Facebook (React Native). So, Kivy might lack marketing funds, making it less popular among other frameworks but it's still a preferred choice in Python ecosystem.
By definition:
An open mindset is a tendency to be receptive to new ideas and information. Having an open mindset means being objective when approaching new things, listening to other points of view, and being willing to admit what you don't know.
I decided to give it that name since this is my life philosophy and I was looking for a real project to learn Python
language.