pyoxidizer 0.24.0

Package self-contained Python applications
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
```
$ pyoxidizer
? 2
Usage: pyoxidizer[EXE] [OPTIONS] [COMMAND]

Commands:
  analyze                              Analyze a built binary
  build                                Build a PyOxidizer enabled project
  cache-clear                          Clear PyOxidizer's user-specific cache
  find-resources                       Find resources in a file or directory
  generate-python-embedding-artifacts  Generate files useful for embedding Python in a [Rust] binary
  init-config-file                     Create a new PyOxidizer configuration file.
  init-rust-project                    Create a new Rust project embedding a Python interpreter
  list-targets                         List targets available to resolve in a configuration file
  python-distribution-extract          Extract a Python distribution archive to a directory
  python-distribution-info             Show information about a Python distribution archive
  python-distribution-licenses         Show licenses for a given Python distribution
  run-build-script                     Run functionality that a build script would perform
  run                                  Run a target in a PyOxidizer configuration file
  rust-project-licensing               Show licensing information for a Rust project
  help                                 Print this message or the help of the given subcommand(s)

Options:
      --system-rust  Use a system install of Rust instead of a self-managed Rust installation
      --verbose...   Increase logging verbosity. Can be specified multiple times
  -h, --help         Print help information (use `--help` for more detail)
  -V, --version      Print version information

```

```
$ pyoxidizer help
Build and distribute Python applications

Usage: pyoxidizer[EXE] [OPTIONS] [COMMAND]

Commands:
  analyze
          Analyze a built binary
  build
          Build a PyOxidizer enabled project
  cache-clear
          Clear PyOxidizer's user-specific cache
  find-resources
          Find resources in a file or directory
  generate-python-embedding-artifacts
          Generate files useful for embedding Python in a [Rust] binary
  init-config-file
          Create a new PyOxidizer configuration file.
  init-rust-project
          Create a new Rust project embedding a Python interpreter
  list-targets
          List targets available to resolve in a configuration file
  python-distribution-extract
          Extract a Python distribution archive to a directory
  python-distribution-info
          Show information about a Python distribution archive
  python-distribution-licenses
          Show licenses for a given Python distribution
  run-build-script
          Run functionality that a build script would perform
  run
          Run a target in a PyOxidizer configuration file
  rust-project-licensing
          Show licensing information for a Rust project
  help
          Print this message or the help of the given subcommand(s)

Options:
      --system-rust
          Use a system install of Rust instead of a self-managed Rust installation

      --verbose...
          Increase logging verbosity. Can be specified multiple times

  -h, --help
          Print help information (use `-h` for a summary)

  -V, --version
          Print version information

```

```
$ pyoxidizer analyze --help
Analyze a built binary

Usage: pyoxidizer[EXE] analyze [OPTIONS] <path>

Arguments:
  <path>  Path to executable to analyze

Options:
      --system-rust  Use a system install of Rust instead of a self-managed Rust installation
      --verbose...   Increase logging verbosity. Can be specified multiple times
  -h, --help         Print help information

```

```
$ pyoxidizer build --help
Build a PyOxidizer project.

The PATH argument is a filesystem path to a directory containing an
existing PyOxidizer enabled project.

This command will invoke Rust's build system tool (Cargo) to build
the project.


Usage: pyoxidizer[EXE] build [OPTIONS] [TARGET]...

Arguments:
  [TARGET]...
          Target to resolve

Options:
      --system-rust
          Use a system install of Rust instead of a self-managed Rust installation

      --target-triple <target_triple>
          Rust target triple to build for

      --release
          Build a release binary

      --verbose...
          Increase logging verbosity. Can be specified multiple times

      --path <PATH>
          Directory containing project to build
          
          [default: .]

      --var <name> <value>
          Defines a single string key to set in the VARS global dict.
          
          This argument can be used to inject variable content into the Starlark
          execution context to influence evaluation.
          
          <name> defines the key in the dict to set and <value> is its string
          value.
          
          For example, `--var my_var my_value` is functionally similar to the
          Starlark expression `VARS["my_var"] = "my_value"`.
          
          If a Starlark variable is defined multiple times, an error occurs.
          

      --var-env <name> <env>
          Defines a single string key to set in the VARS global dict from an environment variable.
          
          This is like --var except the value of the dict key comes from an
          environment variable.
          
          The <env> environment variable is read and becomes the value of the
          <name> key in the VARS dict.
          
          If the <env> environment variable is not set, the Starlark value will
          be `None` instead of a `string`.
          
          If a Starlark variable is defined multiple times, an error occurs.
          

  -h, --help
          Print help information (use `-h` for a summary)

```

```
$ pyoxidizer cache-clear --help
Clear PyOxidizer's user-specific cache

Usage: pyoxidizer[EXE] cache-clear [OPTIONS]

Options:
      --system-rust  Use a system install of Rust instead of a self-managed Rust installation
      --verbose...   Increase logging verbosity. Can be specified multiple times
  -h, --help         Print help information

```

