Skip to content

Commit 064e345

Browse files
committed
Migrate to UV
Signed-off-by: Rahul Krishna <i.m.ralk@gmail.com>
1 parent 435ea9c commit 064e345

6 files changed

Lines changed: 111 additions & 99 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ RUN groupadd --gid $USER_GID $USERNAME \
3535
# Set up the Python development environment
3636
WORKDIR /python-sdk
3737
RUN python3 -m pip install --upgrade pip wheel && \
38-
pip3 install poetry==1.8.5
38+
pip3 install uv
3939

4040
# Enable color terminal for docker exec bash
4141
ENV TERM=xterm-256color

.devcontainer/devcontainer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
"ms-python.pylint",
5050
"ms-python.flake8",
5151
"ms-python.black-formatter",
52-
"zeshuaro.vscode-python-poetry",
5352
"njpwerner.autodocstring",
5453
"wholroyd.jinja",
5554
"yzhang.markdown-all-in-one",
@@ -67,5 +66,5 @@
6766
]
6867
}
6968
},
70-
"postCreateCommand": "sudo poetry config virtualenvs.create false && sudo poetry install; echo '---'; python3 --version; echo '---'; java -version; echo '---'; mvn --version; echo '--'; clang --version; echo '---';"
69+
"postCreateCommand": "uv sync --all-groups; echo '---'; python3 --version; echo '---'; java -version; echo '---'; mvn --version; echo '--'; clang --version; echo '---';"
7170
}

.github/workflows/release.yml

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Python Poetry Release
1+
name: Python uv Release
22

33
on:
44
push:
@@ -16,11 +16,6 @@ jobs:
1616
- name: Check out code
1717
uses: actions/checkout@v4
1818

19-
- name: Set up Python
20-
uses: actions/setup-python@v5
21-
with:
22-
python-version: '3.11'
23-
2419
- name: Set up GraalVM CE Java 11
2520
uses: graalvm/setup-graalvm@v1
2621
with:
@@ -32,21 +27,21 @@ jobs:
3227
- name: Install jq
3328
run: sudo apt-get update && sudo apt-get install -y jq
3429

35-
- name: Install Poetry
36-
run: |
37-
curl -sSL https://install.python-poetry.org | python3 -
38-
echo "${HOME}/.local/bin" >> $GITHUB_PATH
39-
export PATH="${HOME}/.local/bin:$PATH"
30+
- name: Install uv
31+
uses: astral-sh/setup-uv@v4
32+
with:
33+
enable-cache: true
34+
35+
- name: Set up Python
36+
run: uv python install 3.11
4037

4138
- name: Install Python package dependencies
42-
run: |
43-
poetry config virtualenvs.create false
44-
poetry install --sync --no-interaction
39+
run: uv sync --all-groups --frozen
4540

4641
- name: Run Tests
4742
id: test
4843
continue-on-error: true
49-
run: poetry run make test
44+
run: uv run make test
5045

5146
- name: Delete tag on failure
5247
if: steps.test.conclusion == 'failure'
@@ -64,7 +59,7 @@ jobs:
6459
mv codeanalyzer-*.jar ${{ github.workspace }}/cldk/analysis/java/codeanalyzer/jar/
6560
6661
- name: Build Package
67-
run: poetry build
62+
run: uv build
6863

6964
- name: Read Changelog Entry
7065
id: changelog_reader
@@ -92,4 +87,4 @@ jobs:
9287
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9388

9489
- name: Publish package distributions to PyPI
95-
run: poetry publish --username __token__ --password ${{ secrets.PYPI_API_TOKEN }}
90+
run: uv publish --token ${{ secrets.PYPI_API_TOKEN }}

Makefile

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,24 @@ all: help
1313
.PHONY: venv
1414
venv: ## Create a Python virtual environment
1515
$(info Creating Python 3 virtual environment...)
16-
poetry shell
16+
uv venv
1717

1818
.PHONY: install
1919
install: ## Install Python dependencies in virtual environment
2020
$(info Installing dependencies...)
21-
poetry config virtualenvs.in-project true
22-
poetry install --all-extras
21+
uv sync --all-groups
2322

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

3130
.PHONY: test
3231
test: ## Run the unit tests
3332
$(info Running tests...)
34-
pytest --pspec --cov=cldk --cov-fail-under=75 --disable-warnings
33+
uv run pytest --pspec --cov=cldk --cov-fail-under=75 --disable-warnings
3534

3635
##@ Build
3736

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

5857
# Build the package
59-
poetry build
58+
uv build

pyproject.toml

