Skip to content

Commit 648b9be

Browse files
authored
feat: migrate to uv (#53)
Ref: #52 Signed-off-by: Tomas Dvorak <[email protected]>
1 parent 7f11cb4 commit 648b9be

File tree

7 files changed

+3962
-6109
lines changed

7 files changed

+3962
-6109
lines changed

.github/workflows/main.yml

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,32 @@ on:
88

99
jobs:
1010
main:
11-
timeout-minutes: 20
11+
timeout-minutes: 10
1212
name: Lint & Build & Test
1313
runs-on: ubuntu-latest
14+
1415
steps:
1516
- uses: actions/checkout@v4
1617
with:
1718
fetch-depth: 0
18-
- name: Install poetry
19-
run: pipx install poetry
20-
- uses: actions/setup-python@v5
21-
with:
22-
python-version: "3.11"
23-
cache: "poetry"
19+
20+
- name: Install uv
21+
uses: astral-sh/setup-uv@v6
22+
23+
- name: Set up Python
24+
run: uv python install
25+
2426
- name: Install dependencies
25-
run: poetry install --no-interaction
27+
run: uv sync --all-extras --locked --dev
28+
2629
- name: Code Lint
27-
run: poetry run poe lint
30+
run: uv run poe lint
31+
2832
- name: Type check task with mypy
29-
run: poetry run poe type-check -- -- --show-error-context --pretty
33+
run: uv run poe type-check -- --show-error-context --pretty
34+
3035
- name: Code Format
31-
run: poetry run poe format
36+
run: uv run poe format
37+
3238
- name: Build
33-
run: poetry build
39+
run: uv build

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.11

DEVELOP.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ With the githooks installed the following will run automatically on a commit:
3535
* [mypy](https://github.com/python/mypy) is used to check for type errors
3636
* a simple format check is applied to the commit message to verify for use of [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/#summary)
3737

38-
Additional tools are integrated into poetry via the [poetry plugin](https://poethepoet.natn.io/poetry_plugin.html)
38+
Additional tools are provided via [Poe the Poet](https://github.com/nat-n/poethepoet) tasks and can be run with uv.
3939

40-
Tools can also be run directly via the command line (run within `poetry shell` or prefix with `poetry run`):
40+
Tools can be run directly via the command line (activate the venv or prefix commands with `uv run`):
4141

4242
* `poe lint` - lints and formats your code
4343
* `poe format` - formats your code

README.md

Lines changed: 22 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ This starter template helps you **quickly** get started with the [BeeAI framewor
2424
## 📋 Requirements
2525

2626
- **Python Version 3.11+**
27-
- **Poetry Version 2.0+** for Python package management - See [installation guide](https://python-poetry.org/docs/#installation)
27+
- **uv** (fast Python package manager) - See installation: https://docs.astral.sh/uv/getting-started/installation/
2828
- **Container system** (with Compose support):
2929
- [Docker](https://www.docker.com/)
3030
- [Rancher](https://www.rancher.com/) (For macOS, use VZ instead of QEMU)
3131
- [Podman](https://podman.io/) (Requires [Compose](https://podman-desktop.io/docs/compose/setting-up-compose) and rootful machine)
3232
- **LLM Provider** - External [WatsonX](https://www.ibm.com/watsonx) (OpenAI, Groq, ...) or local [Ollama](https://ollama.com)
33-
- **IDE/Code Editor** (e.g., WebStorm, VSCode) - Optional but recommended for smooth smooth configuration handling
33+
- **IDE/Code Editor** (e.g., WebStorm, VSCode) - Optional but recommended for smooth configuration handling
3434

3535
---
3636

@@ -44,25 +44,19 @@ cd beeai-framework-py-starter
4444

4545
**Step 2:** Install dependencies
4646
```sh
47-
poetry install
47+
uv sync
4848
```
4949

50-
**Step 3:** Install and start the poetry environment
51-
```sh
52-
poetry self add poetry-plugin-shell
53-
poetry shell
54-
```
55-
56-
**Step 4:** Create an `.env` file with the contents from `.env.template`
50+
**Step 3:** Create an `.env` file with the contents from `.env.template`
5751

58-
**Step 5:** [Ollama](https://ollama.com/) must be installed and running, with the granite3.3 model pulled.
52+
**Step 4:** [Ollama](https://ollama.com/) must be installed and running, with the granite3.3 model pulled.
5953
```sh
6054
ollama pull granite3.3
6155
```
6256

63-
**Step 6:** Start all services related to [beeai-code-interpreter](https://github.com/i-am-bee/beeai-code-interpreter)
57+
**Step 5:** Start all services related to [beeai-code-interpreter](https://github.com/i-am-bee/beeai-code-interpreter)
6458
```sh
65-
poe infra --type start
59+
uv run poe infra --type start
6660
```
6761

6862
> [!NOTE]
@@ -76,21 +70,12 @@ Get complete visibility of the agent's inner workings via [OpenInference Instrum
7670
7771
### Instructions
7872

79-
1. (Optional) In order to see spans in [Phoenix](https://github.com/Arize-ai/phoenix), begin running a Phoenix server. This can be done in one command using docker.
73+
1. In order to see spans in [Phoenix](https://github.com/Arize-ai/phoenix), begin running a Phoenix server. This can be done in one command using docker.
8074

8175
```
82-
docker run -p 6006:6006 -i -t arizephoenix/phoenix
76+
docker run -p 6006:6006 -i -t arizephoenix/phoenix:latest
8377
```
8478

85-
or via the command line:
86-
87-
```
88-
brew install i-am-bee/beeai/arize-phoenix
89-
brew services start arize-phoenix
90-
```
91-
92-
see https://docs.beeai.dev/observability/agents-traceability for more details.
93-
9479
2. Run the agent `python beeai_framework_starter/agent_observe.py`
9580
3. You should see your spans exported in your console. If you've set up a locally running Phoenix server, head to [**localhost:6006**](http://localhost:6006/projects) to see your spans.
9681

@@ -100,37 +85,38 @@ see https://docs.beeai.dev/observability/agents-traceability for more details.
10085

10186
### 🤖 Agent
10287

103-
Now that you’ve set up your project, let’s run the agent example located at `/beeai_framework_starter/agent_react.py`.
88+
Now that you’ve set up your project, let’s run the agent example.
10489

10590
You have two options:
10691

10792
**Option 1:** Interactive mode
10893
```sh
109-
python beeai_framework_starter/agent.py
94+
uv run python beeai_framework_starter/agent.py
11095
```
11196

11297
**Option 2:** Define your prompt up front
11398
```sh
114-
python beeai_framework_starter/agent.py <<< "I am going out tomorrow morning to walk around Boston. What should I plan to wear?"
99+
uv run python beeai_framework_starter/agent.py <<< "I am going out tomorrow morning to walk around Boston. What should I plan to wear?"
115100
```
116101

117102
> [!NOTE]
118-
> Notice this prompts triggers the agent to call a tool.
103+
> Notice that this prompt triggers the agent to call a tool.
119104
120105
---
121106

122107
### 🧑‍💻 Code interpreter agent
123108

124109
Now let's run the code interpreter agent example located at `/beeai_framework_starter/agent_code_interpreter.py`.
125110

126-
Try the `Python Tool` and ask the agent to perform a complex calculation:
111+
Try the `PythonTool` and ask the agent to perform a complex calculation:
127112
```sh
128-
python beeai_framework_starter/agent_code_interpreter.py <<< "Calculate 534*342?"
113+
uv run python beeai_framework_starter/agent_code_interpreter.py <<< "Calculate 534*342?"
129114
```
130115

131-
Try the `SandBox tool` and run a custom Python function `get_riddle()`:
116+
Try the `SandboxTool` and run a custom Python function `get_riddle()`:
117+
132118
```sh
133-
python beeai_framework_starter/agent_code_interpreter.py <<< "Generate a riddle"
119+
uv run python beeai_framework_starter/agent_code_interpreter.py <<< "Generate a riddle"
134120
```
135121

136122
---
@@ -140,13 +126,15 @@ python beeai_framework_starter/agent_code_interpreter.py <<< "Generate a riddle"
140126
This example demonstrates a **multi-agent workflow** where different agents work together to provide a comprehensive understanding of a location.
141127

142128
The workflow includes three agents:
129+
143130
1. **Researcher:** Gathers information about the location using the Wikipedia tool.
144131
2. **WeatherForecaster:** Retrieves and reports weather details using the OpenMeteo API.
145132
3. **DataSynthesizer:** Combines the historical and weather data into a final summary.
146133

147134
To run the workflow:
135+
148136
```sh
149-
python beeai_framework_starter/agent_workflow.py
137+
uv run python beeai_framework_starter/agent_workflow.py
150138
```
151139

152140
---
@@ -157,4 +145,4 @@ For additional examples to try, check out the examples directory of BeeAI framew
157145

158146
## Development
159147

160-
If you are developing with this repository as a base, or updating this template, see additional information in [DEVELOP.md].
148+
If you are developing with this repository as a base, or updating this template, see additional information in [./DEVELOP.md].

0 commit comments

Comments
 (0)