```
$ pyoxidizer find-resources --help
Scan a directory or file for Python resources.

This command invokes the logic used by various PyOxidizer functionality
walking a directory tree or parsing a file and categorizing seen files.

The directory walking functionality is used by
`oxidized_importer.find_resources_in_path()` and Starlark methods like
`PythonExecutable.pip_install()` and
`PythonExecutable.read_package_root()`.

The file parsing logic is used for parsing the contents of wheels.

This command can be used to debug failures with PyOxidizer's code
for converting files/directories into strongly typed objects. This
conversion is critical for properly packaging Python applications and
bugs can result in incorrect install layouts, missing resources, etc.


Usage: pyoxidizer[EXE] find-resources [OPTIONS] <PATH>

Arguments:
  <PATH>
          Filesystem path to scan for resources. Must be a directory or Python wheel

Options:
      --distributions-dir <PATH>
          Directory to extract downloaded Python distributions into

      --system-rust
          Use a system install of Rust instead of a self-managed Rust installation

      --scan-distribution
          Scan the Python distribution instead of a path

      --verbose...
          Increase logging verbosity. Can be specified multiple times

      --target-triple <target_triple>
          Target triple of Python distribution to use
          
          [default: [..]]

      --no-classify-files
          Whether to skip classifying files as typed resources

      --no-emit-files
          Whether to skip emitting File resources

  -h, --help
          Print help information (use `-h` for a summary)

```

```
$ pyoxidizer generate-python-embedding-artifacts --help
Generate files useful for embedding Python in a [Rust] binary.

This low-level command can be used to write files that facilitate the
embedding of Python in a larger binary. It can be used to write:

* A custom libpython that can be linked into a binary.
* A configuration file for the PyO3 Rust crate telling it how to
  link against the aforementioned custom libpython.
* A Python packed resources file containing the entirety of the Python
  standard library.
* A Rust file defining a default `pyembed::OxidizedPythonInterpreterConfig`
  struct for configuring the embedded Python interpreter.
* tcl/tk support files (for tkinter module support).
* Microsoft Visual C++ Redistributable Runtime DLLs (Windows only).

This command essentially does what the `run-build-script` command does except
it doesn't require the presence of a PyOxidizer configuration file. Instead,
it uses an opinionated default configuration suitable for producing a set of
files suitable for common Python embedding scenarios. If the defaults are not
appropriate for your use case, you can always define a configuration file to
customize them and use `run-build-script` to produce similar output files.


Usage: pyoxidizer[EXE] generate-python-embedding-artifacts [OPTIONS] <DESTINATION_PATH>

Arguments:
  <DESTINATION_PATH>
          Output directory for written files

Options:
      --system-rust
          Use a system install of Rust instead of a self-managed Rust installation

      --target-triple <target_triple>
          Rust target triple being targeted
          
          [default: [..]]

      --flavor <flavor>
          Python distribution flavor
          
          [default: standalone]

      --verbose...
          Increase logging verbosity. Can be specified multiple times

      --python-version <python_version>
          Python version (X.Y) to use

  -h, --help
          Print help information (use `-h` for a summary)

```

```
$ pyoxidizer init-config-file --help
Create a new PyOxidizer configuration file.

Usage: pyoxidizer[EXE] init-config-file [OPTIONS] <PATH>

Arguments:
  <PATH>  Directory where configuration file should be created

Options:
      --python-code <python-code>  Default Python code to execute in built executable
      --system-rust                Use a system install of Rust instead of a self-managed Rust installation
      --pip-install <pip-install>  Python package to install via `pip install`
      --verbose...                 Increase logging verbosity. Can be specified multiple times
  -h, --help                       Print help information

```

```
$ pyoxidizer init-rust-project --help
Create a new Rust project embedding Python.

The PATH argument is a filesystem path that should be created to hold the
new Rust project.

This command will call `cargo init PATH` and then install files and make
modifications required to embed a Python interpreter in that application.

The new project's binary will be configured to launch a Python REPL by
default.

Created projects inherit settings such as Python distribution URLs and
dependency crate versions and locations from the PyOxidizer executable
they were created with.

On success, instructions on potential next steps are printed.


Usage: pyoxidizer[EXE] init-rust-project [OPTIONS] <PATH>

Arguments:
  <PATH>
          Path of project directory to create

Options:
      --system-rust
          Use a system install of Rust instead of a self-managed Rust installation

      --verbose...
          Increase logging verbosity. Can be specified multiple times

  -h, --help
          Print help information (use `-h` for a summary)

```

```
$ pyoxidizer list-targets --help
List targets available to resolve in a configuration file

Usage: pyoxidizer[EXE] list-targets [OPTIONS] [PATH]

Arguments:
  [PATH]  Path to project to evaluate [default: .]

Options:
      --system-rust  Use a system install of Rust instead of a self-managed Rust installation
      --verbose...   Increase logging verbosity. Can be specified multiple times
  -h, --help         Print help information

```

