# archive_generator

Python API: `luxonis_ml.nn_archive.archive_generator`

## Classes

### ArchiveGenerator

Build NN Archive files from configuration and model executables.

The generated archive is a compressed tar file that contains `config.json` and the provided executable files.

#### Methods

##### init

```python
def __init__(archive_name: str, save_path: PathType, cfg_dict: dict, executables_paths: list[PathType], compression: Literal['xz', 'gz', 'bz2'] = 'xz'):
```

Create a generator for an NN Archive.

Parameters

 * `archive_name` (`str`): Desired archive file name. The `.tar` and compression suffix are added if missing.
 * `save_path` (`PathType`): Directory where the archive should be written.
 * `cfg_dict` (`dict`): Archive configuration used to build `config.json`.
 * `executables_paths` (`list[PathType]`): Paths to model executable files to include.
 * `compression` (`Literal['xz', 'gz', 'bz2']`): Compression algorithm for the tar archive.

Raises

 * `ValueError`: If `compression` is not one of `"xz"`, `"gz"`, or `"bz2"`.

##### make_archive

```python
def make_archive(self) -> Path:
```

Generate the NN Archive file.

Returns

 * `Path`: Path to the generated archive.

#### Attributes

##### archive_name

Archive file name, including the `.tar` and compression suffix.

##### cfg

Validated archive configuration.

##### compression

Compression algorithm used for the tar archive.

##### executables_paths

Paths to executable files included in the archive.

##### save_path

Directory where the archive is written.
