kivypyinstallerprojectdirectory-structurepython-for-android

How do I best layout a kivy project so it can be built for multiple platforms?


I'm trying to figure out a project layout for a kivy app that will allow it to be built as:

  1. a python module (so it can be distributed via pypi and thus 'pipx install')
  2. an android app
  3. a windows app (via PyInstaller)
  4. an iOS app

I'm familiar with the requirements for 1, and I'm a fan of simple, so I use the so-called 'flat' or 'ad-hoc' layout. My files look like:

.
├── pyproject.toml
├── buildozer.spec
└── my_app
    ├── __init__.py
    ├── __main__.py
    ├── main.py
    └── source

But my unusual main.py placement makes the android build fail.... and I haven't even gotten to PyInstaller or iOS yet. Is there a layout that will work for all of them?


Solution

  • My eventual answer was:

    1. make a build.kivy directory
    2. make a Makefile that will copy the main.py and the module source into the 'right' relative places in that directory
    3. make a Makefile target that will call the buildozer build apk step and make it depend on step 2.