codeanalyzer-python 0.1.13__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,414 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: codeanalyzer-python
3
- Version: 0.1.13
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
- │ --analysis-level -a INTEGER 1: symbol table, 2: call graph. [default: 1] │
117
- │ --codeql --no-codeql Enable CodeQL-based analysis. [default: no-codeql] │
118
- │ --eager --lazy Enable eager or lazy analysis. Defaults to lazy. [default: lazy] │
119
- │ --cache-dir -c PATH Directory to store analysis cache. [default: None] │
120
- │ --clear-cache --keep-cache Clear cache after analysis. [default: clear-cache] │
121
- │ -v INTEGER Increase verbosity: -v, -vv, -vvv [default: 0] │
122
- │ --help Show this message and exit. │
123
- ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
124
- ```
125
-
126
- ### Examples
127
-
128
- 1. **Basic analysis with symbol table:**
129
- ```bash
130
- codeanalyzer --input ./my-python-project
131
- ```
132
-
133
- 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.
134
-
135
- ```bash
136
- codeanalyzer --input ./my-python-project --output /path/to/analysis-results
137
- ```
138
-
139
- Now, you can find the analysis results in `analysis.json` in the specified directory.
140
-
141
- 2. **Change output format to msgpack:**
142
- ```bash
143
- codeanalyzer --input ./my-python-project --output /path/to/analysis-results --format msgpack
144
- ```
145
-
146
- This will save the analysis results in `analysis.msgpack` in the specified directory.
147
-
148
- 3. **Toggle analysis levels with `--analysis-level`:**
149
- ```bash
150
- codeanalyzer --input ./my-python-project --analysis-level 1 # Symbol table only
151
- ```
152
- Call graph analysis can be enabled by setting the level to `2`:
153
- ```bash
154
- codeanalyzer --input ./my-python-project --analysis-level 2 # Symbol table + Call graph
155
- ```
156
- ***Note: The `--analysis-level=2` is not yet implemented in this version.***
157
-
158
- 4. **Analysis with CodeQL enabled:**
159
- ```bash
160
- codeanalyzer --input ./my-python-project --codeql
161
- ```
162
- This will perform CodeQL-based analysis in addition to the standard symbol table generation.
163
-
164
- ***Note: Not yet fully implemented. Please refrain from using this option until further notice.***
165
-
166
- 5. **Eager analysis with custom cache directory:**
167
- ```bash
168
- codeanalyzer --input ./my-python-project --eager --cache-dir /path/to/custom-cache
169
- ```
170
- 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`.
171
-
172
- 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`).
173
-
174
- 6. **Quiet mode (minimal output):**
175
- ```bash
176
- codeanalyzer --input /path/to/my-python-project --quiet
177
- ```
178
-
179
- ## Output
180
-
181
- 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.
182
-
183
- ## Development
184
-
185
- This project uses [uv](https://docs.astral.sh/uv/) for dependency management during development.
186
-
187
- ### Development Setup
188
-
189
- 1. Install [uv](https://docs.astral.sh/uv/getting-started/installation/)
190
- ![logo](https://github.com/codellm-devkit/codeanalyzer-python/blob/main/docs/assets/logo.png?raw=true)
191
-
192
- # A Python Static Analysis Toolkit (and Library)
193
-
194
- 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.
195
-
196
- ## Installation
197
-
198
- ```bash
199
- pip install codeanalyzer-python
200
- ```
201
-
202
- ### Prerequisites
203
-
204
- - Python 3.12 or higher
205
-
206
- #### System Package Requirements
207
-
208
- The tool creates virtual environments internally using Python's built-in `venv` module.
209
-
210
- **Ubuntu/Debian systems:**
211
- ```bash
212
- sudo apt update
213
- sudo apt install python3.12-venv python3-dev build-essential
214
- ```
215
-
216
- **Fedora/RHEL/CentOS systems:**
217
- ```bash
218
- sudo dnf group install "Development Tools"
219
- sudo dnf install python3-pip python3-venv python3-devel
220
- ```
221
- or on older versions:
222
- ```bash
223
- sudo yum groupinstall "Development Tools"
224
- sudo yum install python3-pip python3-venv python3-devel
225
- ```
226
-
227
- **macOS systems:**
228
- ```bash
229
- # Install Xcode Command Line Tools (for compilation)
230
- xcode-select --install
231
-
232
- # If using Homebrew Python (recommended)
233
- brew install python@3.12
234
-
235
- # If using pyenv (popular Python version manager)
236
- # First ensure pyenv is properly installed and configured
237
- pyenv install 3.12.0 # or latest 3.12.x version
238
- pyenv global 3.12.0 # or pyenv local 3.12.0 for project-specific
239
-
240
- # If using system Python, you may need to install certificates
241
- /Applications/Python\ 3.12/Install\ Certificates.command
242
- ```
243
-
244
- > **Note:** These packages are required as the tool uses Python's built-in `venv` module to create isolated environments for analysis.
245
-
246
- ## Usage
247
-
248
- The codeanalyzer provides a command-line interface for performing static analysis on Python projects.
249
-
250
- ### Basic Usage
251
-
252
- ```bash
253
- codeanalyzer --input /path/to/python/project
254
- ```
255
-
256
- ### Command Line Options
257
-
258
- To view the available options and commands, run `codeanalyzer --help`. You should see output similar to the following:
259
-
260
- ```bash
261
- ❯ codeanalyzer --help
262
-
263
- Usage: codeanalyzer [OPTIONS] COMMAND [ARGS]...
264
-
265
- Static Analysis on Python source code using Jedi, CodeQL and Tree sitter.
266
-
267
-
268
- ╭─ Options ──────────────────────────────────────────────────────────────────────────────────────────────────────────╮
269
- │ * --input -i PATH Path to the project root directory. [default: None] [required] │
270
- │ --output -o PATH Output directory for artifacts. [default: None] │
271
- │ --format -f [json|msgpack] Output format: json or msgpack. [default: json]. │
272
- │ --analysis-level -a INTEGER 1: symbol table, 2: call graph. [default: 1] │
273
- │ --codeql --no-codeql Enable CodeQL-based analysis. [default: no-codeql] │
274
- │ --eager --lazy Enable eager or lazy analysis. Defaults to lazy. [default: lazy] │
275
- │ --cache-dir -c PATH Directory to store analysis cache. [default: None] │
276
- │ --clear-cache --keep-cache Clear cache after analysis. [default: clear-cache] │
277
- │ -v INTEGER Increase verbosity: -v, -vv, -vvv [default: 0] │
278
- │ --help Show this message and exit. │
279
- ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
280
- ```
281
-
282
- ### Examples
283
-
284
- 1. **Basic analysis with symbol table:**
285
- ```bash
286
- codeanalyzer --input ./my-python-project
287
- ```
288
-
289
- 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.
290
-
291
- ```bash
292
- codeanalyzer --input ./my-python-project --output /path/to/analysis-results
293
- ```
294
-
295
- Now, you can find the analysis results in `analysis.json` in the specified directory.
296
-
297
- 2. **Toggle analysis levels with `--analysis-level`:**
298
- ```bash
299
- codeanalyzer --input ./my-python-project --analysis-level 1 # Symbol table only
300
- ```
301
- Call graph analysis can be enabled by setting the level to `2`:
302
- ```bash
303
- codeanalyzer --input ./my-python-project --analysis-level 2 # Symbol table + Call graph
304
- ```
305
- ***Note: The `--analysis-level=2` is not yet implemented in this version.***
306
-
307
- 3. **Analysis with CodeQL enabled:**
308
- ```bash
309
- codeanalyzer --input ./my-python-project --codeql
310
- ```
311
- This will perform CodeQL-based analysis in addition to the standard symbol table generation.
312
-
313
- ***Note: Not yet fully implemented. Please refrain from using this option until further notice.***
314
-
315
- 4. **Eager analysis with custom cache directory:**
316
- ```bash
317
- codeanalyzer --input ./my-python-project --eager --cache-dir /path/to/custom-cache
318
- ```
319
- 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`.
320
-
321
- 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`).
322
-
323
- 5. **Save output in msgpack format:**
324
- ```bash
325
- codeanalyzer --input ./my-python-project --output /path/to/analysis-results --format msgpack
326
- ```
327
-
328
- ### Output
329
-
330
- 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.
331
-
332
- ## Development
333
-
334
- This project uses [uv](https://docs.astral.sh/uv/) for dependency management during development.
335
-
336
- ### Development Setup
337
-
338
- 1. Install [uv](https://docs.astral.sh/uv/getting-started/installation/)
339
-
340
- 2. Clone the repository:
341
- ```bash
342
- git clone https://github.com/codellm-devkit/codeanalyzer-python
343
- cd codeanalyzer-python
344
- ```
345
-
346
- 3. Install dependencies using uv:
347
- ```bash
348
- uv sync --all-groups
349
- ```
350
- This will install all dependencies including development and test dependencies.
351
-
352
- ### Running from Source
353
-
354
- When developing, you can run the tool directly from source:
355
-
356
- ```bash
357
- uv run codeanalyzer --input /path/to/python/project
358
- ```
359
-
360
- ### Running Tests
361
-
362
- ```bash
363
- uv run pytest --pspec -s
364
- ```
365
-
366
- ### Development Dependencies
367
-
368
- The project includes additional dependency groups for development:
369
-
370
- - **test**: pytest and related testing tools
371
- - **dev**: development tools like ipdb
372
-
373
- Install all groups with:
374
- ```bash
375
- uv sync --all-groups
376
- ```
377
-
378
- 2. Clone the repository:
379
- ```bash
380
- git clone https://github.com/codellm-devkit/codeanalyzer-python
381
- cd codeanalyzer-python
382
- ```
383
-
384
- 3. Install dependencies using uv:
385
- ```bash
386
- uv sync --all-groups
387
- ```
388
- This will install all dependencies including development and test dependencies.
389
-
390
- ### Running from Source
391
-
392
- When developing, you can run the tool directly from source:
393
-
394
- ```bash
395
- uv run codeanalyzer --input /path/to/python/project
396
- ```
397
-
398
- ### Running Tests
399
-
400
- ```bash
401
- uv run pytest --pspec -s
402
- ```
403
-
404
- ### Development Dependencies
405
-
406
- The project includes additional dependency groups for development:
407
-
408
- - **test**: pytest and related testing tools
409
- - **dev**: development tools like ipdb
410
-
411
- Install all groups with:
412
- ```bash
413
- uv sync --all-groups
414
- ```
@@ -1,31 +0,0 @@
1
- codeanalyzer/__init__.py,sha256=BZ3Kuwl-F_F-8H8cepLnVJ4Ku4NNUjjqg0Y6ujPQSsI,108
2
- codeanalyzer/__main__.py,sha256=ddmdCJzPZTPqPNmun-Q0euxNxKwOzXKciS02TfeJRrY,5210
3
- codeanalyzer/core.py,sha256=P43skGiKUnQtkSQGHpPDgZrftAKP2HHh52g1N1Ww1S0,24503
4
- codeanalyzer/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- codeanalyzer/config/__init__.py,sha256=9XBxAn1oWGRuhg3bEBUuVGs3hFNXEAKrr-Ce7tq9a2k,61
6
- codeanalyzer/config/config.py,sha256=ZiKzc5uEUCIvih58-6BDtLLI1hPij41wGQjBcj9KNQM,188
7
- codeanalyzer/jedi/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
- codeanalyzer/jedi/jedi.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
- codeanalyzer/options/__init__.py,sha256=4kkwBiOrGjalrkfFF8EJgfgOtaPtD7HcCYfZgcOgelU,67
10
- codeanalyzer/options/options.py,sha256=PNdLUCF7kHfscSeeqbV6ZEAu37T1gFoeV9SqJQed7Fw,592
11
- codeanalyzer/schema/__init__.py,sha256=HB7y4y-49dkEo-H9GREam1_9Cr1N-GF6MYwx9yoU878,1978
12
- codeanalyzer/schema/py_schema.py,sha256=04K19tDtmg2tPXjwu_8BcmVpenk1ibVwNv6bHWZHOLY,10851
13
- codeanalyzer/semantic_analysis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
- codeanalyzer/semantic_analysis/codeql/__init__.py,sha256=ODMkdGvs3ebJdfIZle8T4VcHoCBhH_ZehWuWFpNh3NI,1022
15
- codeanalyzer/semantic_analysis/codeql/codeql_analysis.py,sha256=-mVTm2JdQlfmV_9T4xLgjxwROKS83aP7lJAmQHh37xY,5312
16
- codeanalyzer/semantic_analysis/codeql/codeql_exceptions.py,sha256=PnJOasW9rP68SEX158jSqQFdqjW_Q_Fx3vbH6vNiCQs,474
17
- codeanalyzer/semantic_analysis/codeql/codeql_loader.py,sha256=o0BW-6yHkN6kLG66rOYQQ_ToQUn5Ivl9h9ZdBM3_E_Q,2288
18
- codeanalyzer/semantic_analysis/codeql/codeql_query_runner.py,sha256=QJtID1YZkO6Wyns_qTJFqOSiV238ArLXwgLv105B27E,6520
19
- codeanalyzer/semantic_analysis/wala/__init__.py,sha256=JSDvkrpJ2U90Ikex34EluSHmoGutlmRhV2xvInt6tB8,743
20
- codeanalyzer/syntactic_analysis/__init__.py,sha256=EUQkJEh6wHjWx2qTTKbTbUgwSbfKeNieKHNy7RknVXA,476
21
- codeanalyzer/syntactic_analysis/exceptions.py,sha256=whs_n0vIu655Jkk1a7iOoXY6iIca4pZqJnU40V9Ejaw,537
22
- codeanalyzer/syntactic_analysis/symbol_table_builder.py,sha256=0FE_ZdlyP77P1B70QXhPKO4AEPm2KvA3-llaAjIrOJU,34639
23
- codeanalyzer/utils/__init__.py,sha256=hC6VWdR5rerSqBxzu9KQHTASWqwrrYJv-CMDwrTlzkc,137
24
- codeanalyzer/utils/logging.py,sha256=0vTkGSl5EZN8yhhWa_5Mrn1n_twRCSW53rNwjzQ9RbI,601
25
- codeanalyzer/utils/progress_bar.py,sha256=ZHJzGiCo5q4dyXq4CtsrJeq9Ip7sD84T3yZjNX7TBys,2443
26
- codeanalyzer_python-0.1.13.dist-info/METADATA,sha256=poiZ1ztgLjCTtMkNHixHe6iEGcRBWtytXMI_cSKjSzQ,16283
27
- codeanalyzer_python-0.1.13.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
28
- codeanalyzer_python-0.1.13.dist-info/entry_points.txt,sha256=eUrB7Jq5Oav6RblMX_RYfVLSw_h15NbzC3fNSnGsPuM,59
29
- codeanalyzer_python-0.1.13.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
30
- codeanalyzer_python-0.1.13.dist-info/licenses/NOTICE,sha256=YU0Z9NDWqKY-2jfFcbxeZ6fbnzz0oZeKmnUcO8a-bcQ,901
31
- codeanalyzer_python-0.1.13.dist-info/RECORD,,
@@ -1,2 +0,0 @@
1
- [console_scripts]
2
- codeanalyzer = codeanalyzer.__main__:app