Skip to content

Commit a718520

Browse files
committed
merge main
2 parents ce1ea2d + 42c50c8 commit a718520

File tree

454 files changed

+21604
-72922
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

454 files changed

+21604
-72922
lines changed

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 0 additions & 1 deletion
This file was deleted.

.github/workflows/build_and_release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
run: |
5454
source test_before_testpypi/bin/activate
5555
# Install the locally built wheel and testing dependencies
56-
pip install dist/*.whl pytest
56+
pip install dist/*.whl pytest pytest-asyncio
5757
pytest tests/metadata/test_metadata.py tests/predict
5858
deactivate
5959
# Publish to test-PyPI
@@ -100,7 +100,7 @@ jobs:
100100
run: |
101101
source test_before_pypi/bin/activate
102102
# Install the locally built wheel and testing dependencies
103-
pip install dist/*.whl pytest
103+
pip install dist/*.whl pytest pytest-asyncio
104104
pytest tests/metadata/test_metadata.py tests/predict
105105
deactivate
106106
rm -r test_before_pypi

.github/workflows/run_tests.yml

Lines changed: 64 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ on:
77
pull_request:
88
types: [opened, synchronize, reopened]
99

10-
env:
11-
POETRY_VERSION: "2.0.0"
12-
1310
jobs:
1411
fix:
1512
name: Check Ruff Fix
@@ -20,25 +17,40 @@ jobs:
2017
steps:
2118
- uses: actions/checkout@v4
2219
- uses: actions/setup-python@v5
23-
- name: Ruff Fix Attempt
24-
id: ruff_fix
25-
uses: chartboost/ruff-action@v1
2620
with:
27-
args: check --fix-only --diff --exit-non-zero-on-fix
28-
continue-on-error: true
29-
- name: Fail Workflow if Ruff Fix Failed
30-
if: steps.ruff_fix.outcome == 'failure'
21+
python-version: "3.11"
22+
- name: Install uv with caching
23+
uses: astral-sh/setup-uv@v5
24+
with:
25+
enable-cache: true
26+
cache-dependency-glob: |
27+
**/pyproject.toml
28+
**/uv.lock
29+
- name: Create and activate virtual environment
3130
run: |
32-
echo "Ruff fix failed, failing the workflow."
33-
echo "Please run 'ruff check . --fix-only' locally and push the changes."
34-
exit 1
31+
uv venv .venv
32+
echo "${{ github.workspace }}/.venv/bin" >> $GITHUB_PATH
33+
- name: Install dependencies
34+
run: uv sync --dev -p .venv --extra dev
35+
- name: Ruff Check
36+
run: |
37+
ruff check --fix-only --diff --exit-non-zero-on-fix || (
38+
echo ""
39+
echo "❌ Ruff found issues that can be fixed automatically."
40+
echo "💡 To fix them locally, run:"
41+
echo ""
42+
echo " pre-commit run --all-files"
43+
echo ""
44+
echo "Then commit and push the changes."
45+
exit 1
46+
)
3547
3648
test:
3749
name: Run Tests
3850
runs-on: ubuntu-latest
3951
strategy:
4052
matrix:
41-
python-version: ["3.11"]
53+
python-version: ["3.10", "3.11", "3.12", "3.13"]
4254
steps:
4355
- uses: actions/checkout@v4
4456
- uses: actions/setup-python@v5
@@ -47,75 +59,62 @@ jobs:
4759
- name: Install Deno
4860
run: |
4961
curl -fsSL https://deno.land/install.sh | sh
50-
echo "Deno installed"
51-
52-
- name: Add Deno to PATH
53-
run: echo "${HOME}/.deno/bin" >> $GITHUB_PATH
54-
62+
echo "${HOME}/.deno/bin" >> $GITHUB_PATH
5563
- name: Verify Deno installation
5664
run: deno --version
57-
58-
- name: Load cached Poetry installation
59-
id: cached-poetry
60-
uses: actions/cache@v3
65+
- name: Install uv with caching
66+
uses: astral-sh/setup-uv@v5
6167
with:
62-
path: ~/.local
63-
key: poetry-${{ env.POETRY_VERSION }}-${{ hashFiles('**/poetry.lock') }}
64-
- name: Install Poetry
65-
run: python -m pip install --upgrade "poetry==${{ env.POETRY_VERSION }}"
68+
enable-cache: true
69+
cache-dependency-glob: |
70+
**/pyproject.toml
71+
**/uv.lock
72+
- name: Create and activate virtual environment
73+
run: |
74+
uv venv .venv
75+
echo "${{ github.workspace }}/.venv/bin" >> $GITHUB_PATH
6676
- name: Install dependencies
6777
run: |
68-
poetry install --no-interaction
78+
uv sync --dev -p .venv --extra dev
79+
uv pip list
6980
- name: Run lint with tests
7081
uses: chartboost/ruff-action@v1
7182
with:
7283
args: check --fix-only
7384
- name: Run tests with pytest
74-
run: poetry run pytest tests/
75-
build_poetry:
76-
name: Build Poetry
85+
run: uv run -p .venv pytest tests/
86+
- name: Install optional dependencies
87+
run: uv sync -p .venv --extra dev --extra test_extras
88+
- name: Run extra tests
89+
run: uv run -p .venv pytest tests/ -m extra --extra
90+
91+
build_package:
92+
name: Build Package
7793
runs-on: ubuntu-latest
7894
strategy:
7995
matrix:
80-
python-version: ["3.11"]
96+
python-version: ["3.10", "3.11", "3.12", "3.13"]
8197
steps:
8298
- uses: actions/checkout@v4
83-
- name: Load cached Poetry installation
84-
id: cached-poetry
85-
uses: actions/cache@v3
86-
with:
87-
path: ~/.local
88-
key: poetry-${{ env.POETRY_VERSION }}-${{ hashFiles('**/poetry.lock') }}
8999
- uses: actions/setup-python@v5
90100
with:
91101
python-version: ${{ matrix.python-version }}
92-
- name: Install Poetry
93-
run: python -m pip install --upgrade "poetry==${{ env.POETRY_VERSION }}"
102+
- name: Install uv with caching
103+
uses: astral-sh/setup-uv@v5
104+
with:
105+
enable-cache: true
106+
cache-dependency-glob: |
107+
**/pyproject.toml
108+
**/uv.lock
109+
- name: Create and activate virtual environment
110+
run: |
111+
uv venv .venv
112+
echo "${{ github.workspace }}/.venv/bin" >> $GITHUB_PATH
113+
- name: Install dependencies
114+
run: uv sync --dev -p .venv --extra dev
94115
- name: Build
95-
run: poetry build
116+
run: uv run -p .venv python -m build
96117
- name: Install built package
97-
run: python -m pip install dist/*.whl
118+
run: uv pip install dist/*.whl -p .venv
98119
- name: Test import dspy
99-
run: python -c "import dspy"
100-
101-
build_setup:
102-
name: Build Setup
103-
runs-on: ubuntu-latest
104-
strategy:
105-
matrix:
106-
python-version: ["3.11"]
107-
steps:
108-
- uses: actions/checkout@v4
109-
- name: Load cached Poetry installation
110-
id: cached-poetry
111-
uses: actions/cache@v3
112-
with:
113-
path: ~/.local
114-
key: poetry-${{ env.POETRY_VERSION }}-${{ hashFiles('**/poetry.lock') }}
115-
- uses: actions/setup-python@v5
116-
with:
117-
python-version: ${{ matrix.python-version }}
118-
- name: Install Poetry
119-
run: python -m pip install --upgrade "poetry==${{ env.POETRY_VERSION }}"
120-
- name: Build the wheel
121-
run: python -m build
120+
run: uv run -p .venv python -c "import dspy"

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,5 @@ docs/docs/**/*.json*
6464
*.pkl
6565
*.tar.gz
6666

