node-walk 0.1.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 (36) hide show
  1. node_walk-0.1.0/.github/workflows/ci.yml +66 -0
  2. node_walk-0.1.0/.github/workflows/release.yml +103 -0
  3. node_walk-0.1.0/.gitignore +222 -0
  4. node_walk-0.1.0/LICENSE +21 -0
  5. node_walk-0.1.0/PKG-INFO +107 -0
  6. node_walk-0.1.0/README.md +83 -0
  7. node_walk-0.1.0/plans/plan.md +477 -0
  8. node_walk-0.1.0/pyproject.toml +51 -0
  9. node_walk-0.1.0/src/node_walk/__init__.py +3 -0
  10. node_walk-0.1.0/src/node_walk/analysis/__init__.py +12 -0
  11. node_walk-0.1.0/src/node_walk/analysis/base.py +205 -0
  12. node_walk-0.1.0/src/node_walk/analysis/python/__init__.py +10 -0
  13. node_walk-0.1.0/src/node_walk/analysis/python/analyzer.py +44 -0
  14. node_walk-0.1.0/src/node_walk/analysis/python/scope.py +44 -0
  15. node_walk-0.1.0/src/node_walk/analysis/python/visitor.py +559 -0
  16. node_walk-0.1.0/src/node_walk/analysis/python_analyzer.py +14 -0
  17. node_walk-0.1.0/src/node_walk/cli/__init__.py +1 -0
  18. node_walk-0.1.0/src/node_walk/cli/main.py +560 -0
  19. node_walk-0.1.0/src/node_walk/indexer.py +188 -0
  20. node_walk-0.1.0/src/node_walk/ir/__init__.py +39 -0
  21. node_walk-0.1.0/src/node_walk/ir/enums.py +61 -0
  22. node_walk-0.1.0/src/node_walk/ir/models.py +100 -0
  23. node_walk-0.1.0/src/node_walk/query/__init__.py +1 -0
  24. node_walk-0.1.0/src/node_walk/query/engine.py +368 -0
  25. node_walk-0.1.0/src/node_walk/storage/__init__.py +13 -0
  26. node_walk-0.1.0/src/node_walk/storage/base.py +79 -0
  27. node_walk-0.1.0/src/node_walk/storage/repository.py +14 -0
  28. node_walk-0.1.0/src/node_walk/storage/schema.py +130 -0
  29. node_walk-0.1.0/src/node_walk/storage/sqlite_store.py +285 -0
  30. node_walk-0.1.0/tests/fixtures/nested_project/base.py +19 -0
  31. node_walk-0.1.0/tests/fixtures/nested_project/impl.py +15 -0
  32. node_walk-0.1.0/tests/fixtures/simple_project/services.py +49 -0
  33. node_walk-0.1.0/tests/test_ir.py +107 -0
  34. node_walk-0.1.0/tests/test_python_analyzer.py +108 -0
  35. node_walk-0.1.0/tests/test_query_engine.py +131 -0
  36. node_walk-0.1.0/tests/test_storage.py +131 -0
