Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
source .venv/bin/activate
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,33 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.2.1] - 2025-07-14

### Changed
- **BREAKING CHANGE**: Updated Python version requirement from `>=3.12` to `==3.10` for improved backwards compatibility
- Enhanced backwards compatibility by supporting Python 3.10 environments commonly used in enterprise and CI/CD systems

### Fixed
- Fixed Python version compatibility issue that was unnecessarily blocking installation on Python 3.10 and 3.11 systems
- Resolved adoption barriers for users on older but still supported Python versions

### Technical Notes
- All codebase features are fully compatible with Python 3.10 (ast.unparse, built-in generics, type hints)
- No Python 3.11+ or 3.12+ specific features are used in the implementation
- All dependencies support Python 3.10+

## [0.2.0] - 2025-07-11

### Changed
- **BREAKING CHANGE**: Renamed `AnalyzerCore` class to `Codeanalyzer` for better library naming consistency
- Refactored core class to support direct library import: `from codeanalyzer import Codeanalyzer`
- Updated all internal references and documentation to use the new class name
- Enhanced library interface for programmatic usage while maintaining CLI compatibility

### Added
- Direct library import support allowing users to import and use `Codeanalyzer` as a library
- Proper `__all__` export in `__init__.py` for clean package interface

## [0.1.5] - 2025-07-11

### Fixed
Expand Down
146 changes: 0 additions & 146 deletions RELEASE.md

This file was deleted.

5 changes: 5 additions & 0 deletions codeanalyzer/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"""Python code analyzer library."""

from codeanalyzer.core import Codeanalyzer

__all__ = ["Codeanalyzer"]
11 changes: 3 additions & 8 deletions codeanalyzer/__main__.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
from pathlib import Path
from typing import Annotated, Optional
from enum import Enum

import typer

from codeanalyzer.core import AnalyzerCore
from codeanalyzer.core import Codeanalyzer
from codeanalyzer.utils import _set_log_level, logger


class OutputFormat(str, Enum):
JSON = "json"
MSGPACK = "msgpack"
from codeanalyzer.config import OutputFormat


def main(
Expand Down Expand Up @@ -67,7 +62,7 @@ def main(
logger.error(f"Input path '{input}' does not exist.")
raise typer.Exit(code=1)

with AnalyzerCore(
with Codeanalyzer(
input, analysis_level, using_codeql, rebuild_analysis, cache_dir, clear_cache
) as analyzer:
artifacts = analyzer.analyze()
Expand Down
4 changes: 2 additions & 2 deletions codeanalyzer/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from codeanalyzer.utils import logger


class AnalyzerCore:
class Codeanalyzer:
"""Core functionality for CodeQL analysis.

Args:
Expand Down Expand Up @@ -196,7 +196,7 @@ def _get_base_interpreter() -> Path:
f"a working Python interpreter that can create virtual environments."
)

def __enter__(self) -> "AnalyzerCore":
def __enter__(self) -> "Codeanalyzer":
# If no virtualenv is provided, try to create one using requirements.txt or pyproject.toml
venv_path = self.cache_dir / self.project_dir.name / "virtualenv"
# Ensure the cache directory exists for this project
Expand Down
4 changes: 3 additions & 1 deletion codeanalyzer/syntactic_analysis/symbol_table_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,9 @@ def build_param(

return params

def _accessed_symbols(self, fn_node: ast.FunctionDef, script: Script) -> List[str]:
def _accessed_symbols(
self, fn_node: ast.FunctionDef, script: Script
) -> List[PySymbol]:
"""Analyzes the function body to extract all accessed symbols."""
symbols = []
for node in ast.walk(fn_node):
Expand Down
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
[project]
name = "codeanalyzer-python"
version = "0.1.5"
version = "0.1.6"
description = "Static Analysis on Python source code using Jedi, CodeQL and Treesitter."
readme = "README.md"
authors = [
{ name = "Rahul Krishna", email = "i.m.ralk@gmail.com" }
]
requires-python = ">=3.12"
requires-python = "==3.10.*"

dependencies = [
"jedi>=0.19.2",
"loguru>=0.7.3",
"msgpack>=1.1.1",
"networkx>=3.5",
"networkx>=3.4.2",
"pandas>=2.3.1",
"pydantic>=2.11.7",
"requests>=2.32.4",
Expand Down Expand Up @@ -86,4 +86,4 @@ exclude_lines = [
]

[tool.coverage.html]
directory = "htmlcov"
directory = "htmlcov"