docstr: Create a Runtime instance. It won't be started yet.
  
  Runtime is *not* thread-safe. Its public methods are generally
  safe to call only on the same thread that its event loop runs on.
  
  Parameters
  ----------
  config
      Config options.
code: def __init__(self, config: RuntimeConfig):
      """Create a Runtime instance. It won't be started yet.
  
      Runtime is *not* thread-safe. Its public methods are generally
      safe to call only on the same thread that its event loop runs on.
  
      Parameters
      ----------
      config
          Config options.
      """
      if Runtime._instance is not None:
          raise RuntimeError("Runtime instance already exists!")
      Runtime._instance = self
  
      # Will be created when we start.
      self._async_objs: Optional[AsyncObjects] = None
  
      # The task that runs our main loop. We need to save a reference
      # to it so that it doesn't get garbage collected while running.
      self._loop_coroutine_task: Optional[asyncio.Task[None]] = None
  
      self._main_script_path = config.script_path
      self._is_hello = config.is_hello
  
      self._state = RuntimeState.INITIAL
  
      # Initialize managers
      self._message_cache = ForwardMsgCache()
      self._uploaded_file_mgr = config.uploaded_file_manager
      self._media_file_mgr = MediaFileManager(
          storage=config.media_file_storage
      )
      self._cache_storage_manager = config.cache_storage_manager
      self._script_cache = ScriptCache()
  
      self._session_mgr = config.session_manager_class(
          session_storage=config.session_storage,
          uploaded_file_manager=self._uploaded_file_mgr,
          script_cache=self._script_cache,
          message_enqueued_callback=self._enqueued_some_message,
      )
  
      self._stats_mgr = StatsManager()
      self._stats_mgr.register_provider(get_data_cache_stats_provider())
      self._stats_mgr.register_provider(
          get_resource_cache_stats_provider()
      )
      self._stats_mgr.register_provider(_mem_caches)
      self._stats_mgr.register_provider(self._message_cache)
      self._stats_mgr.register_provider(self._uploaded_file_mgr)
      self._stats_mgr.register_provider(
          SessionStateStatProvider(self._session_mgr)
      )
  
imports: from __future__ import annotations
  import asyncio
  import time
  import traceback
  from dataclasses import dataclass, field
  from enum import Enum
  from typing import TYPE_CHECKING, Awaitable, Dict, NamedTuple, Optional, Tuple, Type
  from typing_extensions import Final
  from streamlit import config
  from streamlit.logger import get_logger
  from streamlit.proto.BackMsg_pb2 import BackMsg
  from streamlit.proto.ForwardMsg_pb2 import ForwardMsg
  from streamlit.runtime.app_session import AppSession
  from streamlit.runtime.caching import get_data_cache_stats_provider, get_resource_cache_stats_provider
  from streamlit.runtime.caching.storage.local_disk_cache_storage import LocalDiskCacheStorageManager
  from streamlit.runtime.forward_msg_cache import ForwardMsgCache, create_reference_msg, populate_hash_if_needed
  from streamlit.runtime.legacy_caching.caching import _mem_caches
  from streamlit.runtime.media_file_manager import MediaFileManager
  from streamlit.runtime.media_file_storage import MediaFileStorage
  from streamlit.runtime.memory_session_storage import MemorySessionStorage
  from streamlit.runtime.runtime_util import is_cacheable_msg
  from streamlit.runtime.script_data import ScriptData
  from streamlit.runtime.scriptrunner.script_cache import ScriptCache
  from streamlit.runtime.session_manager import ActiveSessionInfo, SessionClient, SessionClientDisconnectedError, SessionManager, SessionStorage
  from streamlit.runtime.state import SCRIPT_RUN_WITHOUT_ERRORS_KEY, SessionStateStatProvider
  from streamlit.runtime.stats import StatsManager
  from streamlit.runtime.uploaded_file_manager import UploadedFileManager
  from streamlit.runtime.websocket_session_manager import WebsocketSessionManager
  from streamlit.watcher import LocalSourcesWatcher
label_desc: Use image node_id 3 to create a new Runtime object  with example: obj = Runtime(config)