class_docstr: Represents the source code directory and provide the utilities to manage it.
class_docstr_tok: ["Represents","the","source","code","directory","and","provide","the","utilities","to","manage","it","."]
docstr: Creates a local directory with source code that is used for creating a local source-code package.
docstr_tok: ["Creates","a","local","directory","with","source","code","that","is","used","for","creating","a","local","source-code","package","."]
code: def packaging_session(self) -> Path:
      """Creates a local directory with source code that is used for creating a local source-code package."""
      session_path = (
          self.cache_location / "packaging_sessions" / self.version
      )
      try:
          rmtree(session_path, ignore_errors=True)
          if self.package_source:
              _copytree(
                  self.path,
                  session_path,
                  ignore_functions=self.ignore_functions,
              )
          if self.sys_customizations_root is not None:
              path_to_sync = Path(
                  session_path, SYS_CUSTOMIZATIONS_SYNC_PATH
              )
              copytree(
                  self.sys_customizations_root,
                  path_to_sync,
                  dirs_exist_ok=True,
              )
          yield session_path
      finally:
          rmtree(session_path, ignore_errors=True)
  
file_path: pytorch-lightning/src/lightning/app/source_code/local.py
imports: import os
  import uuid
  from contextlib import contextmanager
  from pathlib import Path
  from shutil import copytree, rmtree
  from typing import List, Optional
  from lightning.app.core.constants import DOT_IGNORE_FILENAME, SYS_CUSTOMIZATIONS_SYNC_PATH
  from lightning.app.source_code.copytree import _IGNORE_FUNCTION, _copytree
  from lightning.app.source_code.tar import _tar_path
  from lightning.app.source_code.uploader import FileUploader
label_desc: Use image node_id 5 for calling the LocalSourceCodeDir obj's underlying member method code with example usage: obj.packaging_session() without return types