67-
test_before_pypi/
67+
test_before_pypi/
68+
dspy/.internal_dspyai/dist/

.pre-commit-config.yaml

Lines changed: 11 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2,65 +2,27 @@ default_language_version:
22
python: python3.9
33

44
default_stages: [pre-commit]
5-
default_install_hook_types: [pre-commit, commit-msg]
5+
default_install_hook_types: [pre-commit]
66

77
repos:
8-
- repo: https://github.com/astral-sh/ruff-pre-commit
9-
rev: v0.1.11
10-
hooks:
11-
- id: ruff
12-
args: [--fix]
13-
- id: ruff-format
14-
15-
- repo: https://github.com/timothycrosley/isort
16-
rev: 5.12.0
8+
- repo: local
179
hooks:
18-
- id: isort
19-
args:
20-
[
21-
"--profile=black",
22-
"--py=39",
23-
"--line-length=120",
24-
"--multi-line=3",
25-
"--trailing-comma",
26-
"--force-grid-wrap=0",
27-
"--use-parentheses",
28-
"--ensure-newline-before-comments",
29-
"--project=CORE,src,config,preprocess,train,transform,main,model",
30-
]
10+
- id: ruff-check
11+
name: ruff (lint)
12+
entry: ruff
13+
language: system
14+
types_or: [python, pyi]
15+
files: ^(dspy|tests)/.*\.py$
16+
exclude: ^(dspy/__metadata__\.py|dspy/retrieve/.*\.py|tests/reliability/.*\.py|tests/retrieve/.*\.py)$
17+
args: [check, --fix-only]
3118

3219
- repo: https://github.com/pre-commit/pre-commit-hooks
33-
rev: v4.1.0
20+
rev: v5.0.0
3421
hooks:
3522
- id: check-yaml
3623
args: ["--allow-multiple-documents", "--unsafe"]
37-
- id: end-of-file-fixer
38-
- id: trailing-whitespace
39-
- id: check-docstring-first
4024
- id: check-toml
4125
- id: check-added-large-files
4226
args: ["--maxkb=1024"]
43-
- id: requirements-txt-fixer
4427
- id: check-merge-conflict
4528
- id: debug-statements
46-
- id: pretty-format-json
47-
args:
48-
- "--autofix"
49-
- "--indent=2"
50-
51-
- repo: local
52-
hooks:
53-
- id: validate-commit-msg
54-
name: Commit Message is Valid
55-
language: pygrep
56-
entry: ^(break|build|ci|docs|feat|fix|perf|refactor|style|test|ops|hotfix|release|maint|init|enh|revert)\([\w,\.,\-,\(,\),\/]+\)(!?)(:)\s{1}([\w,\W,:]+)
57-
stages: [commit-msg]
58-
args: [--negate]
59-
60-
- repo: https://github.com/pre-commit/mirrors-prettier
61-
rev: v3.0.3
62-
hooks:
63-
- id: prettier
64-
additional_dependencies:
65-
- prettier@2.1.2
66-
- "@prettier/plugin-xml@0.12.0"

0 commit comments

Comments
 (0)