pyfmu.builder.export

Module Contents

pyfmu.builder.export._log
pyfmu.builder.export._exists_ok = True
class pyfmu.builder.export.PyfmuArchive(root: Path = None, resources_dir: Path = None, slave_configuration_path: Path = None, binaries_dir: Path = None, wrapper_win64: Path = None, wrapper_linux64: Path = None, main_script_path: Path = None, model_description: Path = None, model_description_path: Path = None, main_script: Path = None, main_class: Path = None, pyfmu_dir: Path = None)

Object representation of exported Python FMU.

pyfmu.builder.export.import_by_source(path: str)

Loads a python module using its name and the path to the python source script.

Arguments:

path {str} – path to the module

Returns:

module – module loaded from the source file.

pyfmu.builder.export._available_export_platforms()
pyfmu.builder.export._create_archive_directories(archive_path, exist_ok=True)
pyfmu.builder.export._copy_binaries_to_archive(archive: PyfmuArchive) → PyfmuArchive

Copies the binaries to the archive.

Arguments:

archive {PyfmuArchive} – The archive being exported

Returns:

PyfmuArchive – The archive being exported

pyfmu.builder.export._copy_resources_to_archive(project: PyfmuProject, archive: PyfmuArchive) → PyfmuArchive

Copies the source files of the project into the archive.

Note that that a distinction is made between source files and the pyfmu library.

In this case source files refer to files written by the developer.

NOTE: Currently this only copies slave script.

Arguments:

project {PyfmuProject} – [description] archive {PyfmuArchive} – [description]

pyfmu.builder.export._write_modelDescription_to_archive(project: PyfmuProject, archive: PyfmuArchive) → PyfmuArchive
pyfmu.builder.export._write_slaveConfiguration_to_archive(project: PyfmuProject, archive: PyfmuArchive) → PyfmuArchive

Writes the configuration file to the archive used to instantiate and configure the FMI2 slave during runtime.

Arguments:

project {PyfmuProject} – the source project from which the configuration is generated archive {PyfmuArchive} – the archive to which the configuration will be added

Returns:

PyfmuArchive – Archive descriptor

pyfmu.builder.export._compress(archive_path: str)
pyfmu.builder.export._generate_model_description(main_script_path: str, main_class: str) → str
pyfmu.builder.export._generate_slave_config(project: PyfmuProject)

Generate a slave configuration file for the project

Note: Currently there is no difference between the project.json and slave_configuration.json files. The difference

Arguments:

project {PyfmuProject} – [description]

Returns:

[type] – Dict

pyfmu.builder.export._instantiate_main_class(main_script_path: str, main_class: str)
pyfmu.builder.export._validate_model_description(md: str) → bool
pyfmu.builder.export.export_project(project: PyfmuProject, outputPath: Path, overwrite=False, store_compressed: bool = True) → PyfmuArchive

Exports a pyfmu project as an FMU to the specified output path.

Arguments:

project {PyfmuProject} – A PyfmuProject or the path to a project. outputPath {Path} – The path to which the FMU is exported.

Keyword Arguments:

store_compressed {bool} – compress the exported FMU (default: {True})

Raises:

RuntimeError: [description]

Returns:

PyfmuArchive – An object representing the exported FMU.