Skip to content

Commit 5a91cbd

Browse files
authored
Merge branch 'main' into integration/dspy
2 parents a8c6ce1 + a7f2f3c commit 5a91cbd

212 files changed

Lines changed: 3279 additions & 2655 deletions

File tree

Some content is hidden

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

.github/utils/docstrings_checksum.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,13 @@ def docstrings_checksum(python_files: Iterator[Path]):
3535

3636
parser = argparse.ArgumentParser()
3737
parser.add_argument("--root", help="Project root folder", required=True, type=Path)
38+
parser.add_argument("--integration", help="Integration folder relative path", required=False, type=str)
3839
args = parser.parse_args()
3940

4041
# Get all Python files
4142
root: Path = args.root.absolute()
4243
python_files = root.glob("integrations/**/*.py")
43-
44+
if args.integration:
45+
python_files = root.glob(f"integrations/{args.integration}/**/*.py")
4446
md5 = docstrings_checksum(python_files)
4547
print(md5)

.github/utils/pyproject_to_requirements.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import argparse
2-
import sys
32
from pathlib import Path
43
import toml
54

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: Core / Check API reference changes
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "integrations/**/*.py"
7+
- "integrations/**/config_docusaurus.yml"
8+
9+
jobs:
10+
test-api-reference-build:
11+
runs-on: ubuntu-slim
12+
steps:
13+
- uses: actions/checkout@v6
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v6
19+
with:
20+
python-version: "3.13"
21+
22+
- name: Detect integrations with API reference changes
23+
id: changed
24+
shell: python
25+
run: |
26+
import json
27+
import os
28+
import subprocess
29+
import sys
30+
from pathlib import Path
31+
32+
sys.path.insert(0, ".github/utils")
33+
from docstrings_checksum import docstrings_checksum
34+
35+
def git(*args):
36+
result = subprocess.run(["git", *args], capture_output=True, text=True)
37+
return result.stdout.strip(), result.returncode
38+
39+
runner_temp = os.environ["RUNNER_TEMP"]
40+
base_sha, _ = git("rev-parse", "HEAD^1")
41+
42+
# Get all changed files
43+
diff_output, _ = git(
44+
"diff", "--name-only", f"{base_sha}...HEAD", "--", "integrations"
45+
)
46+
changed_files = set(diff_output.splitlines())
47+
48+
# Extract integration names
49+
candidates = sorted({
50+
Path(p).parts[1]
51+
for p in changed_files
52+
if p.startswith("integrations/") and len(Path(p).parts) > 1
53+
})
54+
55+
# Create base worktree for docstring comparison
56+
base_worktree = os.path.join(runner_temp, "base")
57+
_, return_code = git("worktree", "add", base_worktree, base_sha)
58+
has_worktree = return_code == 0
59+
60+
changed_integrations = []
61+
62+
for integration in candidates:
63+
# If pydoc config changed, always include
64+
if f"integrations/{integration}/pydoc/config_docusaurus.yml" in changed_files:
65+
changed_integrations.append(integration)
66+
continue
67+
68+
# Otherwise, check if docstrings changed
69+
pr_docstrings_checksum = docstrings_checksum(Path(".").glob(f"integrations/{integration}/**/*.py"))
70+
base_docstrings_checksum = ""
71+
if has_worktree:
72+
base_docstrings_checksum = docstrings_checksum(Path(base_worktree).glob(f"integrations/{integration}/**/*.py"))
73+
74+
if base_docstrings_checksum != pr_docstrings_checksum:
75+
changed_integrations.append(integration)
76+
77+
print(f"Integrations with API reference changes: {json.dumps(changed_integrations)}")
78+
79+
with open(os.environ["GITHUB_OUTPUT"], "a") as f:
80+
f.write(f"integrations={json.dumps(changed_integrations)}\n")
81+
82+
- name: Install Hatch
83+
if: steps.changed.outputs.integrations != '[]'
84+
run: pip install --upgrade hatch
85+
86+
- name: Generate API references
87+
if: steps.changed.outputs.integrations != '[]'
88+
env:
89+
INTEGRATIONS: ${{ steps.changed.outputs.integrations }}
90+
run: |
91+
mkdir -p website
92+
for integration in $(echo "$INTEGRATIONS" | jq -r '.[]'); do
93+
echo ""
94+
echo "--- Generating API reference for $integration ---"
95+
cd "integrations/$integration"
96+
hatch run docs
97+
# Move the generated file to a 'website' folder for testing
98+
mv "$integration.md" ../../website/
99+
cd ../..
100+
done
101+
102+
- name: Set up Node.js
103+
if: steps.changed.outputs.integrations != '[]'
104+
uses: actions/setup-node@v6
105+
with:
106+
node-version: "22"
107+
108+
- name: Run Docusaurus md/mdx checker
109+
if: steps.changed.outputs.integrations != '[]'
110+
working-directory: website
111+
run: |
112+
npx docusaurus-mdx-checker -v || {
113+
echo ""
114+
echo "For common MDX problems, see https://docusaurus.io/blog/preparing-your-site-for-docusaurus-v3#common-mdx-problems"
115+
exit 1
116+
}

