Skip to content

Commit 6fde582

Browse files
authored
Merge pull request #16 from codez0mb1e/uv-ruff
Setup scripts for `uv` + `ruff` and AI development environments
2 parents e51453c + ee9281b commit 6fde582

8 files changed

Lines changed: 132 additions & 51 deletions

File tree

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2017-2024 Dmitry Petukhov
3+
Copyright (c) 2017-2025 Dmitry Petukhov
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

ai-agents/agents.sh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/bin/bash
2+
3+
#
4+
# AI agents development environment setup
5+
#
6+
# This script sets up:
7+
# - Infra
8+
# - Frameworks
9+
# - Tools
10+
#
11+
# Note: will be decomposed into separate scripts later
12+
# Usage: ./agents.sh
13+
#
14+
15+
16+
# 0. Install Ollama [1]
17+
# install
18+
cd ~
19+
curl -fsSL https://ollama.com/install.sh | sh
20+
21+
# checks
22+
ollama -v
23+
24+
# load LLMs
25+
ollama run llama3.2
26+
ollama run deepseek-coder
27+
28+
29+
# Connect Ollama to Open-WebUI [2]
30+
docker network create ollama-net
31+
32+
docker run -d --network ollama-net -p 3000:8080 \
33+
-v ollama:/root/.ollama \
34+
-v open-webui:/app/backend/data \
35+
--name open-webui \
36+
--restart always \
37+
ghcr.io/open-webui/open-webui:ollama
38+
39+
# open http://localhost:3000 in browser for web UI
40+
41+
42+
# 1. Install AutoGen ----
43+
44+
uv add "autogen-core" "autogen-agentchat"
45+
uv add "autogen-ext[web-surfer,openai,ollama,azure]"
46+
uv sync --all-extras
47+
48+
49+
# 2. Install Playwright ----
50+
playwright install
51+
52+
53+
# References:
54+
# 1. https://github.com/ollama/ollama/blob/main/docs/linux.md
55+
# 2. https://github.com/open-webui/open-webui?tab=readme-ov-file#how-to-install-

development/install_docker.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ echo \
1717
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
1818
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
1919

20+
2021
# 1. Install ----
2122
# install packages
2223
sudo apt -y update
@@ -57,6 +58,9 @@ docker logs portainer
5758
# Docker Hub
5859
docker login -u <username> -p <password>
5960

61+
# GitHub Container Registry
62+
echo <gh_token> | docker login ghcr.io -u <username> --password-stdin
63+
6064
# Azure Container Registry
6165
az login
6266
az acr login -n <acr_name>

development/install_dotnet_tools.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44
# Install .NET
55
#
66

7-
# 1. Install .NET 8 ----
7+
# 1. Install .NET 9 ----
88
# install
9-
sudo apt install -y dotnet-sdk-8.0
9+
sudo add-apt-repository ppa:dotnet/backports
10+
sudo apt-get update && \
11+
sudo apt-get install -y dotnet-sdk-9.0
1012
# validate
1113
dotnet --info
1214

1315

1416
# References ----
15-
# 1. https://learn.microsoft.com/en-us/dotnet/core/install/linux-ubuntu-install?pivots=os-linux-ubuntu-2404&tabs=dotnet8
17+
# 1. https://learn.microsoft.com/en-us/dotnet/core/install/linux-ubuntu-install?pivots=os-linux-ubuntu-2404&tabs=dotnet9

development/requirements-dev.txt

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

development/requirements.txt

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

development/uv_and_ruff.sh

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#!/bin/bash
2+
3+
#
4+
# Install `uv` and `ruff` for Python development
5+
#
6+
7+
8+
# 0. Install uv ----
9+
# install
10+
curl -LsSf https://astral.sh/uv/install.sh | sh
11+
# check
12+
uv -V
13+
# turn on auto-updates
14+
uv self update
15+
16+
17+
# 1. Install Python tools for uv ----
18+
# Install Python 3.12
19+
uv python install 3.12
20+
uv python list 3.12
21+
echo 'import platform; print(platform.python_version())' | uv run -
22+
23+
uv python upgrade 3.12
24+
25+
# Install venv
26+
uv venv
27+
28+
29+
# Install ruff (globally)
30+
uv tool install ruff@latest
31+
ruff --version
32+
33+
uv tool upgrade ruff
34+
35+
36+
# 2. Create a new project ----
37+
cd projects/
38+
uv init -n ai-agents
39+
cd ai-agents
40+
41+
uv add ruff # if not installed globally yet
42+
uv lock
43+
44+
45+
# 3. Configure ruff for Python projects ----
46+
mkdir -p ~/.config/ruff
47+
cat <<EOF > ~/.config/ruff/config.toml
48+
[tool.ruff]
49+
line-length = 120
50+
select = ["E", "F", "W", "C90"]
51+
exclude = ["__pycache__", "venv", ".git", ".ruff_cache"]
52+
fix = true
53+
target-version = "py312"
54+
55+
[tool.ruff.per-file-ignores]
56+
"__init__.py" = ["F401"]
57+
EOF
58+
59+
echo "Ruff configuration file created at ~/.config/ruff/config.toml"
60+
61+
ruff check --config ~/.config/ruff/config.toml --fix --exit-zero
62+
echo "Ruff configuration validated successfully."
63+
64+
65+
# References ----
66+
# 1. https://docs.astral.sh/uv/getting-started/features/
67+
# 2. https://marketplace.visualstudio.com/items?itemName=charliermarsh.ruff

0 commit comments

Comments
 (0)