Skip to content

Commit bb63f76

Browse files
authored
Update Contributing Guidelines and Readme (#2922)
* Update Contributing Guidelines and Readme ### Contributing Guidelines * Refer to Kivy for the heavy-lifting, and discuss the *differences* with Kivy. * Made wording more consistent with other sources. * Removed empty promise of a release every 4 weeks. That isn't a sustainable rate. * Very mild copy-edit. ### ReadMe * Refer to Kivy for details of support, rather than repeating. * Refer to p4a Contributing Guidelines, rather than repeating * Refer to Quickstart rather than repeating * Increased space for all the current sponsors and provisioned a far way into the future. * Could have used an SVG here, but the comment promised we would include a link :-( * Update for review comments Use nicer alternatives for URLs. Move History section from README to Contributing Guidelines. * Make doc structure consistent and up-to-date This is part of an effort to make the Kivy sibling projects' documentation structure consistent and up-to-date. CHECKLIST * CONTRIBUTING.md [x] If repo takes user contributions, is present [x] In root dir (not .github dir) [x] Explains relationship to Kivy, if unclear. [x] Refers to kivy/kivy Contribution Guidelines. MORE TO GO HERE * LICENSE [x] If repo takes user contributions, is present. [x] Acknowledges the range of years to 2023. [x] Acknowledges Kivy Team and other contributors [x] Mentions it is an MIT License. * CODE_OF_CONDUCT.md [x] If repo takes user contributions or hosts discussions, is present. [x] Refers to kivy/kivy CODE_OF_CONDUCT.md * CONTACT.md [x] Refers to kivy/kivy CONTACT.md * FAQ.md [x] If repo is big enough for RST documentation, is present. * README: [x] Is a Markdown file. [x] Describes the project. [x] Describes its place in the Kivy sibling projects. [x] If Documentation exists, mention it. [x] If CONTRIBUTING exists, mentions it. [x] If LICENSE exists, mentions it. [x] If CODE_OF_CONDUCT exists, mentions it. [x] Mentions kivy/kivy CONTACT.md [NA] Uses Python syntax colouring for embedded Python code. [x] Uses badges to display current status, including: [x] Backers [x] Sponsors [x] GitHub contributors [x] Contributor Covenant [x] PyPI Version [x] PyPI Python Version [x] Build/Test status [x] Displays all contributors to the repo. [x] Displays backers [x] Displays top sponsors. * RST documentation, if present [x] Describes the project. [x] Describes its place in the Kivy sibling projects. [x] Mentions (Kivy/Kivy) Contact Us link. [x] Mentions LICENSE. [x] Mentions CONTRIBUTING [x] Mentions FAQ [x] conf.py mentioned Kivy Team and other contributors - copyright, latex_documents, man_pages, texinfo documents * WORKFLOWS [x] NO_RESPONSE.yml is present if the repo has awaiting_reply tag. [x] NO_RESPONSE uses latest script versions. [x] NO_RESPONSE runs every day, and skips if forked. [x] SUPPORT.yml is present if the repo has a `support` tag. [x] SUPPORT.yml refers to repo's CONTACT.md * setup.py/cfg, if present and on PyPI [x] Supplies description to PyPI [x] Supplies Python versions to PyPI [x] Supplies Documentation, if any, to PyPI * PEP8 fixes * Rewrote description of binary formats Also cleared merge artifact. This was a response to review comments.
1 parent 0df46c8 commit bb63f76

15 files changed

+556
-462
lines changed

.github/workflows/no-response.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: No Response
2+
3+
# Both `issue_comment` and `scheduled` event types are required for this Action
4+
# to work properly.
5+
on:
6+
issue_comment:
7+
types: [created]
8+
schedule:
9+
# Schedule for an arbitrary time (5am) once every day
10+
- cron: '* 5 * * *'
11+
12+
jobs:
13+
noResponse:
14+
# Don't run if in a fork
15+
if: github.repository_owner == 'kivy'
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: lee-dohm/no-response@9bb0a4b5e6a45046f00353d5de7d90fb8bd773bb
19+
# This commit hash targets release v0.5.0 of lee-dohm/no-response.
20+
# Targeting a commit hash instead of a tag has been done for security reasons.
21+
# Please be aware that the commit hash specifically targets the "Automatic compilation"
22+
# done by `github-actions[bot]` as the `no-response` Action needs to be compiled.
23+
with:
24+
token: ${{ github.token }}
25+
daysUntilClose: 42
26+
responseRequiredLabel: 'awaiting-reply'
27+
closeComment: >
28+
This issue has been automatically closed because there has been no response
29+
to our request for more information from the original author. With only the
30+
information that is currently in the issue, we don't have the means
31+
to take action. Please reach out if you have or find the answers we need so
32+
that we can investigate further.

.github/workflows/support.yml

+23-10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# When a user creates an issue that is actually a support request, it should
2+
# be closed with a friendly comment.
3+
#
4+
# This triggers on an issue being labelled with the `support` tag.
5+
16
name: 'Support Requests'
27

38
on:
@@ -11,22 +16,30 @@ jobs:
1116
action:
1217
runs-on: ubuntu-latest
1318
steps:
14-
- uses: dessant/support-requests@v2
19+
- uses: dessant/support-requests@v4
1520
with:
1621
github-token: ${{ github.token }}
1722
support-label: 'support'
1823
issue-comment: >
19-
👋 We use the issue tracker exclusively for bug reports and feature requests.
20-
However, this issue appears to be a support request. Please use our
21-
[support channels](https://github.com/kivy/python-for-android/blob/master/README.md#support)
22-
to get help with the project.
23-
24-
25-
If you're having trouble installing or using python-for-android,
26-
maybe you could be interested in our [quickstart](https://python-for-android.readthedocs.io/en/latest/quickstart) guide.
24+
👋 @{issue-author},
2725
26+
Sorry to hear you are having difficulties with Kivy's python-for-android; Kivy unites a number of different technologies, so building apps can be temperamental.
27+
28+
We try to use GitHub issues only to track work for developers to do to fix bugs and add new features to python-for-android.
2829
30+
However, this issue appears to be a support request. Please use our
31+
[support channels](https://github.com/kivy/python-for-android/blob/master/CONTACT.md)
32+
to get help with the project.
33+
34+
If you're having trouble installing python-for-android,
35+
please see our [quickstart](https://python-for-android.readthedocs.io/en/latest/quickstart) guide.
36+
37+
If you're having trouble using python-for-android,
38+
please see our [troubleshooting guide](https://python-for-android.readthedocs.io/en/latest/troubleshooting)
39+
and [FAQ](https://github.com/kivy/python-for-android/blob/master/FAQ.md).
40+
2941
Let us know if this comment was made in error, and we'll be happy
3042
to reopen the issue.
43+
3144
close-issue: true
32-
lock-issue: false
45+
lock-issue: false

CODE_OF_CONDUCT.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
In the interest of fostering an open and welcoming community, we as
2+
contributors and maintainers need to ensure participation in our project and
3+
our sister projects is a harassment-free and positive experience for everyone.
4+
It is vital that all interaction is conducted in a manner conveying respect,
5+
open-mindedness and gratitude.
6+
7+
Please consult the [latest Kivy Code of Conduct](https://github.com/kivy/kivy/blob/master/CODE_OF_CONDUCT.md).
8+

CONTACT.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Contacting the Kivy Team
2+
3+
If you are looking to contact the Kivy Team (who are responsible for managing
4+
the python-for-android project), including looking for support, please see our
5+
latest [Contact Us](https://github.com/kivy/kivy/blob/master/CONTACT.md)
6+
document.

CONTRIBUTING.md

+250
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,250 @@
1+
# Contribution Guidelines
2+
3+
python-for-android is part of the [Kivy](https://kivy.org) ecosystem - a large group of
4+
products used by many thousands of developers for free, but it
5+
is built entirely by the contributions of volunteers. We welcome (and rely on)
6+
users who want to give back to the community by contributing to the project.
7+
8+
Contributions can come in many forms. See the latest
9+
[Contribution Guidelines](https://github.com/kivy/kivy/blob/master/CONTRIBUTING.md)
10+
for how you can help us.
11+
12+
.. warning::
13+
The python-for-android process differs in small but important ways from the
14+
Kivy framework's process. See below.
15+
16+
## Development model
17+
18+
Unlike the Kivy framework, python-for-android is developed using the following
19+
model:
20+
21+
- The `master` branch always represents the latest stable release.
22+
- The `develop` branch is the most up to date with new contributions.
23+
- Releases happen periodically, and consist of merging the current `develop`
24+
branch into `master`.
25+
26+
This means pull requests for python-for-android code and documentation
27+
submissions should be made to the `develop` branch, not the `master` branch.
28+
29+
For reference, this is based on a
30+
[Git flow](https://nvie.com/posts/a-successful-git-branching-model/) model,
31+
although we don't follow this religiously.
32+
33+
## Versioning
34+
35+
python-for-android releases currently use
36+
[calendar versioning](https://calver.org/). Release numbers are of the form
37+
YYYY.MM.DD.
38+
39+
We use calendar versioning because in practice, changes in
40+
python-for-android are often driven by updates or adjustments in the
41+
Android build tools. It's usually best for users to be working from
42+
the latest release. We try to maintain backwards compatibility even
43+
while internals are changing.
44+
45+
## History
46+
47+
In 2015, these tools were rewritten to provide a new, easier-to-use and
48+
easier-to-extend interface. If you'd like to browse the old toolchain,
49+
its status is
50+
[recorded for posterity](https://github.com/kivy/python-for-android/tree/old_toolchain).
51+
52+
In the last quarter of 2018, the Python recipes were changed. The
53+
new recipe for Python3 (3.7.1) had a new build system which was
54+
applied to the ancient Python recipe, allowing us to bump the Python2
55+
version number to 2.7.15. This change unified the build process for
56+
both Python recipes, and probably solved various issues detected over the
57+
years. These **unified Python recipes** require a **minimum target api level of 21**,
58+
*Android 5.0 - Lollipop*. If you need to build targeting an
59+
api level below 21, you should use an older version of python-for-android
60+
(<=0.7.1).
61+
62+
On March 2020, we dropped support for creating apps that use Python 2. The
63+
latest python-for-android release that supported building Python 2 was version
64+
2019.10.6.
65+
66+
On August 2021, we added support for Android App Bundle (aab). As a
67+
collateral benefit, we now support multi-arch apk.
68+
69+
## Creating a new release
70+
71+
(These instructions are for core developers, not casual contributors.)
72+
73+
New releases follow these steps:
74+
75+
- Create a new branch `release-YYYY.MM.DD` based on the `develop` branch.
76+
- `git checkout -b release-YYYY.MM.DD develop`
77+
- Create a Github pull request to merge `release-YYYY.MM.DD` into `master`.
78+
- Complete all steps in the [release checklist](#Release_checklist),
79+
and document this in the pull request (copy the checklist into the PR text)
80+
81+
At this point, wait for reviewer approval and conclude any discussion that
82+
arises. To complete the release:
83+
84+
- Merge the release branch to the `master` branch.
85+
- Also merge the release branch to the `develop` branch.
86+
- Tag the release commit in `master`, with tag `vYYYY.MM.DD`. Include a short
87+
summary of the changes.
88+
- Release distributions and PyPI upload should be
89+
[handled by the CI](https://github.com/kivy/python-for-android/blob/v2020.04.29/.travis.yml#L60-L70).
90+
- Add to the GitHub release page (see e.g. [this example](https://github.com/kivy/python-for-android/releases/tag/v2019.06.06):
91+
- The python-for-android README summary
92+
- A short list of major changes in this release, if any
93+
- A changelog summarising merge commits since the last release
94+
- The release sdist and wheel(s)
95+
96+
## Release checklist
97+
98+
- [ ] Check that the builds are passing
99+
- [ ] [GitHub Action](https://github.com/kivy/python-for-android/actions)
100+
- [ ] Run the tests locally via `tox`: this performs some long-running tests that are skipped on github-actions.
101+
- [ ] Build and run the [on_device_unit_tests](https://github.com/kivy/python-for-android/tree/master/testapps/on_device_unit_tests) app using buildozer. Check that they all pass.
102+
- [ ] Build (or download from github actions) and run the following [testapps](https://github.com/kivy/python-for-android/tree/master/testapps/on_device_unit_tests) for arch `armeabi-v7a` and `arm64-v8a`:
103+
- [ ] on_device_unit_tests
104+
- [ ] `armeabi-v7a` (`cd testapps/on_device_unit_tests && PYTHONPATH=.:../../ python3 setup.py apk --ndk-dir=<your-ndk-dir> --sdk-dir=<your-sdk-dir> --arch=armeabi-v7a --debug`)
105+
- [ ] `arm64-v8a` (`cd testapps/on_device_unit_tests && PYTHONPATH=.:../../ python3 setup.py apk --ndk-dir=<your-ndk-dir> --sdk-dir=<your-sdk-dir> --arch=arm64-v8a --debug`)
106+
- [ ] Check that the version number is correct
107+
108+
## How python-for-android uses `pip`
109+
110+
*Last update: July 2019*
111+
112+
This section is meant to provide a quick summary how
113+
python-for-android uses pip and Python packages in
114+
its build process.
115+
**It is written for a Python
116+
packager's point of view, not for regular end users or
117+
contributors,** to assist with making pip developers and
118+
other packaging experts aware of p4a's packaging needs.
119+
120+
Please note this section just attempts to neutrally list the
121+
current mechanisms, so some of this isn't necessarily meant
122+
to stay but just how things work inside p4a in
123+
this very moment.
124+
125+
126+
### Basic concepts
127+
128+
*(This part repeats other parts of the docs, for the sake of
129+
making this a more independent read)*
130+
131+
p4a builds & packages a Python application for use on Android.
132+
It does this by providing a Java wrapper, and for graphical applications
133+
an SDL2-based wrapper which can be used with the Kivy framework if
134+
desired (or alternatively just plain PySDL2). Any such the Python application
135+
will likely have further library dependencies to do its work.
136+
137+
p4a supports two types of package dependencies for a project:
138+
139+
**Recipe:** Install a script in custom p4a format. Can either install
140+
C/C++ or other software that cannot be pulled in via pip, or software
141+
that can be installed via pip but break on Android by default.
142+
These are maintained primarily inside the p4a source tree by p4a
143+
contributors and interested folks.
144+
145+
**Python package:** any random pip python package can be directly
146+
installed if it doesn't need adjustments to work for Android.
147+
148+
p4a will map any dependency to an internal recipe if present, and
149+
otherwise use pip to obtain it regularly from whatever external source.
150+
151+
152+
### Install process regarding packages
153+
154+
The install/build process of a p4a project, as triggered by the
155+
`p4a apk` command, roughly works as follows in regards to Python
156+
packages:
157+
158+
1. The user has specified a project folder to install. This is either
159+
just a folder with Python scripts and a `main.py`, or it may
160+
also have a `pyproject.toml` for a more standardized install.
161+
162+
2. Dependencies are collected: they can be either specified via
163+
``--requirements`` as a list of names or pip-style URLs, or p4a
164+
can optionally scan them from a project folder via the
165+
pep517 library (if there is a `pyproject.toml` or `setup.py`).
166+
167+
3. The collected dependencies are mapped to p4a's recipes if any are
168+
available for them, otherwise they're kept around as external
169+
regular package references.
170+
171+
4. All the dependencies mapped to recipes are built via p4a's internal
172+
mechanisms to build these recipes. (This may or may not indirectly
173+
use pip, depending on whether the recipe wraps a python package
174+
or not and uses pip to install or not.)
175+
176+
5. **If the user has specified to install the project in standardized
177+
ways,** then the `setup.py`/whatever build system
178+
of the project will be run. This happens with cross compilation set up
179+
(`CC`/`CFLAGS`/... set to use the
180+
proper toolchain) and a custom site-packages location.
181+
The actual comand is a simple `pip install .` in the project folder
182+
with some extra options: e.g. all dependencies that were already
183+
installed by recipes will be pinned with a `-c` constraints file
184+
to make sure pip won't install them, and build isolation will be
185+
disabled via ``--no-build-isolation`` so pip doesn't reinstall
186+
recipe-packages on its own.
187+
188+
**If the user has not specified to use standardized build approaches**,
189+
p4a will simply install all the remaining dependencies that weren't
190+
mapped to recipes directly and just plain copy in the user project
191+
without installing. Any `setup.py` or `pyproject.toml` of the user
192+
project will then be ignored in this step.
193+
194+
6. Google's gradle is invoked to package it all up into an `.apk`.
195+
196+
197+
### Overall process / package relevant notes for p4a
198+
199+
Here are some common things worth knowing about python-for-android's
200+
dealing with python packages:
201+
202+
- Packages will work fine without a recipe if:
203+
204+
* they would also build on Linux ARM,
205+
* don't use any API not available in the NDK if they use native code, and
206+
* don't use any weird compiler flags the toolchain doesn't like if they use native code.
207+
* works with cross compilation.
208+
209+
- There is currently no easy way for a package to know it is being
210+
cross-compiled (at least that we know of) other than examining the
211+
`CC` compiler that was set, or that it is being cross-compiled for
212+
Android specifically. If that breaks a package, it currently needs
213+
to be worked around with a recipe.
214+
215+
- If a package does **not** work, p4a developers will often create a
216+
recipe instead of getting upstream to fix it because p4a simply
217+
is too niche.
218+
219+
- Most packages without native code will just work out of the box.
220+
Many with native code tend not to, especially if complex, e.g. numpy.
221+
222+
- Anything mapped to a p4a recipe cannot be just reinstalled by pip,
223+
specifically also not inside build isolation as a dependency.
224+
(It *may* work if the patches of the recipe are just relevant
225+
to fix runtime issues.)
226+
Therefore as of now, the best way to deal with this limitation seems
227+
to be to keep build isolation always off.
228+
229+
230+
### Ideas for the future regarding packaging
231+
232+
- We in overall prefer to use the recipe mechanism less if we can.
233+
Overall, the recipes are just a collection of workarounds.
234+
It may look quite hacky from the outside, since p4a
235+
version pins recipe-wrapped packages usually to make the patches reliably
236+
apply. This creates work for the recipes to be kept up-to-date, and
237+
obviously this approach doesn't scale too well. However, it has ended
238+
up as a quite practical interim solution until better ways are found.
239+
240+
- Obviously, it would be nice if packages could know they are being
241+
cross-compiled, and for Android specifically. We aren't currently aware
242+
of any good mechanism for that.
243+
244+
- If pip could actually run the recipes (instead of p4a wrapping pip and
245+
doing so) then this might even allow build isolation to work - but
246+
this might be too complex to get working. It might be more practical
247+
to just gradually reduce the reliance on recipes instead and make
248+
more packages work out of the box. This has been done e.g. with
249+
improvements to the cross-compile environment being set up automatically,
250+
and we're open for any ideas on how to improve this.

0 commit comments

Comments
 (0)