cocoindex-code 0.2.11__tar.gz → 0.2.22__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. {cocoindex_code-0.2.11 → cocoindex_code-0.2.22}/PKG-INFO +2 -2
  2. {cocoindex_code-0.2.11 → cocoindex_code-0.2.22}/pyproject.toml +1 -1
  3. cocoindex_code-0.2.22/src/cocoindex_code/_daemon_paths.py +44 -0
  4. {cocoindex_code-0.2.11 → cocoindex_code-0.2.22}/src/cocoindex_code/_version.py +2 -2
  5. {cocoindex_code-0.2.11 → cocoindex_code-0.2.22}/src/cocoindex_code/cli.py +2 -2
  6. {cocoindex_code-0.2.11 → cocoindex_code-0.2.22}/src/cocoindex_code/client.py +10 -6
  7. {cocoindex_code-0.2.11 → cocoindex_code-0.2.22}/src/cocoindex_code/daemon.py +8 -39
  8. {cocoindex_code-0.2.11 → cocoindex_code-0.2.22}/src/cocoindex_code/indexer.py +3 -2
  9. {cocoindex_code-0.2.11 → cocoindex_code-0.2.22}/.gitignore +0 -0
  10. {cocoindex_code-0.2.11 → cocoindex_code-0.2.22}/LICENSE +0 -0
  11. {cocoindex_code-0.2.11 → cocoindex_code-0.2.22}/README.md +0 -0
  12. {cocoindex_code-0.2.11 → cocoindex_code-0.2.22}/src/cocoindex_code/__init__.py +0 -0
  13. {cocoindex_code-0.2.11 → cocoindex_code-0.2.22}/src/cocoindex_code/__main__.py +0 -0
  14. {cocoindex_code-0.2.11 → cocoindex_code-0.2.22}/src/cocoindex_code/chunking.py +0 -0
  15. {cocoindex_code-0.2.11 → cocoindex_code-0.2.22}/src/cocoindex_code/litellm_embedder.py +0 -0
  16. {cocoindex_code-0.2.11 → cocoindex_code-0.2.22}/src/cocoindex_code/project.py +0 -0
  17. {cocoindex_code-0.2.11 → cocoindex_code-0.2.22}/src/cocoindex_code/protocol.py +0 -0
  18. {cocoindex_code-0.2.11 → cocoindex_code-0.2.22}/src/cocoindex_code/query.py +0 -0
  19. {cocoindex_code-0.2.11 → cocoindex_code-0.2.22}/src/cocoindex_code/schema.py +0 -0
  20. {cocoindex_code-0.2.11 → cocoindex_code-0.2.22}/src/cocoindex_code/server.py +0 -0
  21. {cocoindex_code-0.2.11 → cocoindex_code-0.2.22}/src/cocoindex_code/settings.py +0 -0
  22. {cocoindex_code-0.2.11 → cocoindex_code-0.2.22}/src/cocoindex_code/shared.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cocoindex-code
3
- Version: 0.2.11
3
+ Version: 0.2.22
4
4
  Summary: MCP server for indexing and querying codebases using CocoIndex
5
5
  Project-URL: Homepage, https://github.com/cocoindex-io/cocoindex-code
6
6
  Project-URL: Repository, https://github.com/cocoindex-io/cocoindex-code
@@ -17,7 +17,7 @@ Classifier: Programming Language :: Python :: 3.12
17
17
  Classifier: Programming Language :: Python :: 3.13
18
18
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
19
  Requires-Python: >=3.11
20
- Requires-Dist: cocoindex[litellm]==1.0.0a38
20
+ Requires-Dist: cocoindex[litellm]==1.0.0a43
21
21
  Requires-Dist: einops>=0.8.2
22
22
  Requires-Dist: mcp>=1.0.0
23
23
  Requires-Dist: msgspec>=0.19.0
