Struct python_packaging::zip_app_builder::ZipAppBuilder[][src]

pub struct ZipAppBuilder { /* fields omitted */ }
Expand description

Interface for building .zip file based Python applications.

This type implements functionality provided by the Python stdlib zipapp module. It is used to produce zip files containing Python resources (notably module source and bytecode) that Python interpreters can execute as standalone applications.

The zip archives can contain a shebang line (#!<interpreter>) denoting a program to use to execute the zipapp. This is typically python or some such variant.

Implementations

Obtain the interpreter to use in the shebang line.

Set the interpreter to use in the shebang line.

Obtain the modified time for files in the wheel archive.

Set the modified time for files in the wheel archive.

Set the Python bytecode compiler to use to turn source code into bytecode.

Obtain the bytecode optimization level used when generating Python bytecode.

Set the bytecode optimization level used when generating Python bytecode.

pub fn add_file_entry(
    &mut self,
    path: impl AsRef<Path>,
    entry: impl Into<FileEntry>
) -> Result<()>

Add a file to the zip archive.

This is the lowest level mechanism to add an entry to the zip archive. The path/file will be added without modification.

Add Python module source code to the archive.

This only adds source code, not bytecode.

Add Python module source and corresponding bytecode to the archive.

This will automatically compile bytecode at the specified optimization level given the source code provided.

Add Python module bytecode, without corresponding source code.

Define the function called when the zip-based application is executed.

This defines a __main__.py[c] that invokes the func function in the module module.

Writes zip archive data to a writer.

This will emit a zip archive + optional leading shebang so it is runnable as a standalone executable file.

Write the zip archive to a filesystem path.

Trait Implementations

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.