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.
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.
pub fn add_python_module_source(
&mut self,
source: &PythonModuleSource,
prefix: &str
) -> Result<()>
pub fn add_python_module_source(
&mut self,
source: &PythonModuleSource,
prefix: &str
) -> Result<()>
Add Python module source code to the archive.
This only adds source code, not bytecode.
pub fn add_python_module_source_and_bytecode(
&mut self,
source: &PythonModuleSource,
prefix: &str
) -> Result<()>
pub fn add_python_module_source_and_bytecode(
&mut self,
source: &PythonModuleSource,
prefix: &str
) -> Result<()>
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.
pub fn add_python_module_bytecode(
&mut self,
bytecode: &PythonModuleBytecode,
prefix: &str
) -> Result<()>
pub fn add_python_module_bytecode(
&mut self,
bytecode: &PythonModuleBytecode,
prefix: &str
) -> Result<()>
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.