Skip to content

Commit 33bba67

Browse files
committed
Bump support packages.
1 parent 17876bc commit 33bba67

3 files changed

Lines changed: 29 additions & 68 deletions

File tree

README.md

Lines changed: 22 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,32 @@
11
# Briefcase iOS Xcode Template
22

3-
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.
54

65
## Using this template
76

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.
128

139
However, if you *do* want to use this template directly...
1410

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:
1812

1913
$ pip install cookiecutter
2014

2115
2. Run `cookiecutter` on the template:
2216

2317
$ cookiecutter https://github.com/beeware/briefcase-iOS-Xcode-template
2418

25-
This will ask you for a number of details of your application,
26-
including the <span class="title-ref">name</span> of your
27-
application (which should be a valid PyPI identifier), and the
28-
<span class="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 <span class="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 <span class="title-ref">name</span> of your application (which should be a valid PyPI identifier), and the <span class="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 <span class="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/
5230
my-project/
5331
app/
5432
my_project/
@@ -63,33 +41,14 @@ structure that looks something like:
6341
...
6442
briefcase.toml
6543

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!
6845

6946
## Next steps
7047

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.

{{ cookiecutter.format }}/briefcase.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ app_packages_path = "{{ cookiecutter.class_name }}/app_packages"
99
info_plist_path = "{{ cookiecutter.class_name }}/{{ cookiecutter.class_name }}-Info.plist"
1010
support_path = "Support"
1111
{{ {
12-
"3.10": "support_revision = 13",
13-
"3.11": "support_revision = 8",
14-
"3.12": "support_revision = 8",
15-
"3.13": "support_revision = 13",
16-
"3.14": "support_revision = 9",
12+
"3.10": "support_revision = 14",
13+
"3.11": "support_revision = 9",
14+
"3.12": "support_revision = 9",
15+
"3.13": "support_revision = 14",
16+
"3.14": "support_revision = 10",
1717
}.get(cookiecutter.python_version|py_tag, "") }}
1818

1919
icon.20 = "{{ cookiecutter.class_name }}/Images.xcassets/AppIcon.appiconset/icon-20.png"

{{ cookiecutter.format }}/{{ cookiecutter.class_name }}/main.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ int main(int argc, char *argv[]) {
5454
preconfig.utf8_mode = 1;
5555
// Ensure the locale is set (isolated interpreters won't by default)
5656
preconfig.configure_locale = 1;
57+
// Explicitly stdout to the system log
58+
config.use_system_logger = 1;
5759
// Don't buffer stdio. We want output to appears in the log immediately
5860
config.buffered_stdio = 0;
5961
// Don't write bytecode; we can't modify the app bundle

0 commit comments

Comments
 (0)