.github/workflows/aimlapi.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,6 @@ jobs:
5454
if: matrix.python-version == '3.10' && runner.os == 'Linux'
5555
run: hatch run fmt-check && hatch run test:types
5656

57-
- name: Generate docs
58-
if: matrix.python-version == '3.10' && runner.os == 'Linux'
59-
run: hatch run docs
60-
6157
- name: Run tests
6258
run: hatch run test:cov-retry
6359

.github/workflows/amazon_bedrock.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,6 @@ jobs:
6363
if: matrix.python-version == '3.10' && runner.os == 'Linux'
6464
run: hatch run fmt-check && hatch run test:types
6565

66-
- name: Generate docs
67-
if: matrix.python-version == '3.10' && runner.os == 'Linux'
68-
run: hatch run docs
69-
7066
- name: Run unit tests
7167
run: hatch run test:unit
7268

.github/workflows/amazon_sagemaker.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@ jobs:
5353
if: matrix.python-version == '3.10' && runner.os == 'Linux'
5454
run: hatch run fmt-check && hatch run test:types
5555

56-
- name: Generate docs
57-
if: matrix.python-version == '3.10' && runner.os == 'Linux'
58-
run: hatch run docs
59-
6056
- name: Run tests
6157
run: hatch run test:cov-retry
6258

.github/workflows/anthropic.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,6 @@ jobs:
5454
if: matrix.python-version == '3.10' && runner.os == 'Linux'
5555
run: hatch run fmt-check && hatch run test:types
5656

57-
- name: Generate docs
58-
if: matrix.python-version == '3.10' && runner.os == 'Linux'
59-
run: hatch run docs
60-
6157
- name: Run tests
6258
run: hatch run test:cov-retry
6359

.github/workflows/astra.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,6 @@ jobs:
5454
if: matrix.python-version == '3.10' && runner.os == 'Linux'
5555
run: hatch run fmt-check && hatch run test:types
5656

57-
- name: Generate docs
58-
if: matrix.python-version == '3.10' && runner.os == 'Linux'
59-
run: hatch run docs
60-
6157
- name: Run tests
6258
env:
6359
ASTRA_DB_API_ENDPOINT: ${{ secrets.ASTRA_DB_API_ENDPOINT }}

.github/workflows/azure_ai_search.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@ jobs:
5151
if: matrix.python-version == '3.10' && runner.os == 'Linux'
5252
run: hatch run fmt-check && hatch run test:types
5353

54-
- name: Generate docs
55-
if: matrix.python-version == '3.10' && runner.os == 'Linux'
56-
run: hatch run docs
57-
5854
- name: Run tests
5955
run: hatch run test:cov-retry
6056

.github/workflows/azure_doc_intelligence.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@ jobs:
5151
if: matrix.python-version == '3.10' && runner.os == 'Linux'
5252
run: hatch run fmt-check && hatch run test:types
5353

54-
- name: Generate docs
55-
if: matrix.python-version == '3.10' && runner.os == 'Linux'
56-
run: hatch run docs
57-
5854
- name: Run tests
5955
run: hatch run test:cov-retry
6056

0 commit comments

Comments
 (0)