MCPcopy Create free account
hub / github.com/cocoindex-io/cocoindex-code / get_project

Method get_project

src/cocoindex_code/daemon.py:146–164  ·  view source on GitHub ↗

Get or create a Project for the given root. Lazy initialization.

(self, project_root: str)

Source from the content-addressed store, hash-verified

144 self.query_params = dict(query_params) if query_params else {}
145
146 async def get_project(self, project_root: str) -> Project:
147 """Get or create a Project for the given root. Lazy initialization."""
148 if self._embedder is None:
149 raise RuntimeError(
150 "Daemon has no global settings loaded. Run `ccc init` to set up cocoindex-code."
151 )
152 if project_root not in self._projects:
153 root = Path(project_root)
154 project_settings = load_project_settings(root)
155 chunker_registry = _resolve_chunker_registry(project_settings.chunkers)
156 project = await Project.create(
157 root,
158 self._embedder,
159 indexing_params=self.indexing_params,
160 query_params=self.query_params,
161 chunker_registry=chunker_registry,
162 )
163 self._projects[project_root] = project
164 return self._projects[project_root]
165
166 def remove_project(self, project_root: str) -> bool:
167 """Remove a project from the registry. Returns True if it was loaded."""

Callers 1

_dispatchFunction · 0.80

Calls 3

load_project_settingsFunction · 0.85
createMethod · 0.80

Tested by

no test coverage detected