```
$ pyoxidizer python-distribution-extract --help
Extract a Python distribution archive to a directory

Usage: pyoxidizer[EXE] python-distribution-extract [OPTIONS] <DESTINATION_PATH>

Arguments:
  <DESTINATION_PATH>  Path to directory where distribution should be extracted

Options:
      --download-default
          Download and extract the default distribution for this platform
      --system-rust
          Use a system install of Rust instead of a self-managed Rust installation
      --archive-path <DISTRIBUTION_PATH>
          Path to a Python distribution archive
      --verbose...
          Increase logging verbosity. Can be specified multiple times
  -h, --help
          Print help information

```

```
$ pyoxidizer python-distribution-info --help
Show information about a Python distribution archive

Usage: pyoxidizer[EXE] python-distribution-info [OPTIONS] <PATH>

Arguments:
  <PATH>  Path to Python distribution archive to analyze

Options:
      --system-rust  Use a system install of Rust instead of a self-managed Rust installation
      --verbose...   Increase logging verbosity. Can be specified multiple times
  -h, --help         Print help information

```

```
$ pyoxidizer python-distribution-licenses --help
Show licenses for a given Python distribution

Usage: pyoxidizer[EXE] python-distribution-licenses [OPTIONS] <PATH>

Arguments:
  <PATH>  Path to Python distribution to analyze

Options:
      --system-rust  Use a system install of Rust instead of a self-managed Rust installation
      --verbose...   Increase logging verbosity. Can be specified multiple times
  -h, --help         Print help information

```

```
$ pyoxidizer run --help
Run a target in a PyOxidizer configuration file

Usage: pyoxidizer[EXE] run [OPTIONS] [extra]...

Arguments:
  [extra]...
          

Options:
      --system-rust
          Use a system install of Rust instead of a self-managed Rust installation

      --target-triple <target_triple>
          Rust target triple to build for

      --release
          Run a release binary

      --verbose...
          Increase logging verbosity. Can be specified multiple times

      --path <PATH>
          Directory containing project to build
          
          [default: .]

      --target <target>
          Build target to run

      --var <name> <value>
          Defines a single string key to set in the VARS global dict.
          
          This argument can be used to inject variable content into the Starlark
          execution context to influence evaluation.
          
          <name> defines the key in the dict to set and <value> is its string
          value.
          
          For example, `--var my_var my_value` is functionally similar to the
          Starlark expression `VARS["my_var"] = "my_value"`.
          
          If a Starlark variable is defined multiple times, an error occurs.
          

      --var-env <name> <env>
          Defines a single string key to set in the VARS global dict from an environment variable.
          
          This is like --var except the value of the dict key comes from an
          environment variable.
          
          The <env> environment variable is read and becomes the value of the
          <name> key in the VARS dict.
          
          If the <env> environment variable is not set, the Starlark value will
          be `None` instead of a `string`.
          
          If a Starlark variable is defined multiple times, an error occurs.
          

  -h, --help
          Print help information (use `-h` for a summary)

```

```
$ pyoxidizer run-build-script --help
Runs a crate build script to generate Python artifacts.

When the Rust crate embedding Python is built, it needs to consume various
artifacts derived from processing the active PyOxidizer config file.
These files are typically generated when the crate's build script runs.

This command executes the functionality to derive various artifacts and
emits special lines that tell the Rust build system how to consume them.


Usage: pyoxidizer[EXE] run-build-script [OPTIONS] <build-script-name>

Arguments:
  <build-script-name>
          Value to use for Rust build script

Options:
      --system-rust
          Use a system install of Rust instead of a self-managed Rust installation

      --target <target>
          The config file target to resolve

      --var <name> <value>
          Defines a single string key to set in the VARS global dict.
          
          This argument can be used to inject variable content into the Starlark
          execution context to influence evaluation.
          
          <name> defines the key in the dict to set and <value> is its string
          value.
          
          For example, `--var my_var my_value` is functionally similar to the
          Starlark expression `VARS["my_var"] = "my_value"`.
          
          If a Starlark variable is defined multiple times, an error occurs.
          

      --verbose...
          Increase logging verbosity. Can be specified multiple times

      --var-env <name> <env>
          Defines a single string key to set in the VARS global dict from an environment variable.
          
          This is like --var except the value of the dict key comes from an
          environment variable.
          
          The <env> environment variable is read and becomes the value of the
          <name> key in the VARS dict.
          
          If the <env> environment variable is not set, the Starlark value will
          be `None` instead of a `string`.
          
          If a Starlark variable is defined multiple times, an error occurs.
          

  -h, --help
          Print help information (use `-h` for a summary)

```

```
$ pyoxidizer rust-project-licensing --help
Show licensing information for a Rust project

Usage: pyoxidizer[EXE] rust-project-licensing [OPTIONS] <project_path>

Arguments:
  <project_path>  The path to the Rust project to evaluate

Options:
      --all-features                   Activate all crate features during evaluation
      --system-rust                    Use a system install of Rust instead of a self-managed Rust installation
      --target-triple <target_triple>  Rust target triple to simulate building for
      --verbose...                     Increase logging verbosity. Can be specified multiple times
      --unified-license                Print a unified license document
  -h, --help                           Print help information

```