class_docstr: Serializable experiment data.
class_docstr_tok: ["Serializable","experiment","data","."]
docstr: Returns a SerializableExp from the current repo state.
  
  Params, metrics, deps, outs are filled via repo fs/index, all other fields
  should be passed via kwargs.
docstr_tok: ["Returns","a","SerializableExp","from","the","current","repo","state",".","Params",",","metrics",",","deps",",","outs","are","filled","via","repo","fs\/index",",","all","other","fields","should","be","passed","via","kwargs","."]
code: def from_repo(
      cls,
      repo: "Repo",
      rev: Optional[str] = None,
      param_deps: bool = False,
      **kwargs,
  ) -> "SerializableExp":
      """Returns a SerializableExp from the current repo state.
  
      Params, metrics, deps, outs are filled via repo fs/index, all other fields
      should be passed via kwargs.
      """
      from dvc.dependency import ParamsDependency, RepoDependency
  
      rev = rev or repo.get_rev()
      assert rev
  
      params = _gather_params(
          repo, deps_only=param_deps, on_error="return"
      )
      metrics = _gather_metrics(repo, on_error="return")
      return cls(
          rev=rev,
          params=params,
          metrics=metrics,
          deps={
              relpath(dep.fs_path, repo.root_dir): ExpDep(
                  hash=dep.hash_info.value if dep.hash_info else None,
                  size=dep.meta.size if dep.meta else None,
                  nfiles=dep.meta.nfiles if dep.meta else None,
              )
              for dep in repo.index.deps
              if not isinstance(dep, (ParamsDependency, RepoDependency))
          },
          outs={
              relpath(out.fs_path, repo.root_dir): ExpOut(
                  hash=out.hash_info.value if out.hash_info else None,
                  size=out.meta.size if out.meta else None,
                  nfiles=out.meta.nfiles if out.meta else None,
                  use_cache=out.use_cache,
                  is_data_source=out.stage.is_data_source,
              )
              for out in repo.index.outs
              if not (out.is_metric or out.is_plot)
          },
          **kwargs,
      )
  
imports: import json
  from dataclasses import asdict, dataclass, field
  from datetime import datetime
  from typing import TYPE_CHECKING, Any, Dict, Iterator, List, Literal, Optional
  from dvc.exceptions import DvcException
  from dvc.repo.metrics.show import _gather_metrics
  from dvc.repo.params.show import _gather_params
  from dvc.utils import relpath
label_desc: Use image node_id 1 for calling the SerializableExp obj's underlying member method code with example usage: obj.from_repo(cls, repo, rev, param_deps) and returns: cls