@@ -0,0 +1,66 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ "main", "master" ]
6
+ pull_request:
7
+ branches: [ "main", "master" ]
8
+
9
+ jobs:
10
+ test:
11
+ name: Test (Python ${{ matrix.python-version }} on ${{ matrix.os }})
12
+ runs-on: ${{ matrix.os }}
13
+ strategy:
14
+ fail-fast: false
15
+ matrix:
16
+ os: [ubuntu-latest, windows-latest, macos-latest]
17
+ python-version: ["3.11", "3.12"]
18
+
19
+ steps:
20
+ - name: Check out repository
21
+ uses: actions/checkout@v4
22
+
23
+ - name: Set up Python ${{ matrix.python-version }}
24
+ uses: actions/setup-python@v5
25
+ with:
26
+ python-version: ${{ matrix.python-version }}
27
+ cache: "pip"
28
+
29
+ - name: Install dependencies
30
+ run: |
31
+ python -m pip install --upgrade pip
32
+ pip install -e ".[dev]"
33
+
34
+ - name: Run test suite with pytest
35
+ run: |
36
+ pytest --cov=node_walk --cov-report=term-missing --cov-report=xml
37
+
38
+ - name: Upload coverage artifact
39
+ uses: actions/upload-artifact@v4
40
+ if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
41
+ with:
42
+ name: coverage-report
43
+ path: coverage.xml
44
+
45
+ build-check:
46
+ name: Verify Package Build
47
+ runs-on: ubuntu-latest
48
+ steps:
49
+ - name: Check out repository
50
+ uses: actions/checkout@v4
51
+
52
+ - name: Set up Python
53
+ uses: actions/setup-python@v5
54
+ with:
55
+ python-version: "3.11"
56
+
57
+ - name: Install build tools
58
+ run: |
59
+ python -m pip install --upgrade pip
60
+ pip install build twine
61
+
62
+ - name: Build package distributions (sdist & wheel)
63
+ run: python -m build
64
+
65
+ - name: Check distribution artifacts
66
+ run: twine check dist/*
@@ -0,0 +1,103 @@
1
+ name: Release & Publish
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ target:
7
+ description: "Target repository to publish to"
8
+ required: true
9
+ default: "pypi"
10
+ type: choice
11
+ options:
12
+ - "pypi"
13
+ - "testpypi"
14
+ create_github_release:
15
+ description: "Create a GitHub Release with built distribution assets"
16
+ required: false
17
+ default: true
18
+ type: boolean
19
+ is_prerelease:
20
+ description: "Mark GitHub Release as pre-release"
21
+ required: false
22
+ default: false
23
+ type: boolean
24
+
25
+ jobs:
26
+ build:
27
+ name: Build source and binary distribution
28
+ runs-on: ubuntu-latest
29
+ steps:
30
+ - name: Check out repository
31
+ uses: actions/checkout@v4
32
+
33
+ - name: Set up Python
34
+ uses: actions/setup-python@v5
35
+ with:
36
+ python-version: "3.11"
37
+
38
+ - name: Install build
39
+ run: |
40
+ python -m pip install --upgrade pip
41
+ pip install build
42
+
43
+ - name: Build distributions
44
+ run: python -m build
45
+
46
+ - name: Store distribution packages
47
+ uses: actions/upload-artifact@v4
48
+ with:
49
+ name: python-package-distributions
50
+ path: dist/
51
+
52
+ publish:
53
+ name: Publish distribution
54
+ needs: [build]
55
+ runs-on: ubuntu-latest
56
+ environment:
57
+ name: ${{ inputs.target }}
58
+ url: ${{ inputs.target == 'testpypi' && 'https://test.pypi.org/p/node-walk' || 'https://pypi.org/p/node-walk' }}
59
+ permissions:
60
+ id-token: write # Required for Trusted Publishing (OIDC)
61
+
62
+ steps:
63
+ - name: Download distribution packages
64
+ uses: actions/download-artifact@v4
65
+ with:
66
+ name: python-package-distributions
67
+ path: dist/
68
+
69
+ - name: Publish to PyPI / TestPyPI
70
+ uses: pypa/gh-action-pypi-publish@release/v1
71
+ with:
72
+ repository-url: ${{ inputs.target == 'testpypi' && 'https://test.pypi.org/legacy/' || '' }}
73
+ skip-existing: true
74
+
75
+ github-release:
76
+ name: Create GitHub Release
77
+ needs: [build]
78
+ if: inputs.create_github_release
79
+ runs-on: ubuntu-latest
80
+ permissions:
81
+ contents: write
82
+
83
+ steps:
84
+ - name: Download distribution packages
85
+ uses: actions/download-artifact@v4
86
+ with:
87
+ name: python-package-distributions
88
+ path: dist/
89
+
90
+ - name: Extract package version from distribution filename
91
+ id: get_version
92
+ run: |
93
+ FILE=$(ls dist/*.whl | head -n 1)
94
+ VERSION=$(basename "$FILE" | sed -E 's/.*-([0-9]+\.[0-9]+\.[0-9]+[a-zA-Z0-9._]*)-.*/\1/')
95
+ echo "version=v$VERSION" >> $GITHUB_OUTPUT
96
+
97
+ - name: Create GitHub Release
98
+ uses: softprops/action-gh-release@v2
99
+ with:
100
+ tag_name: ${{ steps.get_version.outputs.version }}
101
+ files: dist/*
102
+ generate_release_notes: true
103
+ prerelease: ${{ inputs.is_prerelease }}
@@ -0,0 +1,222 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ # Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ # poetry.lock
109
+ # poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ # pdm.lock
116
+ # pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ # pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # Redis
135
+ *.rdb
136
+ *.aof
137
+ *.pid
138
+
139
+ # RabbitMQ
140
+ mnesia/
141
+ rabbitmq/
142
+ rabbitmq-data/
143
+
144
+ # ActiveMQ
145
+ activemq-data/
146
+
147
+ # SageMath parsed files
148
+ *.sage.py
149
+
150
+ # Environments
151
+ .env
152
+ .envrc
153
+ .venv
154
+ env/
155
+ venv/
156
+ ENV/
157
+ env.bak/
158
+ venv.bak/
159
+
160
+ # Spyder project settings
161
+ .spyderproject
162
+ .spyproject
163
+
164
+ # Rope project settings
165
+ .ropeproject
166
+
167
+ # mkdocs documentation
168
+ /site
169
+
170
+ # mypy
171
+ .mypy_cache/
172
+ .dmypy.json
173
+ dmypy.json
174
+
175
+ # Pyre type checker
176
+ .pyre/
177
+
178
+ # pytype static type analyzer
179
+ .pytype/
180
+
181
+ # Cython debug symbols
182
+ cython_debug/
183
+
184
+ # PyCharm
185
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
186
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
187
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
188
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
189
+ # .idea/
190
+
191
+ # Abstra
192
+ # Abstra is an AI-powered process automation framework.
193
+ # Ignore directories containing user credentials, local state, and settings.
194
+ # Learn more at https://abstra.io/docs
195
+ .abstra/
196
+
197
+ # Visual Studio Code
198
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
199
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
200
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
201
+ # you could uncomment the following to ignore the entire vscode folder
202
+ # .vscode/
203
+ # Temporary file for partial code execution
204
+ tempCodeRunnerFile.py
205
+
206
+ # Ruff stuff:
207
+ .ruff_cache/
208
+
209
+ # PyPI configuration file
210
+ .pypirc
211
+
212
+ # Marimo
213
+ marimo/_static/
214
+ marimo/_lsp/
215
+ __marimo__/
216
+
217
+ # Streamlit
218
+ .streamlit/secrets.toml
219
+
220
+ # CodeGraph — generated graph databases
221
+ .codegraph/
222
+ *.db
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Shriram Naik
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,107 @@
1
+ Metadata-Version: 2.5
2
+ Name: node-walk
3
+ Version: 0.1.0
4
+ Summary: Semantic code intelligence — local-first graph of your codebase for humans and LLMs
5
+ Author: CodeGraph Contributors
6
+ License: MIT
7
+ License-File: LICENSE
8
+ Keywords: code-analysis,developer-tools,llm,semantic-graph
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Requires-Python: >=3.11
15
+ Requires-Dist: pydantic>=2.0.0
16
+ Requires-Dist: rich>=13.0.0
17
+ Requires-Dist: tree-sitter-python>=0.23.0
18
+ Requires-Dist: tree-sitter>=0.23.0
19
+ Requires-Dist: typer>=0.12.0
20
+ Provides-Extra: dev
21
+ Requires-Dist: pytest-cov>=5.0.0; extra == 'dev'
22
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
23
+ Description-Content-Type: text/markdown
24
+
25
+ # CodeGraph
26
+
27
+ **Semantic code intelligence for humans and LLMs.**
28
+
29
+ Local-first · Lightweight · Python first · SQLite backed
30
+
31
+ ---
32
+
33
+ ## Quickstart
34
+
35
+ ### 1. Install & Setup
36
+ ```bash
37
+ # Clone and setup the environment
38
+ git clone <repo-url> CodeGraph
39
+ cd CodeGraph
40
+ python -m venv .venv
41
+ .venv\Scripts\activate # Windows (or source .venv/bin/activate on Unix)
42
+ pip install -e ".[dev]"
43
+ ```
44
+
45
+ ### 2. Indexing and Querying
46
+ All CLI commands discover the graph database by searching for a `.node_walk/` directory in the current directory or walking up parent directories.
47
+
48
+ **To index any directory:**
49
+ ```bash
50
+ # Activate CodeGraph venv, then go to the repository you want to index
51
+ cd /path/to/your/project
52
+ node_walk index .
53
+ ```
54
+
55
+ **Run queries within that project's directory:**
56
+ ```bash
57
+ # Find a symbol
58
+ node_walk find UserService
59
+
60
+ # See its definition
61
+ node_walk definition UserService
62
+
63
+ # Find callers (shows interactive picker if multiple symbols match)
64
+ node_walk callers UserService.create_user
65
+
66
+ # Trace outgoing dependencies (out-edges)
67
+ node_walk trace UserService.create_user --depth 5
68
+
69
+ # Blast radius (in-edges - what breaks if this changes?)
70
+ node_walk blast-radius UserService.create_user
71
+
72
+ # View source code of a symbol
73
+ node_walk source UserService.create_user
74
+
75
+ # Graph statistics
76
+ node_walk stats
77
+
78
+ # Export to JSON
79
+ node_walk export --output graph.json
80
+ ```
81
+
82
+
83
+ ## Architecture
84
+
85
+ ```
86
+ Repository → Language Analysis → Code IR → SQLite Graph → Query Engine → CLI
87
+ ```
88
+
89
+ - **Language analysis**: Tree-sitter based Python parser
90
+ - **Code IR**: Pydantic v2 models — Symbol, Relationship, FileInfo
91
+ - **Storage**: SQLite with 10 indexes, WAL mode
92
+ - **Query engine**: Pure SQLite including recursive CTEs for graph traversal
93
+ - **CLI**: Typer + Rich
94
+
95
+ ## Development
96
+
97
+ ```bash
98
+ python -m venv .venv
99
+ .venv\Scripts\activate # Windows
100
+ pip install -e ".[dev]"
101
+ pytest tests/ -v
102
+ ```
103
+
104
+ ## Graph data
105
+
106
+ Stored in `.node_walk/graph.db` inside the indexed repository.
107
+ Safe to delete and re-index at any time.
@@ -0,0 +1,83 @@
1
+ # CodeGraph
2
+
3
+ **Semantic code intelligence for humans and LLMs.**
4
+
5
+ Local-first · Lightweight · Python first · SQLite backed
6
+
7
+ ---
8
+
9
+ ## Quickstart
10
+
11
+ ### 1. Install & Setup
12
+ ```bash
13
+ # Clone and setup the environment
14
+ git clone <repo-url> CodeGraph
15
+ cd CodeGraph
16
+ python -m venv .venv
17
+ .venv\Scripts\activate # Windows (or source .venv/bin/activate on Unix)
18
+ pip install -e ".[dev]"
19
+ ```
20
+
21
+ ### 2. Indexing and Querying
22
+ All CLI commands discover the graph database by searching for a `.node_walk/` directory in the current directory or walking up parent directories.
23
+
24
+ **To index any directory:**
25
+ ```bash
26
+ # Activate CodeGraph venv, then go to the repository you want to index
27
+ cd /path/to/your/project
28
+ node_walk index .
29
+ ```
30
+
31
+ **Run queries within that project's directory:**
32
+ ```bash
33
+ # Find a symbol
34
+ node_walk find UserService
35
+
36
+ # See its definition
37
+ node_walk definition UserService
38
+
39
+ # Find callers (shows interactive picker if multiple symbols match)
40
+ node_walk callers UserService.create_user
41
+
42
+ # Trace outgoing dependencies (out-edges)
43
+ node_walk trace UserService.create_user --depth 5
44
+
45
+ # Blast radius (in-edges - what breaks if this changes?)
46
+ node_walk blast-radius UserService.create_user
47
+
48
+ # View source code of a symbol
49
+ node_walk source UserService.create_user
50
+
51
+ # Graph statistics
52
+ node_walk stats
53
+
54
+ # Export to JSON
55
+ node_walk export --output graph.json
56
+ ```
57
+
58
+
59
+ ## Architecture
60
+
61
+ ```
62
+ Repository → Language Analysis → Code IR → SQLite Graph → Query Engine → CLI
63
+ ```
64
+
65
+ - **Language analysis**: Tree-sitter based Python parser
66
+ - **Code IR**: Pydantic v2 models — Symbol, Relationship, FileInfo
67
+ - **Storage**: SQLite with 10 indexes, WAL mode
68
+ - **Query engine**: Pure SQLite including recursive CTEs for graph traversal
69
+ - **CLI**: Typer + Rich
70
+
71
+ ## Development
72
+
73
+ ```bash
74
+ python -m venv .venv
75
+ .venv\Scripts\activate # Windows
76
+ pip install -e ".[dev]"
77
+ pytest tests/ -v
78
+ ```
79
+
80
+ ## Graph data
81
+
82
+ Stored in `.node_walk/graph.db` inside the indexed repository.
83
+ Safe to delete and re-index at any time.