Skip to content

Commit

Permalink
Merge pull request #380 from ag2ai/use-hatch-uv
Browse files Browse the repository at this point in the history
Use hatch for build system, uv for installing deps and remove setup.py
  • Loading branch information
Hk669 authored Jan 8, 2025
2 parents 984897e + 367f33b commit 32718df
Show file tree
Hide file tree
Showing 13 changed files with 398 additions and 314 deletions.
16 changes: 9 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
workflows:
- ".github/workflows/**"
setup:
- "setup.py"
- "pyproject.toml"
- name: autogen has changes
run: echo "autogen has changes"
if: steps.filter.outputs.autogen == 'true'
Expand Down Expand Up @@ -62,21 +62,23 @@ jobs:
python-version: "3.9"
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
with:
version: "latest"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install packages and dependencies
run: |
python -m pip install --upgrade pip wheel
pip install -e .[test,cosmosdb,interop]
uv pip install --system -e .[test,cosmosdb,interop]
python -c "import autogen"
pip install pytest-cov>=5 mock
uv pip install --system pytest-cov>=5 mock
- name: Install optional dependencies for code executors
# code executors and udfs auto skip without deps, so only run for python 3.11
if: matrix.python-version == '3.11'
run: |
pip install -e ".[jupyter-executor]"
uv pip install --system -e ".[jupyter-executor]"
python -m ipykernel install --user --name python3
- name: Set AUTOGEN_USE_DOCKER based on OS
shell: bash
Expand All @@ -88,7 +90,7 @@ jobs:
if: matrix.python-version != '3.10' && matrix.os == 'ubuntu-latest'
# Remove the line below once https://github.com/docker/docker-py/issues/3256 is merged
run: |
pip install "requests<2.32.0"
uv pip install --system "requests<2.32.0"
pytest test --ignore=test/agentchat/contrib --skip-openai --durations=10 --durations-min=1.0
- name: Test with pytest skipping openai and docker tests
if: matrix.python-version != '3.10' && matrix.os != 'ubuntu-latest'
Expand All @@ -97,7 +99,7 @@ jobs:
- name: Coverage with Redis
if: matrix.python-version == '3.10'
run: |
pip install -e .[redis,websockets]
uv pip install --system -e .[redis,websockets]
pytest test --ignore=test/agentchat/contrib --skip-openai --durations=10 --durations-min=1.0
- name: Test with Cosmos DB
run: |
Expand Down
22 changes: 13 additions & 9 deletions .github/workflows/contrib-graph-rag-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- "autogen/agentchat/contrib/graph_rag/**"
- "test/agentchat/contrib/graph_rag/**"
- ".github/workflows/contrib-tests.yml"
- "setup.py"
- "pyproject.toml"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
Expand All @@ -35,17 +35,19 @@ jobs:
- 6379:6379
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
with:
version: "latest"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install packages and dependencies for all tests
run: |
python -m pip install --upgrade pip wheel
pip install pytest
uv pip install --system pytest
- name: Install FalkorDB SDK when on linux
run: |
pip install -e .[graph-rag-falkor-db]
uv pip install --system -e .[graph-rag-falkor-db]
- name: Set AUTOGEN_USE_DOCKER based on OS
shell: bash
run: |
Expand All @@ -57,7 +59,7 @@ jobs:
AZURE_OPENAI_API_BASE: ${{ secrets.AZURE_OPENAI_API_BASE }}
OAI_CONFIG_LIST: ${{ secrets.OAI_CONFIG_LIST }}
run: |
pip install pytest-cov>=5
uv pip install --system pytest-cov>=5
pytest test/agentchat/contrib/graph_rag/test_falkor_graph_rag.py --skip-openai
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
Expand All @@ -81,17 +83,19 @@ jobs:
NEO4J_AUTH: neo4j/password
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
with:
version: "latest"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install packages and dependencies for all tests
run: |
python -m pip install --upgrade pip wheel
pip install pytest
uv pip install --system pytest
- name: Install Neo4j and Llama-index when on linux
run: |
pip install -e .[neo4j_graph_rag]
uv pip install --system -e .[neo4j_graph_rag]
- name: Set AUTOGEN_USE_DOCKER based on OS
shell: bash
run: |
Expand All @@ -103,7 +107,7 @@ jobs:
AZURE_OPENAI_API_BASE: ${{ secrets.AZURE_OPENAI_API_BASE }}
OAI_CONFIG_LIST: ${{ secrets.OAI_CONFIG_LIST }}
run: |
pip install pytest-cov>=5
uv pip install --system pytest-cov>=5
pytest test/agentchat/contrib/graph_rag/test_neo4j_graph_rag.py --skip-openai
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
Expand Down
24 changes: 15 additions & 9 deletions .github/workflows/contrib-openai.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- "autogen/**"
- "test/agentchat/contrib/**"
- ".github/workflows/contrib-openai.yml"
- "setup.py"
- "pyproject.toml"
permissions:
{}
# actions: read
Expand Down Expand Up @@ -166,15 +166,17 @@ jobs:
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: astral-sh/setup-uv@v5
with:
version: "latest"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install packages and dependencies
run: |
docker --version
python -m pip install --upgrade pip wheel
pip install -e .[teachable,test]
uv pip install --system -e .[teachable,test]
python -c "import autogen"
- name: Coverage
env:
Expand Down Expand Up @@ -202,20 +204,22 @@ jobs:
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: astral-sh/setup-uv@v5
with:
version: "latest"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install packages and dependencies
run: |
docker --version
python -m pip install --upgrade pip wheel
pip install -e ".[test]"
uv pip install --system -e ".[test]"
python -c "import autogen"
pip install pytest-cov>=5 pytest-asyncio
uv pip install --system pytest-cov>=5 pytest-asyncio
- name: Install packages for test when needed
run: |
pip install -e .[autobuild]
uv pip install --system -e .[autobuild]
- name: Coverage
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
Expand Down Expand Up @@ -281,15 +285,17 @@ jobs:
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: astral-sh/setup-uv@v5
with:
version: "latest"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install packages and dependencies
run: |
docker --version
python -m pip install --upgrade pip wheel
pip install -e .[lmm,test]
uv pip install --system -e .[lmm,test]
python -c "import autogen"
- name: Coverage
env:
Expand Down
Loading

0 comments on commit 32718df

Please sign in to comment.