-
Notifications
You must be signed in to change notification settings - Fork 8
59 lines (51 loc) · 1.84 KB
/
python.yml
File metadata and controls
59 lines (51 loc) · 1.84 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
name: python
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
# cancel any prior runs for this workflow and this PR (or branch)
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0 # https://corrode.dev/blog/tips-for-faster-ci-builds/#environment-flags-to-disable-incremental-compilation
CARGO_PROFILE_TEST_DEBUG: 0 # https://corrode.dev/blog/tips-for-faster-ci-builds/#disable-debug-info
jobs:
build_and_test:
name: python
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version:
- 3.11
- 3.12
- 3.13
os:
- ubuntu-latest
# - windows-latest
# - macos-latest <-- disabled only because of hopefully transient maturin installation issues https://github.com/PyO3/maturin/issues/2659
steps:
- uses: actions/checkout@v6
# - uses: Swatinem/rust-cache@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: create venv
run: |
python -mvenv venv
source venv/bin/activate
echo "$VIRTUAL_ENV/bin" >> $GITHUB_PATH
echo "VIRTUAL_ENV=$VIRTUAL_ENV" >> $GITHUB_ENV
- name: install maturin
run: pip install maturin
- name: maturin develop
run: maturin develop -m crates/spnl-ffi/Cargo.toml --no-default-features -F pypi,tok
- name: invoke the python tokenize api
run: |
query='{"g": { "model": "ibm-granite/granite-3.3-2b-instruct", "input": {"user": "hello"}}}'
python -c "import spnl; s = spnl.init(1); spnl.tokenize_query(s, '$query', 27, 10, 31, 16)"