@@ -23,7 +23,7 @@ classifiers = [
23
23
 
24
24
  dependencies = [
25
25
  "mcp>=1.0.0",
26
- "cocoindex[litellm]==1.0.0a38",
26
+ "cocoindex[litellm]==1.0.0a43",
27
27
  "sentence-transformers>=2.2.0",
28
28
  "sqlite-vec>=0.1.0",
29
29
  "pydantic>=2.0.0",
@@ -0,0 +1,44 @@
1
+ """Daemon filesystem paths and connection helpers.
2
+
3
+ Lightweight module with no cocoindex dependency so that the CLI client
4
+ can import these without pulling in the full daemon stack.
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ import sys
10
+ from pathlib import Path
11
+
12
+ from .settings import user_settings_dir
13
+
14
+
15
+ def daemon_dir() -> Path:
16
+ """Return the daemon directory (``~/.cocoindex_code/``)."""
17
+ return user_settings_dir()
18
+
19
+
20
+ def connection_family() -> str:
21
+ """Return the multiprocessing connection family for this platform."""
22
+ return "AF_PIPE" if sys.platform == "win32" else "AF_UNIX"
23
+
24
+
25
+ def daemon_socket_path() -> str:
26
+ """Return the daemon socket/pipe address."""
27
+ if sys.platform == "win32":
28
+ import hashlib
29
+
30
+ # Hash the daemon dir so COCOINDEX_CODE_DIR overrides create unique pipe names,
31
+ # preventing conflicts between different daemon instances (tests, users, etc.)
32
+ dir_hash = hashlib.md5(str(daemon_dir()).encode()).hexdigest()[:12]
33
+ return rf"\\.\pipe\cocoindex_code_{dir_hash}"
34
+ return str(daemon_dir() / "daemon.sock")
35
+
36
+
37
+ def daemon_pid_path() -> Path:
38
+ """Return the path for the daemon's PID file."""
39
+ return daemon_dir() / "daemon.pid"
40
+
41
+
42
+ def daemon_log_path() -> Path:
43
+ """Return the path for the daemon's log file."""
44
+ return daemon_dir() / "daemon.log"
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
18
18
  commit_id: str | None
19
19
  __commit_id__: str | None
20
20
 
21
- __version__ = version = '0.2.11'
22
- __version_tuple__ = version_tuple = (0, 2, 11)
21
+ __version__ = version = '0.2.22'
22
+ __version_tuple__ = version_tuple = (0, 2, 22)
23
23
 
24
24
  __commit_id__ = commit_id = None
@@ -599,7 +599,7 @@ def doctor() -> None:
599
599
 
600
600
  # --- 8. Log files ---
601
601
  _print_section("Log Files")
602
- from .daemon import daemon_log_path as _daemon_log_path
602
+ from ._daemon_paths import daemon_log_path as _daemon_log_path
603
603
 
604
604
  _typer.echo(f" Daemon logs: {_daemon_log_path()}")
605
605
  _typer.echo(" Check logs above for further troubleshooting.")
@@ -675,8 +675,8 @@ def daemon_restart() -> None:
675
675
  @daemon_app.command("stop")
676
676
  def daemon_stop() -> None:
677
677
  """Stop the daemon."""
678
+ from ._daemon_paths import daemon_pid_path
678
679
  from .client import is_daemon_running, stop_daemon
679
- from .daemon import daemon_pid_path
680
680
 
681
681
  pid_path = daemon_pid_path()
682
682
  if not pid_path.exists() and not is_daemon_running():
@@ -17,8 +17,14 @@ from collections.abc import Callable
17
17
  from multiprocessing.connection import Client, Connection
18
18
  from pathlib import Path
19
19
 
20
+ from ._daemon_paths import (
21
+ connection_family,
22
+ daemon_dir,
23
+ daemon_log_path,
24
+ daemon_pid_path,
25
+ daemon_socket_path,
26
+ )
20
27
  from ._version import __version__
21
- from .daemon import _connection_family, daemon_log_path, daemon_pid_path, daemon_socket_path
22
28
  from .protocol import (
23
29
  DaemonEnvRequest,
24
30
  DaemonEnvResponse,
@@ -105,7 +111,7 @@ def _raw_connect_and_handshake() -> Connection:
105
111
  if sys.platform != "win32" and not os.path.exists(sock):
106
112
  raise ConnectionRefusedError(f"Daemon socket not found: {sock}")
107
113
  try:
108
- conn = Client(sock, family=_connection_family())
114
+ conn = Client(sock, family=connection_family())
109
115
  except (ConnectionRefusedError, FileNotFoundError, OSError) as e:
110
116
  raise ConnectionRefusedError(f"Cannot connect to daemon: {e}") from e
111
117
 
@@ -329,7 +335,7 @@ def is_daemon_running() -> bool:
329
335
  """Check if the daemon is running."""
330
336
  if sys.platform == "win32":
331
337
  try:
332
- conn = Client(daemon_socket_path(), family=_connection_family())
338
+ conn = Client(daemon_socket_path(), family=connection_family())
333
339
  conn.close()
334
340
  return True
335
341
  except (ConnectionRefusedError, OSError):
@@ -343,8 +349,6 @@ def start_daemon() -> subprocess.Popen[bytes]:
343
349
  Returns the ``Popen`` object so callers can detect early process death
344
350
  (via ``proc.poll()``) instead of waiting for a full timeout.
345
351
  """
346
- from .daemon import daemon_dir, daemon_log_path
347
-
348
352
  daemon_dir().mkdir(parents=True, exist_ok=True)
349
353
  log_path = daemon_log_path()
350
354
 
@@ -518,7 +522,7 @@ def _wait_for_daemon(
518
522
 
519
523
  if sys.platform == "win32":
520
524
  try:
521
- conn = Client(sock_path, family=_connection_family())
525
+ conn = Client(sock_path, family=connection_family())
522
526
  conn.close()
523
527
  return
524
528
  except (ConnectionRefusedError, OSError):
@@ -15,6 +15,13 @@ from multiprocessing.connection import Connection, Listener
15
15
  from pathlib import Path
16
16
  from typing import Any
17
17
 
18
+ from ._daemon_paths import (
19
+ connection_family,
20
+ daemon_dir,
21
+ daemon_log_path,
22
+ daemon_pid_path,
23
+ daemon_socket_path,
24
+ )
18
25
  from ._version import __version__
19
26
  from .chunking import ChunkerFn as _ChunkerFn
20
27
  from .project import Project
@@ -53,7 +60,6 @@ from .settings import (
53
60
  load_project_settings,
54
61
  load_user_settings,
55
62
  target_sqlite_db_path,
56
- user_settings_dir,
57
63
  )
58
64
  from .shared import Embedder, create_embedder
59
65
 
@@ -79,43 +85,6 @@ def _resolve_chunker_registry(mappings: list[ChunkerMapping]) -> dict[str, _Chun
79
85
  return registry
80
86
 
81
87
 
82
- # ---------------------------------------------------------------------------
83
- # Daemon paths
84
- # ---------------------------------------------------------------------------
85
-
86
-
87
- def daemon_dir() -> Path:
88
- """Return the daemon directory (``~/.cocoindex_code/``)."""
89
- return user_settings_dir()
90
-
91
-
92
- def _connection_family() -> str:
93
- """Return the multiprocessing connection family for this platform."""
94
- return "AF_PIPE" if sys.platform == "win32" else "AF_UNIX"
95
-
96
-
97
- def daemon_socket_path() -> str:
98
- """Return the daemon socket/pipe address."""
99
- if sys.platform == "win32":
100
- import hashlib
101
-
102
- # Hash the daemon dir so COCOINDEX_CODE_DIR overrides create unique pipe names,
103
- # preventing conflicts between different daemon instances (tests, users, etc.)
104
- dir_hash = hashlib.md5(str(daemon_dir()).encode()).hexdigest()[:12]
105
- return rf"\\.\pipe\cocoindex_code_{dir_hash}"
106
- return str(daemon_dir() / "daemon.sock")
107
-
108
-
109
- def daemon_pid_path() -> Path:
110
- """Return the path for the daemon's PID file."""
111
- return daemon_dir() / "daemon.pid"
112
-
113
-
114
- def daemon_log_path() -> Path:
115
- """Return the path for the daemon's log file."""
116
- return daemon_dir() / "daemon.log"
117
-
118
-
119
88
  # ---------------------------------------------------------------------------
120
89
  # Project Registry
121
90
  # ---------------------------------------------------------------------------
@@ -540,7 +509,7 @@ def run_daemon() -> None:
540
509
  except Exception:
541
510
  pass
542
511
 
543
- listener = Listener(sock_path, family=_connection_family())
512
+ listener = Listener(sock_path, family=connection_family())
544
513
  logger.info("Listening on %s", sock_path)
545
514
 
546
515
  loop = asyncio.new_event_loop()
@@ -224,5 +224,6 @@ async def indexer_main() -> None:
224
224
  path_matcher=matcher,
225
225
  )
226
226
 
227
- with coco.component_subpath(coco.Symbol("process_file")):
228
- await coco.mount_each(process_file, files.items(), table)
227
+ await coco.mount_each(
228
+ coco.component_subpath(coco.Symbol("process_file")), process_file, files.items(), table
229
+ )
File without changes