Repository navigation
69 lines (66 loc) · 2.19 KB
/
Copy pathpython.yml
File metadata and controls
69 lines (66 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: Python adapter
# clients/python, the Python package that wraps the CLI. It runs the CLI
# built from this tree rather than one from npm, and reads the engine output
# under docs/examples, so a change to the CLI, the schema or those files runs
# it too. Separate from the CI gate: a Python failure cannot block an engine
# release.
on:
pull_request:
branches: [main]
paths:
- clients/python/**
- packages/cli/**
- packages/evidence-graph/**
- docs/examples/**
- package.json
- bun.lock
- .github/workflows/python.yml
push:
branches: [main]
paths:
- clients/python/**
- packages/cli/**
- packages/evidence-graph/**
- docs/examples/**
- package.json
- bun.lock
- .github/workflows/python.yml
permissions:
contents: read
jobs:
python:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# 3.10 is the floor pyproject.toml declares; 3.12 is what the old
# refract-py CI ran.
python-version: ["3.10", "3.12"]
steps:
- uses: actions/checkout@v7
- uses: oven-sh/setup-bun@v2
with:
bun-version: "1.3.14"
- uses: actions/setup-node@v6
with:
node-version: 22
- run: bun install --frozen-lockfile
- run: bun run build
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
# Install the built wheel, not the checkout, so a module left out of the
# wheel fails here instead of only for people who pip install it.
- name: build and install the wheel
working-directory: clients/python
run: |
python -m pip install --upgrade pip build
python -m build --wheel --outdir dist
python -m venv /tmp/wheel-env
/tmp/wheel-env/bin/pip install dist/*.whl pytest langchain-core
cd /tmp && /tmp/wheel-env/bin/python -c "import refract, refract_eval, refract_langchain"
- name: test against the CLI built above
working-directory: clients/python
env:
REFRACT_CLI: ${{ github.workspace }}/packages/cli/dist/src/cli.js
run: /tmp/wheel-env/bin/python -m pytest -v