You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A [Cookiecutter](https://github.com/cookiecutter/cookiecutter/) template
4
-
for building Python apps that will run under iOS.
3
+
A [Cookiecutter](https://github.com/cookiecutter/cookiecutter/) template for building Python apps that will run under iOS.
5
4
6
5
## Using this template
7
6
8
-
The easiest way to use this project is to not use it at all - at least,
9
-
not directly. [Briefcase](https://github.com/beeware/briefcase/) is a
10
-
tool that uses this template, rolling it out using data extracted from a
11
-
`pyproject.toml` configuration file.
7
+
The easiest way to use this project is to not use it at all - at least, not directly. [Briefcase](https://github.com/beeware/briefcase/) is a tool that uses this template, rolling it out using data extracted from a `pyproject.toml` configuration file.
12
8
13
9
However, if you *do* want to use this template directly...
14
10
15
-
1. Install
16
-
[cookiecutter](https://github.com/cookiecutter/cookiecutter). This
17
-
is a tool used to bootstrap complex project templates:
11
+
1. Install [cookiecutter](https://github.com/cookiecutter/cookiecutter). This is a tool used to bootstrap complex project templates:
This will ask you for a number of details of your application,
26
-
including the <spanclass="title-ref">name</span> of your
27
-
application (which should be a valid PyPI identifier), and the
28
-
<spanclass="title-ref">Formal Name</span> of your application (the
29
-
full name you use to describe your app). The remainder of these
30
-
instructions will assume a <spanclass="title-ref">name</span> of
31
-
`my-project`, and a formal name of `My Project`.
32
-
33
-
3.[Obtain a Python Apple support package for
34
-
iOS](https://github.com/beeware/Python-Apple-support), and extract
35
-
it into the `My Project` directory generated by the template. This
36
-
will give you a `My Project/Support` directory containing a self
37
-
contained Python install.
38
-
39
-
4. Add your code to the template, into the `My Project/my-project/app`.
40
-
directory. At the very minimum, you need to have an
41
-
`app/<app name>/__main__.py` file that defines a `PythonAppDelegate`
42
-
class.
43
-
44
-
If your code has any dependencies, they should be installed into the
45
-
`My Project/my-project/app_packages` directory.
46
-
47
-
If you've done this correctly, a project with a formal name of
48
-
`My Project`, with an app name of `my-project` should have a directory
49
-
structure that looks something like:
50
-
51
-
My Project/
19
+
This will ask you for a number of details of your application, including the <spanclass="title-ref">name</span> of your application (which should be a valid PyPI identifier), and the <spanclass="title-ref">Formal Name</span> of your application (the full name you use to describe your app). The remainder of these instructions will assume a <spanclass="title-ref">name</span> of `my-project`, and a formal name of `My Project`.
20
+
21
+
3.[Obtain a Python Apple support package for iOS](https://github.com/beeware/Python-Apple-support), and extract it into the `My Project` directory generated by the template. This will give you a `Xcode/Support` directory containing a self contained Python install.
22
+
23
+
4. Add your code to the template, into the `Xcode/my-project/app`. directory. At the very minimum, you need to have an `app/<app name>/__main__.py` file that defines a `PythonAppDelegate` class.
24
+
25
+
If your code has any dependencies, they should be installed into the `Xcode/my-project/app_packages` directory.
26
+
27
+
If you've done this correctly, a project with a formal name of `My Project`, with an app name of `my-project` should have a directory structure that looks something like:
28
+
29
+
Xcode/
52
30
my-project/
53
31
app/
54
32
my_project/
@@ -63,33 +41,14 @@ structure that looks something like:
63
41
...
64
42
briefcase.toml
65
43
66
-
You're now ready to open the XCode project file, build and run your
67
-
project!
44
+
You're now ready to open the XCode project file, build and run your project!
68
45
69
46
## Next steps
70
47
71
-
Of course, running Python code isn't very interesting by itself - you'll
72
-
be able to output to the console, and see that output in XCode, but if
73
-
you tap the app icon on your phone, you won't see anything - because
74
-
there isn't a visible console on an iPhone.
75
-
76
-
To do something interesting, you'll need to work with the native iOS
77
-
system libraries to draw widgets and respond to screen taps. The
78
-
[Rubicon](https://github.com/beeware/rubicon-objc) Objective C bridging
79
-
library can be used to interface with the iOS system libraries.
80
-
Alternatively, you could use a cross-platform widget toolkit that
81
-
supports iOS (such as
82
-
[Toga](https://beeware.org/project/projects/libraries/toga)) to provide
83
-
a GUI for your application.
84
-
85
-
Regardless of whether you use Toga, or you write an application
86
-
natively, the template project will try to instantiate a
87
-
`UIApplicationMain` instance, using a class named `PythonAppDelegate` as
88
-
the App delegate. If a class of that name can't be instantiated, the
89
-
error raised will be logged, and the Python interpreter will be shut
90
-
down.
91
-
92
-
If you have any external library dependencies (like Toga, or anything
93
-
other third-party library), you should install the library code into the
94
-
`app_packages` directory. This directory is the same as a
95
-
`site_packages` directory on a desktop Python install.
48
+
Of course, running Python code isn't very interesting by itself - you'll be able to output to the console, and see that output in XCode, but if you tap the app icon on your phone, you won't see anything - because there isn't a visible console on an iPhone.
49
+
50
+
To do something interesting, you'll need to work with the native iOS system libraries to draw widgets and respond to screen taps. The [Rubicon](https://github.com/beeware/rubicon-objc) Objective C bridging library can be used to interface with the iOS system libraries. Alternatively, you could use a cross-platform widget toolkit that supports iOS (such as [Toga](https://beeware.org/project/projects/libraries/toga)) to provide a GUI for your application.
51
+
52
+
Regardless of whether you use Toga, or you write an application natively, the template project will try to instantiate a `UIApplicationMain` instance, using a class named `PythonAppDelegate` as the App delegate. If a class of that name can't be instantiated, the error raised will be logged, and the Python interpreter will be shut down.
53
+
54
+
If you have any external library dependencies (like Toga, or anything other third-party library), you should install the library code into the `app_packages` directory. This directory is the same as a `site_packages` directory on a desktop Python install.
0 commit comments