codegraphy 0.1.1__tar.gz → 1.0.0__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 (26) hide show
  1. {codegraphy-0.1.1 → codegraphy-1.0.0}/PKG-INFO +32 -1
  2. {codegraphy-0.1.1 → codegraphy-1.0.0}/README.md +31 -0
  3. {codegraphy-0.1.1 → codegraphy-1.0.0}/codegraphy/__init__.py +1 -1
  4. {codegraphy-0.1.1 → codegraphy-1.0.0}/codegraphy/db/store.py +11 -0
  5. {codegraphy-0.1.1 → codegraphy-1.0.0}/codegraphy/indexer/python.py +10 -2
  6. {codegraphy-0.1.1 → codegraphy-1.0.0}/codegraphy.egg-info/PKG-INFO +32 -1
  7. {codegraphy-0.1.1 → codegraphy-1.0.0}/LICENSE +0 -0
  8. {codegraphy-0.1.1 → codegraphy-1.0.0}/codegraphy/cli.py +0 -0
  9. {codegraphy-0.1.1 → codegraphy-1.0.0}/codegraphy/config.py +0 -0
  10. {codegraphy-0.1.1 → codegraphy-1.0.0}/codegraphy/db/__init__.py +0 -0
  11. {codegraphy-0.1.1 → codegraphy-1.0.0}/codegraphy/db/schema.py +0 -0
  12. {codegraphy-0.1.1 → codegraphy-1.0.0}/codegraphy/indexer/__init__.py +0 -0
  13. {codegraphy-0.1.1 → codegraphy-1.0.0}/codegraphy/indexer/base.py +0 -0
  14. {codegraphy-0.1.1 → codegraphy-1.0.0}/codegraphy/indexer/walker.py +0 -0
  15. {codegraphy-0.1.1 → codegraphy-1.0.0}/codegraphy/mcp/__init__.py +0 -0
  16. {codegraphy-0.1.1 → codegraphy-1.0.0}/codegraphy/mcp/server.py +0 -0
  17. {codegraphy-0.1.1 → codegraphy-1.0.0}/codegraphy/plugins/__init__.py +0 -0
  18. {codegraphy-0.1.1 → codegraphy-1.0.0}/codegraphy/plugins/base.py +0 -0
  19. {codegraphy-0.1.1 → codegraphy-1.0.0}/codegraphy/plugins/django.py +0 -0
  20. {codegraphy-0.1.1 → codegraphy-1.0.0}/codegraphy.egg-info/SOURCES.txt +0 -0
  21. {codegraphy-0.1.1 → codegraphy-1.0.0}/codegraphy.egg-info/dependency_links.txt +0 -0
  22. {codegraphy-0.1.1 → codegraphy-1.0.0}/codegraphy.egg-info/entry_points.txt +0 -0
  23. {codegraphy-0.1.1 → codegraphy-1.0.0}/codegraphy.egg-info/requires.txt +0 -0
  24. {codegraphy-0.1.1 → codegraphy-1.0.0}/codegraphy.egg-info/top_level.txt +0 -0
  25. {codegraphy-0.1.1 → codegraphy-1.0.0}/pyproject.toml +0 -0
  26. {codegraphy-0.1.1 → codegraphy-1.0.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codegraphy
3
- Version: 0.1.1
3
+ Version: 1.0.0
4
4
  Summary: SQLite/PostgreSQL codebase knowledge graph and MCP server for Claude Code
5
5
  Author: Charan Kulal
6
6
  License-Expression: MIT
@@ -80,6 +80,37 @@ The base PyPI package keeps SQLite support in the standard library path, so Post
80
80
 
81
81
  ---
82
82
 
83
+ ## PostgreSQL
84
+
85
+ Install PostgreSQL support:
86
+
87
+ ```bash
88
+ pip install 'codegraphy[postgres]'
89
+ ```
90
+
91
+ Initialize with a PostgreSQL URL:
92
+
93
+ ```bash
94
+ codegraphy init --db postgresql://USER:PASSWORD@HOST:PORT/DBNAME
95
+ ```
96
+
97
+ Example:
98
+
99
+ ```bash
100
+ codegraphy init --db postgresql://postgres:postgres@localhost:5432/codegraphy
101
+ ```
102
+
103
+ Or set `DATABASE_URL` once and reuse it:
104
+
105
+ ```bash
106
+ export DATABASE_URL=postgresql://postgres:postgres@localhost:5432/codegraphy
107
+ codegraphy init
108
+ codegraphy index .
109
+ codegraphy serve
110
+ ```
111
+
112
+ ---
113
+
83
114
  ## Quickstart
84
115
 
85
116
  ```bash
@@ -40,6 +40,37 @@ The base PyPI package keeps SQLite support in the standard library path, so Post
40
40
 
41
41
  ---
42
42
 
43
+ ## PostgreSQL
44
+
45
+ Install PostgreSQL support:
46
+
47
+ ```bash
48
+ pip install 'codegraphy[postgres]'
49
+ ```
50
+
51
+ Initialize with a PostgreSQL URL:
52
+
53
+ ```bash
54
+ codegraphy init --db postgresql://USER:PASSWORD@HOST:PORT/DBNAME
55
+ ```
56
+
57
+ Example:
58
+
59
+ ```bash
60
+ codegraphy init --db postgresql://postgres:postgres@localhost:5432/codegraphy
61
+ ```
62
+
63
+ Or set `DATABASE_URL` once and reuse it:
64
+
65
+ ```bash
66
+ export DATABASE_URL=postgresql://postgres:postgres@localhost:5432/codegraphy
67
+ codegraphy init
68
+ codegraphy index .
69
+ codegraphy serve
70
+ ```
71
+
72
+ ---
73
+
43
74
  ## Quickstart
44
75
 
45
76
  ```bash
@@ -2,4 +2,4 @@
2
2
  codegraphy: Parses a codebase into a Postgres/SQLite knowledge graph and exposes it as an MCP server.
3
3
  """
4
4
 
5
- __version__ = "0.1.1"
5
+ __version__ = "1.0.0"
@@ -73,10 +73,21 @@ class Store:
73
73
  row = cursor.fetchone()
74
74
  return row[0] if row else None
75
75
 
76
+ def _dedupe_symbols(self, symbols: list) -> list:
77
+ deduped = []
78
+ seen = set()
79
+ for symbol in symbols:
80
+ if symbol.qualified_name in seen:
81
+ continue
82
+ seen.add(symbol.qualified_name)
83
+ deduped.append(symbol)
84
+ return deduped
85
+
76
86
  def upsert_file(self, file_path: str, git_hash: str, symbols: list, edges: list):
77
87
  """
78
88
  Replace symbols and edges for a file.
79
89
  """
90
+ symbols = self._dedupe_symbols(symbols)
80
91
  with self.get_connection() as conn:
81
92
  cursor = conn.cursor()
82
93
 
@@ -44,6 +44,14 @@ class PythonIndexer(BaseIndexer):
44
44
  return f"{module_path}.{name}" if module_path else name
45
45
  return f"{module_path}.{'.'.join(self.current_scope)}.{name}"
46
46
 
47
+ def get_import_qualname(self, node, imported_name, source_module):
48
+ scope = ".".join(self.current_scope)
49
+ parts = [module_path] if module_path else []
50
+ if scope:
51
+ parts.append(scope)
52
+ parts.extend(["__import__", str(node.lineno), str(node.col_offset), source_module, imported_name])
53
+ return ".".join(parts)
54
+
47
55
  def visit_ClassDef(self, node):
48
56
  qualname = self.get_qualname(node.name)
49
57
  summary = ast.get_docstring(node) or ""
@@ -108,7 +116,7 @@ class PythonIndexer(BaseIndexer):
108
116
  for alias in node.names:
109
117
  # module level import
110
118
  # e.g., import os
111
- qualname = self.get_qualname(alias.asname or alias.name)
119
+ qualname = self.get_import_qualname(node, alias.asname or alias.name, alias.name)
112
120
  symbols.append(Symbol(
113
121
  name=alias.asname or alias.name,
114
122
  qualified_name=qualname,
@@ -129,7 +137,7 @@ class PythonIndexer(BaseIndexer):
129
137
  if node.module:
130
138
  for alias in node.names:
131
139
  name = alias.asname or alias.name
132
- qualname = self.get_qualname(name)
140
+ qualname = self.get_import_qualname(node, name, node.module)
133
141
  symbols.append(Symbol(
134
142
  name=name,
135
143
  qualified_name=qualname,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codegraphy
3
- Version: 0.1.1
3
+ Version: 1.0.0
4
4
  Summary: SQLite/PostgreSQL codebase knowledge graph and MCP server for Claude Code
5
5
  Author: Charan Kulal
6
6
  License-Expression: MIT
@@ -80,6 +80,37 @@ The base PyPI package keeps SQLite support in the standard library path, so Post
80
80
 
81
81
  ---
82
82
 
83
+ ## PostgreSQL
84
+
85
+ Install PostgreSQL support:
86
+
87
+ ```bash
88
+ pip install 'codegraphy[postgres]'
89
+ ```
90
+
91
+ Initialize with a PostgreSQL URL:
92
+
93
+ ```bash
94
+ codegraphy init --db postgresql://USER:PASSWORD@HOST:PORT/DBNAME
95
+ ```
96
+
97
+ Example:
98
+
99
+ ```bash
100
+ codegraphy init --db postgresql://postgres:postgres@localhost:5432/codegraphy
101
+ ```
102
+
103
+ Or set `DATABASE_URL` once and reuse it:
104
+
105
+ ```bash
106
+ export DATABASE_URL=postgresql://postgres:postgres@localhost:5432/codegraphy
107
+ codegraphy init
108
+ codegraphy index .
109
+ codegraphy serve
110
+ ```
111
+
112
+ ---
113
+
83
114
  ## Quickstart
84
115
 
85
116
  ```bash
File without changes
File without changes
File without changes
File without changes