Snapshot của XX-net/kivy-ios: 2★ · Python. Toolchain for compiling Python / Kivy / other libraries for iOS
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
Kivy for iOS (kivy-ios) is a toolchain to compile the necessary libraries for
iOS to run Kivy applications,
and manage the creation of Xcode projects.
The toolchain supports:
iPhone / iOS (arm64)
iPhone Simulator (x86_64, arm64)
We do not provide any binary distributions of this toolchain.
You do need to compile it at least once before creating your Xcode project.
Because Xcode only runs on macOS, Kivy for iOS is only useful on this
platform.
Kivy for iOS is managed by the Kivy Team and can be
used with Buildozer.
Installation & requirements
Before we start, we strongly advise using a Python virtual environment to install Python packages.
python3 -m venv venv
. venv/bin/activate
Install Kivy for iOS from PyPI with pip like any Python package.
pip3 install kivy-ios
Additionally, you would need a few system dependencies and configuration.
Xcode 13 or above, with an iOS SDK and command line tools installed:
xcode-select --install
Using brew, you can install the following dependencies:
brew install autoconf automake libtool pkg-config
brew link libtool
Using the toolchain
Any Python extensions or C/C++ library must be compiled: you need to have what
we call a recipe to compile it. For example, Python, libffi, SDL2, SDL_image,
freetype... all the dependencies, compilation, and packaging instructions are
contained in a recipe.
You can list the available recipes and their versions with:
Note: These recipes are not ported to the new toolchain yet:
lxml
Then, start the compilation with:
$ toolchain build python3 kivy
You can build recipes at the same time by adding them as parameters:
$ toolchain build python3 openssl kivy
Recipe builds can be removed via the clean command e.g.:
$ toolchain clean openssl
You can install package that don't require compilation with pip::
$ toolchain pip install plyer
The Kivy recipe depends on several others, like the sdl* and python recipes.
These may, in turn, depend on others e.g. sdl2_ttf depends on freetype, etc.
You can think of it as follows: the kivy recipe will compile everything
necessary for a minimal working version of Kivy.
Don't just grab a coffee; do dinner. Compiling all the libraries for the first
time, twice over (Remember: two platforms - iOS, iPhoneSimulator) will take time.
For a complete list of available commands, type:
$ toolchain
Create the Xcode project
The toolchain.py can create the initial Xcode project for you::
Your app directory must contain a main.py. A directory named <title>-ios
will be created, with an Xcode project in it.
You can open the Xcode project using::
$ open touchtracer-ios/touchtracer.xcodeproj
Then click on Play, and enjoy.
Did you know?
Every time you press Play, your application directory will be synced to
the <title>-ios/YourApp directory. Don't make changes in the -ios
directory directly.
Configuring your App
You can configure and customize your app in various ways:
Set the icon and launch images in XCode. Note that XCode requires that you
specify these assets per device or/and iOS version.
When you first build your XCode project, a 'main.m' file is created in your
XCode project folder. This file configures your environment variables and
controls your application startup. You can edit this file to customize your
launch environment.
Kivy uses SDL, and as soon as the application starts the SDL main, the launch
image will disappear. To prevent that, you need to have 2 files named
Default.png and Default-Landscape.png and put them
in the Resources folder in Xcode (not in your application folder)
Did you know?
If you wish to restrict your app's orientation, you should do this via
the 'export_orientation' function in 'main.m'. The XCode orientation
settings should be set to support all.
Using recipes
Recipes are used to install and compile any libraries you may need to use. These
recipes follow the same format as those used by the
Python-for-Android sister project.
Please refer to the
recipe documentation
there for more detail.
Reducing the application size
If you would like to reduce the size of your distributed app, there are a few
things you can do to achieve this:
Minimize the build/pythonX/lib/pythonXX.zip: this contains all the python
modules. You can edit the zip file and remove all the files you'll not use
(reduce encodings, remove xml, email...)
Go to the settings panel > build, search for "strip" options, and
triple-check that they are all set to NO. Stripping does not work with
Python dynamic modules and will remove needed symbols.
By default, the iOS package compiles binaries for all processor
architectures, namely x86_64 and arm64 as per the guidelines from
Apple. You can reduce the size of your ipa significantly by removing the
x86_64 architecture as they are used only for the emulator.
The procedure is to first compile/build all the host recipes as is:
toolchain build hostpython3
Then build all the rest of the recipes using --arch=arm64
arguments as follows:
toolchain build python3 kivy --arch=arm64
Note that these packages will not run in the iOS emulators, so use them
only for deployment.
Usage
toolchain <command> [<args>]
Available commands:
build Build a recipe (compile a library for the required target
architecture)
clean Clean the build of the specified recipe
distclean Clean the build and the result
recipes List all the available recipes
status List all the recipes and their build status
Xcode:
create Create a new xcode project
update Update an existing xcode project (frameworks, libraries..)
launchimage Create Launch images for your xcode project
icon Create Icons for your xcode project
pip Install a pip dependency into the distribution
pip3 Install a pip dependency into the python 3 distribution
Development
Alternatively, it's also possible to clone the repository and use all the
described commands in the above sections.
Clone and install it to your local virtual environment:
For troubleshooting advice and other frequently asked questions, consult
the latest
Kivy for iOS FAQ.
License
Kivy for iOS is MIT licensed, actively developed by a great
community and is supported by many projects managed by the
Kivy Organization.
Support
Are you having trouble using kivy-ios or any of its related projects in the Kivy
ecosystem?
Is there an error you don’t understand? Are you trying to figure out how to use
it? We have volunteers who can help!
The best channels to contact us for support are listed in the latest
Contact Us document.
Contributing
kivy-ios is part of the Kivy ecosystem - a large group of
products used by many thousands of developers for free, but it
is built entirely by the contributions of volunteers. We welcome (and rely on)
users who want to give back to the community by contributing to the project.
Contributions can come in many forms. See the latest
Contribution Guidelines
for how you can help us.
Code of Conduct
In the interest of fostering an open and welcoming community, we as
contributors and maintainers need to ensure participation in our project and
our sister projects is a harassment-free and positive experience for everyone.
It is vital that all interaction is conducted in a manner conveying respect,
open-mindedness and gratitude.
Please consult the latest Kivy Code of Conduct.
Contributors
This project exists thanks to
all the people who contribute.
[Become a contributor].
Backers
Thank you to all of our backers!
🙏 [Become a backer]
Sponsors
Special thanks to
all of our sponsors, past and present.
Support this project by
[becoming a sponsor].
Here are our top current sponsors. Please click through to see their websites,
and support them as they support us.
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/XX-net/kivy-ios là nguồn chính thức.
XX-net/kivy-ios có bao nhiêu sao?
XX-net/kivy-ios có 2 sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/XX-net/kivy-ios. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
XX-net/kivy-ios có phải mã nguồn mở không?
Có — XX-net/kivy-ios phát hành theo license MIT, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/XX-net/kivy-ios.
XX-net/kivy-ios còn đang phát triển không?
Commit gần nhất trên XX-net/kivy-ios là 11 tháng trước (theo timestamp GitHub). Repo có 0 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
XX-net/kivy-ios là gì?
XX-net/kivy-ios (XX-net/kivy-ios) là dự án Python trên GitHub. Theo mô tả gốc: Toolchain for compiling Python / Kivy / other libraries for iOS
Đọc đầy đủ README ở tab phía trên.
Vẫn đang phân vân về kivy-ios?
Một cú bấm sẽ gửi câu hỏi kèm trang này cho AI — xem AI nói gì về kivy-ios.