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
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ RUN groupadd --gid $USER_GID $USERNAME \
# Set up the Python development environment
WORKDIR /python-sdk
RUN python3 -m pip install --upgrade pip wheel && \
pip3 install poetry==1.8.5
pip3 install uv

# Enable color terminal for docker exec bash
ENV TERM=xterm-256color
Expand Down
3 changes: 1 addition & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
"ms-python.pylint",
"ms-python.flake8",
"ms-python.black-formatter",
"zeshuaro.vscode-python-poetry",
"njpwerner.autodocstring",
"wholroyd.jinja",
"yzhang.markdown-all-in-one",
Expand All @@ -67,5 +66,5 @@
]
}
},
"postCreateCommand": "sudo poetry config virtualenvs.create false && sudo poetry install; echo '---'; python3 --version; echo '---'; java -version; echo '---'; mvn --version; echo '--'; clang --version; echo '---';"
"postCreateCommand": "uv sync --all-groups; echo '---'; python3 --version; echo '---'; java -version; echo '---'; mvn --version; echo '--'; clang --version; echo '---';"
}
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
source .venv/bin/activate
29 changes: 12 additions & 17 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Python Poetry Release
name: Python uv Release

on:
push:
Expand All @@ -16,11 +16,6 @@ jobs:
- name: Check out code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Set up GraalVM CE Java 11
uses: graalvm/setup-graalvm@v1
with:
Expand All @@ -32,21 +27,21 @@ jobs:
- name: Install jq
run: sudo apt-get update && sudo apt-get install -y jq

- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "${HOME}/.local/bin" >> $GITHUB_PATH
export PATH="${HOME}/.local/bin:$PATH"
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true

- name: Set up Python
run: uv python install 3.11

- name: Install Python package dependencies
run: |
poetry config virtualenvs.create false
poetry install --sync --no-interaction
run: uv sync --all-groups --frozen

- name: Run Tests
id: test
continue-on-error: true
run: poetry run make test
run: uv run make test

- name: Delete tag on failure
if: steps.test.conclusion == 'failure'
Expand All @@ -64,7 +59,7 @@ jobs:
mv codeanalyzer-*.jar ${{ github.workspace }}/cldk/analysis/java/codeanalyzer/jar/

- name: Build Package
run: poetry build
run: uv build

- name: Read Changelog Entry
id: changelog_reader
Expand Down Expand Up @@ -92,4 +87,4 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish package distributions to PyPI
run: poetry publish --username __token__ --password ${{ secrets.PYPI_API_TOKEN }}
run: uv publish --token ${{ secrets.PYPI_API_TOKEN }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
# Cache files
.cache/

# CLDK / codeanalyzer-python analysis artifacts
.codeanalyzer/
.cldk-cache/

# Mobile Tools for Java (J2ME)
.mtj.tmp/

Expand Down
15 changes: 7 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,24 @@ all: help
.PHONY: venv
venv: ## Create a Python virtual environment
$(info Creating Python 3 virtual environment...)
poetry shell
uv venv

.PHONY: install
install: ## Install Python dependencies in virtual environment
$(info Installing dependencies...)
poetry config virtualenvs.in-project true
poetry install --all-extras
uv sync --all-groups

.PHONY: lint
lint: ## Run the linter
$(info Running linting...)
flake8 cldk --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 cldk --count --max-complexity=10 --max-line-length=180 --statistics
pylint cldk --max-line-length=180
uv run flake8 cldk --count --select=E9,F63,F7,F82 --show-source --statistics
uv run flake8 cldk --count --max-complexity=10 --max-line-length=180 --statistics
uv run pylint cldk --max-line-length=180

.PHONY: test
test: ## Run the unit tests
$(info Running tests...)
pytest --pspec --cov=cldk --cov-fail-under=75 --disable-warnings
uv run pytest --pspec --cov=cldk --cov-fail-under=75 --disable-warnings

##@ Build

Expand All @@ -56,4 +55,4 @@ build: ## Builds a new Python wheel
mv codeanalyzer-*.jar cldk/analysis/java/codeanalyzer/jar/

# Build the package
poetry build
uv build
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,20 @@ Each language has a dedicated analysis backend implemented under `cldk.analysis.

#### Python
- **Backend:** `cldk.analysis.python`
- **Tools:** Tree-sitter
- **Capabilities:** Lightweight structural parsing, method/function boundaries, control/data flow approximation
- **Tools:** `codeanalyzer-python` (Jedi + CodeQL, default on), Tree-sitter for source-level parsing
- **Capabilities:** Symbol table, call graph, class/method resolution, comments/docstrings

> **Note — analysis cache:** Caching is owned entirely by
> `codeanalyzer-python`; CLDK keeps no cache of its own. Artifacts (the
> backend virtualenv, CodeQL database, and `analysis_cache.json`) live under
> the backend's `cache_dir`, which defaults to `<project>/.codeanalyzer` and
> can be redirected with the `cache_dir` argument. **CodeQL is enabled by
> default** (`use_codeql=True`), so the first analysis of a project builds a
> CodeQL database and provisions the CodeQL CLI — expect a slow cold run;
> subsequent runs reuse the backend's checksum-validated cache. Pass
> `use_codeql=False` for Jedi-only analysis. Add the `cache_dir` location
> (e.g. `.codeanalyzer/`) to your `.gitignore` — it is large and
> environment-specific.

#### C
- **Backend:** `cldk.analysis.c`
Expand Down
Loading
Loading