Debian Codegraph @

docs/en/reference/commands/run.md

raw
1 # run
2
3 Starts the application, using the packaged version of the application code. By default, targets the current platform's default output format.
4
5 If the output format is an executable (e.g., a macOS .app file), the `run` command will start that executable. If the output is an installer, `run` will attempt to replicate as much as possible of the runtime environment that would be installed, but will not actually install the app. For example, on Windows, `run` will use the interpreter that will be included in the installer, and the versions of code and requirements that will be installed, but *won't* run the installer to produce Start Menu items, registry records, etc.
6
7 ## Test mode
8
9 The `run` command can also be used to execute your app's test suite, in the packaged environment (e.g., on the iOS simulator, or from within a Linux Flatpak). When running in test mode (using the `--test` option), a different entry point will be used for the app: if your app is contained in a Python module named `myapp`, test mode will attempt to launch `tests.myapp`. Your app is responsible for providing the logic to discover and start the test suite.
10
11 The code for your test suite can specified using the [`test_sources`][] setting; test-specific requirements can be specified with [`test_requires`][]. Test sources and requirements will only be included in your app when running in test mode.
12
13 Briefcase will monitor the log output of the test suite, looking for the output corresponding to test suite completion. Briefcase has built-in support for [`pytest`](https://docs.pytest.org/en/latest) and [unittest](https://docs.python.org/3/library/unittest.html) test suites; support for other test frameworks can be added using the `test_success_regex` and `test_failure_regex` settings.
14
15 ### Usage
16
17 To run your application on the current platform's default output format:
18
19 ```console
20 $ briefcase run
21 ```
22
23 To run your application for a different platform:
24
25 ```console
26 $ briefcase run <platform>
27 ```
28
29 To run your application using a specific output format:
30
31 ```console
32 $ briefcase run <platform> <output format>
33 ```
34
35 ### Options
36
37 The following options can be provided at the command line.
38
39 ## `-a <app name>` / `--app <app name>`
40
41 Run a specific application target in your project. This argument is only required if your project contains more than one application target. The app name specified should be the machine-readable package name for the app.
42
43 ## `-u` / `--update`
44
45 Update the application's source code before running. Equivalent to running:
46
47 ```console
48 $ briefcase update
49 $ briefcase build
50 $ briefcase run
51 ```
52
53 ## `-r` / `--update-requirements`
54
55 Update application requirements before running. Equivalent to running:
56
57 ```console
58 $ briefcase update -r
59 $ briefcase build
60 $ briefcase run
61 ```
62
63 ## `--update-resources`
64
65 Update application resources such as icons before running. Equivalent to running:
66
67 ```console
68 $ briefcase update --update-resources
69 $ briefcase build
70 $ briefcase run
71 ```
72
73 ## `--update-support`
74
75 Update application support package before running. Equivalent to running:
76
77 ```console
78 $ briefcase update --update-support
79 $ briefcase build
80 $ briefcase run
81 ```
82
83 ## `--update-stub`
84
85 Update stub binary before running. Equivalent to running:
86
87 ```console
88 $ briefcase update --update-stub
89 $ briefcase build
90 $ briefcase run
91 ```
92
93 ## `--test`
94
95 Run the app in test mode in the bundled app environment. Running `run --test` will also cause an update and build to ensure that the packaged application contains the most recent test code. To prevent this update and build, use the `--no-update` option.
96
97 ## `--no-update`
98
99 Prevent the automated update and build of app code that is performed when specifying by the `--test` option.
100
101 ## `--debug <debugger>` { #run-debug }
102
103 Run the app in debug mode.
104
105 Briefcase provides a [plugin interface][debugger-interface] that allows third-party debugger integrations. Currently the following debuggers are supported:
106
107 - `pdb`: This is used for debugging via console (see [Debug via PDB][debug-pdb])
108 - `debugpy`: This is used for debugging via VS Code (see [Debug via VS Code][debug-vscode])
109
110 If calling only `--debug` without selecting a debugger explicitly, `pdb` is used as default.
111
112 This is an **experimental** new feature, that is currently only supported on Windows, macOS, iOS and Android.
113
114 The selected debugger in `run --debug <debugger>` has to match the selected debugger in `build --debug <debugger>`.
115
116 ## `--debugger-host <host>`
117
118 Specifies the host of the socket connection for the debugger. This option is only used when the `--debug <debugger>` option is specified. The default value is `localhost`.
119
120 ## `--debugger-port <port>`
121
122 Specifies the port of the socket connection for the debugger. This option is only used when the `--debug <debugger>` option is specified. The default value is `5678`.
123
124 ## Passthrough arguments
125
126 If you want to pass any arguments to your app's command line, you can specify them using the `--` marker to separate Briefcase's arguments from your app's arguments. For example:
127
128 ```console
129 briefcase run -- --wiggle --test
130 ```
131
132 will run the app in normal mode, passing the `--wiggle` and `--test` flags to the app's command line. The app will *not* run in *Briefcase's* test mode; the `--test` flag will be left for your own app to interpret.