code: def test_create_model_package(
      tmp_path_factory: TempPathFactory, domain: Domain
  ):
      train_model_storage = LocalModelStorage(
          tmp_path_factory.mktemp("train model storage")
      )
  
      train_schema = GraphSchema(
          {
              "train": SchemaNode(
                  needs={},
                  uses=PersistableTestComponent,
                  fn="train",
                  constructor_name="create",
                  config={
                      "some_config": 123455,
                      "some more config": [{"nested": "hi"}],
                  },
              ),
              "load": SchemaNode(
                  needs={"resource": "train"},
                  uses=PersistableTestComponent,
                  fn="run_inference",
                  constructor_name="load",
                  config={},
                  is_target=True,
              ),
          }
      )
  
      predict_schema = GraphSchema(
          {
              "run": SchemaNode(
                  needs={},
                  uses=PersistableTestComponent,
                  fn="run",
                  constructor_name="load",
                  config={
                      "some_config": 123455,
                      "some more config": [{"nested": "hi"}],
                  },
              )
          }
      )
  
      # Fill model Storage
      with train_model_storage.write_to(
          Resource("resource1")
      ) as directory:
          file = directory / "file.txt"
          file.write_text("test")
  
      # Package model
      persisted_model_dir = tmp_path_factory.mktemp("persisted models")
      archive_path = persisted_model_dir / "my-model.tar.gz"
  
      trained_at = datetime.utcnow()
      with freezegun.freeze_time(trained_at):
          train_model_storage.create_model_package(
              archive_path,
              GraphModelConfiguration(
                  train_schema,
                  predict_schema,
                  TrainingType.BOTH,
                  "test_assistant",
                  None,
                  None,
                  "nlu",
              ),
              domain,
          )
  
      # Unpack and inspect packaged model
      load_model_storage_dir = tmp_path_factory.mktemp(
          "load model storage"
      )
  
      just_packaged_metadata = LocalModelStorage.metadata_from_archive(
          archive_path
      )
  
      (
          load_model_storage,
          packaged_metadata,
      ) = LocalModelStorage.from_model_archive(
          load_model_storage_dir, archive_path
      )
  
      assert (
          just_packaged_metadata.trained_at
          == packaged_metadata.trained_at
      )
  
      assert packaged_metadata.train_schema == train_schema
      assert packaged_metadata.predict_schema == predict_schema
      assert packaged_metadata.domain.as_dict() == domain.as_dict()
  
      assert (
          packaged_metadata.rasa_open_source_version == rasa.__version__
      )
      assert packaged_metadata.trained_at == trained_at
      assert packaged_metadata.model_id
      assert packaged_metadata.assistant_id == "test_assistant"
      assert packaged_metadata.project_fingerprint
  
      persisted_resources = load_model_storage_dir.glob("*")
      assert list(persisted_resources) == [
          Path(load_model_storage_dir, "resource1")
      ]
  
imports: import sys
  import uuid
  from datetime import datetime
  from pathlib import Path
  from tarsafe import TarSafe
  import freezegun
  import pytest
  from _pytest.monkeypatch import MonkeyPatch
  from _pytest.tmpdir import TempPathFactory
  import rasa.shared.utils.io
  from rasa.engine.graph import SchemaNode, GraphSchema, GraphModelConfiguration
  from rasa.engine.storage.local_model_storage import LocalModelStorage, MODEL_ARCHIVE_METADATA_FILE
  from rasa.engine.storage.storage import ModelStorage, ModelMetadata
  from rasa.engine.storage.resource import Resource
  from rasa.exceptions import UnsupportedModelVersionError
  from rasa.shared.core.domain import Domain
  from rasa.shared.data import TrainingType
  from tests.engine.graph_components_test_classes import PersistableTestComponent
label_desc: Use image node_id 5 for calling a global function with example usage: test_create_model_package(tmp_path_factory, domain) without return types