Lines changed: 63 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
[tool.poetry]
1+
[project]
22
name = "cldk"
33
version = "1.0.7"
44
description = "The official Python SDK for Codellm-Devkit."
5-
authors = ["Rahul Krishna <i.m.ralk@gmail.com>", "Rangeet Pan <rangeet.pan@ibm.com>", "Saurabh Sinhas <sinhas@us.ibm.com>",
6-
"Raju Pavuluri <pavuluri@us.ibm.com>"]
7-
license = "Apache 2.0"
85
readme = "README.md"
9-
homepage = "https://codellm-devkit.info"
10-
repository = "https://github.com/codellm-devkit/python-sdk"
6+
license = { text = "Apache-2.0" }
7+
requires-python = ">=3.11"
8+
authors = [
9+
{ name = "Rahul Krishna", email = "i.m.ralk@gmail.com" },
10+
{ name = "Rangeet Pan", email = "rangeet.pan@ibm.com" },
11+
{ name = "Saurabh Sinhas", email = "sinhas@us.ibm.com" },
12+
{ name = "Raju Pavuluri", email = "pavuluri@us.ibm.com" },
13+
]
1114
keywords = ["ibm", "llm", "large language models", "code analyzer", "syntax tree"]
1215
classifiers = [
1316
"Development Status :: 4 - Beta",
@@ -20,56 +23,69 @@ classifiers = [
2023
"Programming Language :: Python :: 3.11",
2124
"Topic :: Scientific/Engineering :: Artificial Intelligence",
2225
"Topic :: Software Development :: Libraries :: Python Modules",
23-
"Topic :: Software Development :: Libraries :: Application Frameworks"
26+
"Topic :: Software Development :: Libraries :: Application Frameworks",
27+
]
28+
dependencies = [
29+
"pydantic>=2.10.6,<3",
30+
"networkx>=3.4.2,<4",
31+
"pyarrow==20.0.0",
32+
"tree-sitter==0.24.0",
33+
"rich==14.0.0",
34+
"wget==3.2",
35+
"requests>=2.32.3,<3",
36+
"tree-sitter-java==0.23.5",
37+
"tree-sitter-c==0.23.5",
38+
"tree-sitter-go==0.23.4",
39+
"tree-sitter-python==0.23.6",
40+
"tree-sitter-javascript==0.23.1",
41+
"clang==17.0.6",
42+
"libclang==17.0.6",
43+
"codeanalyzer-python==0.1.14",
44+
]
45+
46+
[project.urls]
47+
Homepage = "https://codellm-devkit.info"
48+
Repository = "https://github.com/codellm-devkit/python-sdk"
49+
50+
[dependency-groups]
51+
dev = [
52+
"ipdb>=0.13.13,<0.14",
53+
"ipython>=8.32.0,<9",
54+
]
55+
test = [
56+
"toml>=0.10.2,<0.11",
57+
"pytest==8.3.5",
58+
"pytest-pspec>=0.0.4,<0.0.5",
59+
"pytest-cov>=6.0.0,<7",
60+
"pylint>=3.3.4,<4",
61+
"flake8>=7.1.1,<8",
62+
"black>=25.1.0,<26",
63+
"coverage>=7.6.10,<8",
64+
"jupyter>=1.1.1,<2",
2465
]
66+
67+
[build-system]
68+
requires = ["hatchling"]
69+
build-backend = "hatchling.build"
70+
71+
[tool.hatch.build]
72+
artifacts = ["cldk/analysis/java/codeanalyzer/jar/*.jar"]
73+
74+
[tool.hatch.build.targets.wheel]
75+
packages = ["cldk"]
76+
77+
[tool.hatch.build.targets.sdist]
2578
include = [
79+
"cldk",
2680
"LICENSE",
27-
"cldk/analysis/java/codeanalyzer/jar/*.jar"
81+
"README.md",
82+
"CHANGELOG.md",
2883
]
2984

3085
[tool.backend-versions]
3186
codeanalyzer-java = "2.3.7"
3287
codeanalyzer-python = "0.1.14"
3388

34-
[tool.poetry.dependencies]
35-
python = ">=3.11"
36-
pydantic = "^2.10.6"
37-
#pandas = "^2.2.3"
38-
networkx = "^3.4.2"
39-
pyarrow = "20.0.0"
40-
tree-sitter = "0.24.0"
41-
rich = "14.0.0"
42-
wget = "3.2"
43-
requests = "^2.32.3"
44-
tree-sitter-java = "0.23.5"
45-
tree-sitter-c = "0.23.5"
46-
tree-sitter-go = "0.23.4"
47-
tree-sitter-python = "0.23.6"
48-
tree-sitter-javascript = "0.23.1"
49-
clang = "17.0.6"
50-
libclang = "17.0.6"
51-
codeanalyzer-python = "0.1.14"
52-
53-
[tool.poetry.group.dev.dependencies]
54-
ipdb = "^0.13.13"
55-
ipython = "^8.32.0"
56-
57-
[tool.poetry.group.test.dependencies]
58-
# Test dependencies
59-
toml = "^0.10.2"
60-
pytest = "8.3.5"
61-
pytest-pspec = "^0.0.4"
62-
pytest-cov = "^6.0.0"
63-
pylint = "^3.3.4"
64-
flake8 = "^7.1.1"
65-
black = "^25.1.0"
66-
coverage = "^7.6.10"
67-
jupyter = "^1.1.1"
68-
69-
[build-system]
70-
requires = ["poetry-core"]
71-
build-backend = "poetry.core.masonry.api"
72-
7389
########################################
7490
# Tool configurations
7591
########################################

uv.lock

Lines changed: 27 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)