codeanalyzer-python 0.1.14__py3-none-any.whl → 0.2.0__py3-none-any.whl

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.
@@ -1,392 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: codeanalyzer-python
3
- Version: 0.1.14
4
- Summary: Static Analysis on Python source code using Jedi, CodeQL and Treesitter.
5
- Author-email: Rahul Krishna <i.m.ralk@gmail.com>
6
- License-File: LICENSE
7
- License-File: NOTICE
8
- Requires-Python: >=3.9
9
- Requires-Dist: jedi<0.20.0,>=0.18.0; python_version < '3.11'
10
- Requires-Dist: jedi<=0.19.2; python_version >= '3.11'
11
- Requires-Dist: msgpack<1.0.7,>=1.0.0; python_version < '3.11'
12
- Requires-Dist: msgpack<2.0.0,>=1.0.7; python_version >= '3.11'
13
- Requires-Dist: networkx<3.2.0,>=2.6.0; python_version < '3.11'
14
- Requires-Dist: networkx<4.0.0,>=3.0.0; python_version >= '3.11'
15
- Requires-Dist: numpy<1.24.0,>=1.21.0; python_version < '3.11'
16
- Requires-Dist: numpy<2.0.0,>=1.24.0; python_version >= '3.11' and python_version < '3.12'
17
- Requires-Dist: numpy<2.0.0,>=1.26.0; python_version >= '3.12'
18
- Requires-Dist: packaging>=25.0
19
- Requires-Dist: pandas<2.0.0,>=1.3.0; python_version < '3.11'
20
- Requires-Dist: pandas<3.0.0,>=2.0.0; python_version >= '3.11'
21
- Requires-Dist: pydantic<2.0.0,>=1.8.0; python_version < '3.11'
22
- Requires-Dist: pydantic<3.0.0,>=2.0.0; python_version >= '3.11'
23
- Requires-Dist: ray<3.0.0,>=2.10.0; python_version >= '3.11'
24
- Requires-Dist: ray==2.0.0; python_version < '3.11'
25
- Requires-Dist: requests<3.0.0,>=2.20.0; python_version >= '3.11'
26
- Requires-Dist: rich<14.0.0,>=12.6.0; python_version < '3.11'
27
- Requires-Dist: rich<15.0.0,>=14.0.0; python_version >= '3.11'
28
- Requires-Dist: typer<1.0.0,>=0.9.0; python_version < '3.11'
29
- Requires-Dist: typer<2.0.0,>=0.9.0; python_version >= '3.11'
30
- Requires-Dist: typing-extensions<5.0.0,>=4.0.0; python_version < '3.11'
31
- Requires-Dist: typing-extensions<6.0.0,>=4.5.0; python_version >= '3.11'
32
- Description-Content-Type: text/markdown
33
-
34
- ![logo](https://github.com/codellm-devkit/codeanalyzer-python/blob/main/docs/assets/logo.png?raw=true)
35
-
36
- # A Python Static Analysis Toolkit (and Library)
37
-
38
- A comprehensive static analysis tool for Python source code that provides symbol table generation, call graph analysis, and semantic analysis using Jedi, CodeQL, and Tree-sitter.
39
-
40
- ## Installation
41
-
42
- ```bash
43
- pip install codeanalyzer-python
44
- ```
45
-
46
- ### Prerequisites
47
-
48
- - Python 3.12 or higher
49
-
50
- #### System Package Requirements
51
-
52
- The tool creates virtual environments internally using Python's built-in `venv` module.
53
-
54
- **Ubuntu/Debian systems:**
55
- ```bash
56
- sudo apt update
57
- sudo apt install python3.12-venv python3-dev build-essential
58
- ```
59
-
60
- **Fedora/RHEL/CentOS systems:**
61
- ```bash
62
- sudo dnf group install "Development Tools"
63
- sudo dnf install python3-pip python3-venv python3-devel
64
- ```
65
- or on older versions:
66
- ```bash
67
- sudo yum groupinstall "Development Tools"
68
- sudo yum install python3-pip python3-venv python3-devel
69
- ```
70
-
71
- **macOS systems:**
72
- ```bash
73
- # Install Xcode Command Line Tools (for compilation)
74
- xcode-select --install
75
-
76
- # If using Homebrew Python (recommended)
77
- brew install python@3.12
78
-
79
- # If using pyenv (popular Python version manager)
80
- # First ensure pyenv is properly installed and configured
81
- pyenv install 3.12.0 # or latest 3.12.x version
82
- pyenv global 3.12.0 # or pyenv local 3.12.0 for project-specific
83
-
84
- # If using system Python, you may need to install certificates
85
- /Applications/Python\ 3.12/Install\ Certificates.command
86
- ```
87
-
88
- > **Note:** These packages are required as the tool uses Python's built-in `venv` module to create isolated environments for analysis.
89
-
90
- ## Usage
91
-
92
- The codeanalyzer provides a command-line interface for performing static analysis on Python projects.
93
-
94
- ### Basic Usage
95
-
96
- ```bash
97
- codeanalyzer --input /path/to/python/project
98
- ```
99
-
100
- ### Command Line Options
101
-
102
- To view the available options and commands, run `codeanalyzer --help`. You should see output similar to the following:
103
-
104
- ```bash
105
- ❯ codeanalyzer --help
106
-
107
- Usage: codeanalyzer [OPTIONS] COMMAND [ARGS]...
108
-
109
- Static Analysis on Python source code using Jedi, CodeQL and Tree sitter.
110
-
111
-
112
- ╭─ Options ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
113
- │ * --input -i PATH Path to the project root directory. [default: None] [required] │
114
- │ --output -o PATH Output directory for artifacts. [default: None] │
115
- │ --format -f [json|msgpack] Output format: json or msgpack. [default: json] │
116
- │ --codeql --no-codeql Enable CodeQL-based analysis. [default: no-codeql] │
117
- │ --eager --lazy Enable eager or lazy analysis. Defaults to lazy. [default: lazy] │
118
- │ --cache-dir -c PATH Directory to store analysis cache. [default: None] │
119
- │ --clear-cache --keep-cache Clear cache after analysis. [default: clear-cache] │
120
- │ -v INTEGER Increase verbosity: -v, -vv, -vvv [default: 0] │
121
- │ --help Show this message and exit. │
122
- ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
123
- ```
124
-
125
- ### Examples
126
-
127
- 1. **Basic analysis with symbol table:**
128
- ```bash
129
- codeanalyzer --input ./my-python-project
130
- ```
131
-
132
- This will print the symbol table to stdout in JSON format to the standard output. If you want to save the output, you can use the `--output` option.
133
-
134
- ```bash
135
- codeanalyzer --input ./my-python-project --output /path/to/analysis-results
136
- ```
137
-
138
- Now, you can find the analysis results in `analysis.json` in the specified directory.
139
-
140
- 2. **Change output format to msgpack:**
141
- ```bash
142
- codeanalyzer --input ./my-python-project --output /path/to/analysis-results --format msgpack
143
- ```
144
-
145
- This will save the analysis results in `analysis.msgpack` in the specified directory.
146
-
147
- 3. **Analysis with CodeQL enabled:**
148
- ```bash
149
- codeanalyzer --input ./my-python-project --codeql
150
- ```
151
- Every run produces a symbol table **and** a call graph. By default, edges come from Jedi's lexical analysis. Adding `--codeql` resolves additional edges (including RPC / third-party / dynamically-dispatched targets) and merges them with the Jedi-derived edges. CodeQL also backfills resolved callees on Jedi-emitted call sites where Jedi couldn't resolve them.
152
-
153
- ***Note: CodeQL integration is experimental. The CLI is downloaded into `<cache_dir>/codeql/` on first use and reused thereafter.***
154
-
155
- 4. **Eager analysis with custom cache directory:**
156
- ```bash
157
- codeanalyzer --input ./my-python-project --eager --cache-dir /path/to/custom-cache
158
- ```
159
- This will rebuild the analysis cache at every run and store it in `/path/to/custom-cache/.codeanalyzer`. The cache will be cleared by default after analysis unless you specify `--keep-cache`.
160
-
161
- If you provide --cache-dir, the cache will be stored in that directory. If not specified, it defaults to `.codeanalyzer` in the current working directory (`$PWD`).
162
-
163
- 5. **Quiet mode (minimal output):**
164
- ```bash
165
- codeanalyzer --input /path/to/my-python-project --quiet
166
- ```
167
-
168
- ## Output
169
-
170
- By default, analysis results are printed to stdout in JSON format. When using the `--output` option, results are saved to `analysis.json` in the specified directory. If you use the `--format=msgpack` option, the results will be saved in `analysis.msgpack`, which is a binary format that can be more efficient for storage and transmission.
171
-
172
- ## Development
173
-
174
- This project uses [uv](https://docs.astral.sh/uv/) for dependency management during development.
175
-
176
- ### Development Setup
177
-
178
- 1. Install [uv](https://docs.astral.sh/uv/getting-started/installation/)
179
- ![logo](https://github.com/codellm-devkit/codeanalyzer-python/blob/main/docs/assets/logo.png?raw=true)
180
-
181
- # A Python Static Analysis Toolkit (and Library)
182
-
183
- A comprehensive static analysis tool for Python source code that provides symbol table generation, call graph analysis, and semantic analysis using Jedi, CodeQL, and Tree-sitter.
184
-
185
- ## Installation
186
-
187
- ```bash
188
- pip install codeanalyzer-python
189
- ```
190
-
191
- ### Prerequisites
192
-
193
- - Python 3.12 or higher
194
-
195
- #### System Package Requirements
196
-
197
- The tool creates virtual environments internally using Python's built-in `venv` module.
198
-
199
- **Ubuntu/Debian systems:**
200
- ```bash
201
- sudo apt update
202
- sudo apt install python3.12-venv python3-dev build-essential
203
- ```
204
-
205
- **Fedora/RHEL/CentOS systems:**
206
- ```bash
207
- sudo dnf group install "Development Tools"
208
- sudo dnf install python3-pip python3-venv python3-devel
209
- ```
210
- or on older versions:
211
- ```bash
212
- sudo yum groupinstall "Development Tools"
213
- sudo yum install python3-pip python3-venv python3-devel
214
- ```
215
-
216
- **macOS systems:**
217
- ```bash
218
- # Install Xcode Command Line Tools (for compilation)
219
- xcode-select --install
220
-
221
- # If using Homebrew Python (recommended)
222
- brew install python@3.12
223
-
224
- # If using pyenv (popular Python version manager)
225
- # First ensure pyenv is properly installed and configured
226
- pyenv install 3.12.0 # or latest 3.12.x version
227
- pyenv global 3.12.0 # or pyenv local 3.12.0 for project-specific
228
-
229
- # If using system Python, you may need to install certificates
230
- /Applications/Python\ 3.12/Install\ Certificates.command
231
- ```
232
-
233
- > **Note:** These packages are required as the tool uses Python's built-in `venv` module to create isolated environments for analysis.
234
-
235
- ## Usage
236
-
237
- The codeanalyzer provides a command-line interface for performing static analysis on Python projects.
238
-
239
- ### Basic Usage
240
-
241
- ```bash
242
- codeanalyzer --input /path/to/python/project
243
- ```
244
-
245
- ### Command Line Options
246
-
247
- To view the available options and commands, run `codeanalyzer --help`. You should see output similar to the following:
248
-
249
- ```bash
250
- ❯ codeanalyzer --help
251
-
252
- Usage: codeanalyzer [OPTIONS] COMMAND [ARGS]...
253
-
254
- Static Analysis on Python source code using Jedi, CodeQL and Tree sitter.
255
-
256
-
257
- ╭─ Options ──────────────────────────────────────────────────────────────────────────────────────────────────────────╮
258
- │ * --input -i PATH Path to the project root directory. [default: None] [required] │
259
- │ --output -o PATH Output directory for artifacts. [default: None] │
260
- │ --format -f [json|msgpack] Output format: json or msgpack. [default: json]. │
261
- │ --codeql --no-codeql Enable CodeQL-based analysis. [default: no-codeql] │
262
- │ --eager --lazy Enable eager or lazy analysis. Defaults to lazy. [default: lazy] │
263
- │ --cache-dir -c PATH Directory to store analysis cache. [default: None] │
264
- │ --clear-cache --keep-cache Clear cache after analysis. [default: clear-cache] │
265
- │ -v INTEGER Increase verbosity: -v, -vv, -vvv [default: 0] │
266
- │ --help Show this message and exit. │
267
- ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
268
- ```
269
-
270
- ### Examples
271
-
272
- 1. **Basic analysis with symbol table:**
273
- ```bash
274
- codeanalyzer --input ./my-python-project
275
- ```
276
-
277
- This will print the symbol table to stdout in JSON format to the standard output. If you want to save the output, you can use the `--output` option.
278
-
279
- ```bash
280
- codeanalyzer --input ./my-python-project --output /path/to/analysis-results
281
- ```
282
-
283
- Now, you can find the analysis results in `analysis.json` in the specified directory.
284
-
285
- 2. **Analysis with CodeQL enabled:**
286
- ```bash
287
- codeanalyzer --input ./my-python-project --codeql
288
- ```
289
- Every run produces a symbol table **and** a call graph. By default, edges come from Jedi's lexical analysis. Adding `--codeql` resolves additional edges (including RPC / third-party / dynamically-dispatched targets) and merges them with the Jedi-derived edges. CodeQL also backfills resolved callees on Jedi-emitted call sites where Jedi couldn't resolve them.
290
-
291
- ***Note: CodeQL integration is experimental. The CLI is downloaded into `<cache_dir>/codeql/` on first use and reused thereafter.***
292
-
293
- 3. **Eager analysis with custom cache directory:**
294
- ```bash
295
- codeanalyzer --input ./my-python-project --eager --cache-dir /path/to/custom-cache
296
- ```
297
- This will rebuild the analysis cache at every run and store it in `/path/to/custom-cache/.codeanalyzer`. The cache will be cleared by default after analysis unless you specify `--keep-cache`.
298
-
299
- If you provide --cache-dir, the cache will be stored in that directory. If not specified, it defaults to `.codeanalyzer` in the current working directory (`$PWD`).
300
-
301
- 4. **Save output in msgpack format:**
302
- ```bash
303
- codeanalyzer --input ./my-python-project --output /path/to/analysis-results --format msgpack
304
- ```
305
-
306
- ### Output
307
-
308
- By default, analysis results are printed to stdout in JSON format. When using the `--output` option, results are saved to `analysis.json` in the specified directory.
309
-
310
- ## Development
311
-
312
- This project uses [uv](https://docs.astral.sh/uv/) for dependency management during development.
313
-
314
- ### Development Setup
315
-
316
- 1. Install [uv](https://docs.astral.sh/uv/getting-started/installation/)
317
-
318
- 2. Clone the repository:
319
- ```bash
320
- git clone https://github.com/codellm-devkit/codeanalyzer-python
321
- cd codeanalyzer-python
322
- ```
323
-
324
- 3. Install dependencies using uv:
325
- ```bash
326
- uv sync --all-groups
327
- ```
328
- This will install all dependencies including development and test dependencies.
329
-
330
- ### Running from Source
331
-
332
- When developing, you can run the tool directly from source:
333
-
334
- ```bash
335
- uv run codeanalyzer --input /path/to/python/project
336
- ```
337
-
338
- ### Running Tests
339
-
340
- ```bash
341
- uv run pytest --pspec -s
342
- ```
343
-
344
- ### Development Dependencies
345
-
346
- The project includes additional dependency groups for development:
347
-
348
- - **test**: pytest and related testing tools
349
- - **dev**: development tools like ipdb
350
-
351
- Install all groups with:
352
- ```bash
353
- uv sync --all-groups
354
- ```
355
-
356
- 2. Clone the repository:
357
- ```bash
358
- git clone https://github.com/codellm-devkit/codeanalyzer-python
359
- cd codeanalyzer-python
360
- ```
361
-
362
- 3. Install dependencies using uv:
363
- ```bash
364
- uv sync --all-groups
365
- ```
366
- This will install all dependencies including development and test dependencies.
367
-
368
- ### Running from Source
369
-
370
- When developing, you can run the tool directly from source:
371
-
372
- ```bash
373
- uv run codeanalyzer --input /path/to/python/project
374
- ```
375
-
376
- ### Running Tests
377
-
378
- ```bash
379
- uv run pytest --pspec -s
380
- ```
381
-
382
- ### Development Dependencies
383
-
384
- The project includes additional dependency groups for development:
385
-
386
- - **test**: pytest and related testing tools
387
- - **dev**: development tools like ipdb
388
-
389
- Install all groups with:
390
- ```bash
391
- uv sync --all-groups
392
- ```
@@ -1,2 +0,0 @@
1
- [console_scripts]
2
- codeanalyzer = codeanalyzer.__main__:app