feat: import from langfuse #223
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Python package | |
on: | |
pull_request: | |
paths: | |
- "phospho-python/**" | |
branches: | |
- dev | |
jobs: | |
test_phospho_python: | |
runs-on: ubuntu-latest | |
environment: test | |
defaults: | |
run: | |
working-directory: phospho-python | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
installer-parallel: true | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v3 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
# Install dependencies if cache does not exist | |
- name: Install dependencies | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
run: poetry install --with dev --no-interaction --no-root | |
# Test the bare phospho package | |
- name: Install project without lab | |
run: poetry install --no-interaction | |
- name: Run tests | |
env: | |
PHOSPHO_API_KEY: ${{ secrets.PHOSPHO_API_KEY }} | |
PHOSPHO_PROJECT_ID: ${{ secrets.PHOSPHO_PROJECT_ID }} | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }} | |
run: | | |
source .venv/bin/activate | |
pytest -k test_log | |
# Test the phospho package, with lab. This has extra dependencies | |
- name: Install project with lab | |
run: poetry install --no-interaction --extras "lab" | |
- name: Run tests | |
env: | |
PHOSPHO_API_KEY: ${{ secrets.PHOSPHO_API_KEY }} | |
PHOSPHO_PROJECT_ID: ${{ secrets.PHOSPHO_PROJECT_ID }} | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }} | |
run: | | |
source .venv/bin/activate | |
pytest -k test_lab |