Skip to content

Commit eed2bf9

Browse files
authored
Refactor sample applications packages and use common python interpreter version (#34)
* refactor(samples): replace uv with poetry in autogen * chore(samples): update python and packages in autogen * refactor(samples): migrate code to newer packages in autogen * chore(samples): remove unused pypi repo * refactor(samples): update python and packages in crewai * refactor(samples): migrate code to new package in crewai * chore(samples): remove unused import * chore(samples): update python and packages in evaluation * refactor(samples): migrate codebase to new packages in evaluation * chore(samples): update python and packages in langgraph * chore(samples): update python and packages in llama-sum * chore(samples): update python version and packages in llama-index * refactor(samples): use poetry package manager in agents * chore(samples): use common python versions * ci(samples): use common python version * ci(samples): fix poetry install * fix(samples): make task test run ci compatible * fix(samples): remove lock --regenerate * fix(samples): update poetry lock file * fix(samples): load docker built image
1 parent 55c373e commit eed2bf9

File tree

38 files changed

+10238
-10288
lines changed

38 files changed

+10238
-10288
lines changed

.github/actions/setup-env/action.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44
---
5-
65
name: Setup Environment
76
description: setup environment with common tools/vars
87
inputs:
@@ -14,6 +13,11 @@ inputs:
1413
description: 'Python version to install'
1514
required: false
1615
default: '3.12'
16+
py-poetry-version:
17+
description: 'Poetry version to install'
18+
required: false
19+
default: '2.1.1'
20+
1721
go:
1822
description: 'Install golang'
1923
required: false
@@ -24,17 +28,18 @@ inputs:
2428
default: '1.23.1'
2529

2630
runs:
27-
using: "composite"
31+
using: 'composite'
2832
steps:
2933
- name: Setup Taskfile
3034
shell: bash
3135
run: sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin
3236

3337
- name: Setup Python
3438
if: ${{ inputs.python == 'true' }}
35-
uses: ./.github/actions/setup-python
39+
uses: ./.github/actions/setup-python
3640
with:
3741
py-version: ${{ inputs.python-version }}
42+
py-poetry-version: ${{ inputs.py-poetry-version }}
3843

3944
- name: Setup Golang
4045
if: ${{ inputs.go == 'true' }}

.github/workflows/test-samples.yaml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,6 @@ jobs:
3838
fail-fast: false
3939
matrix:
4040
app: ${{ fromJson(needs.detect-changes.outputs.apps-changed) }}
41-
pyversion: [ "3.12", "3.11" ]
42-
exclude:
43-
- app: "./samples/evaluation"
44-
pyversion: "3.12"
45-
- app: "./samples/langgraph/research"
46-
pyversion: "3.11"
47-
- app: "./samples/llama-deploy/llama-sum"
48-
pyversion: "3.11"
49-
- app: "./samples/llama-index/research"
50-
pyversion: "3.11"
5141

5242
steps:
5343
- name: Checkout code
@@ -59,7 +49,7 @@ jobs:
5949
uses: ./.github/actions/setup-env
6050
with:
6151
python: true
62-
python-version: ${{ matrix.pyversion }}
52+
python-version: "3.12.9"
6353
go: false
6454

6555
- name: Setup K8S Tools
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
# Copyright AGNTCY Contributors (https://github.com/agntcy)
22
# SPDX-License-Identifier: Apache-2.0
33

4-
FROM python:3.9-slim
4+
FROM python:3.13.2-bookworm
55

66
WORKDIR /app
77

88
COPY . /app
99

1010
RUN chmod +x /app/script.py
1111

12+
RUN pip install poetry
13+
RUN poetry config virtualenvs.in-project true
14+
1215
# install python requirements
13-
RUN pip install --no-cache-dir -r requirements.txt
16+
RUN poetry install --no-root
1417

15-
ENTRYPOINT ["python", "/app/script.py"]
18+
ENTRYPOINT ["poetry", "run", "python", "/app/script.py"]

samples/agents/Taskfile.yaml renamed to samples/agents/docker-env-cli-stdout/Taskfile.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,30 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44
---
5-
version: "3"
5+
version: '3'
66

77
silent: true
88

99
tasks:
1010
setup:docker-env-cli-stdout:
1111
desc: Create env file
12-
dir: '{{.USER_WORKING_DIR}}/docker-env-cli-stdout'
12+
dir: '{{.USER_WORKING_DIR}}'
1313
status:
1414
- test -f .env
1515
cmds:
1616
- ../utils/setup-env.sh
1717

1818
test:docker-env-cli-stdout:
1919
desc: Run docker image
20-
dir: '{{.USER_WORKING_DIR}}/docker-env-cli-stdout'
20+
dir: '{{.USER_WORKING_DIR}}'
2121
cmds:
2222
- docker run --env-file .env docker-env-cli-stdout "Hello, World"
2323

2424
build:
2525
desc: Build images
2626
dir: '{{.USER_WORKING_DIR}}'
2727
cmds:
28-
- docker buildx bake
28+
- docker buildx bake --load
2929

3030
run:test:
3131
desc: Run test

samples/agents/docker-bake.hcl renamed to samples/agents/docker-env-cli-stdout/docker-bake.hcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ group "default" {
66
}
77

88
target "docker-env-cli-stdout" {
9-
context = "./docker-env-cli-stdout"
9+
context = "."
1010
dockerfile = "./Dockerfile"
1111
tags = ["docker-env-cli-stdout:latest"]
1212
}

samples/agents/docker-env-cli-stdout/poetry.lock

Lines changed: 1245 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[project]
2+
name = "docker-env-cli-stdout"
3+
version = "0.1.18"
4+
requires-python = "<4.0,>=3.9"
5+
dependencies = [
6+
"requests (>=2.32.3,<3.0.0)",
7+
"langchain-openai (>=0.3.9,<0.4.0)",
8+
]

samples/agents/docker-env-cli-stdout/requirements.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

samples/autogen/Taskfile.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,23 @@ tasks:
1111
desc: Install dependencies
1212
dir: '{{.USER_WORKING_DIR}}'
1313
cmds:
14-
- uv sync
14+
- poetry sync --no-root
1515

1616
lint:
1717
desc: Run lint with black
1818
dir: '{{.USER_WORKING_DIR}}'
1919
deps:
2020
- dependencies
2121
cmds:
22-
- uv run ruff check .
22+
- poetry run ruff check .
2323

2424
fix-lint:
2525
desc: Run lint with black
2626
dir: '{{.USER_WORKING_DIR}}'
2727
deps:
2828
- dependencies
2929
cmds:
30-
- uv run ruff check --fix .
30+
- poetry run ruff check --fix .
3131

3232
compose:
3333
desc: 'Run docker-compose'

samples/autogen/semantic-router/Dockerfile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,20 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44
# The builder image, used to build the virtual environment
5-
FROM python:3.12.5-bookworm AS builder
5+
FROM python:3.13.2-bookworm AS builder
66

7-
RUN pip install uv==0.5.1
7+
RUN pip install poetry
88

99
WORKDIR /app
1010

11-
COPY pyproject.toml uv.lock ./
11+
COPY pyproject.toml poetry.lock ./
1212
RUN touch README.md
1313

14-
RUN uv sync --no-dev
14+
RUN poetry config virtualenvs.in-project true
15+
RUN poetry sync --no-root
1516

1617
# # The runtime image, used to just run the code provided its virtual environment
17-
FROM python:3.12.5-slim-bookworm AS base
18+
FROM python:3.13.2-slim-bookworm AS base
1819

1920
ENV VIRTUAL_ENV=/app/.venv
2021
ENV PATH="/app/.venv/bin:$PATH"

0 commit comments

Comments
 (0)