Skip to content
This repository was archived by the owner on Nov 25, 2025. It is now read-only.

feat: add python implementation #15

feat: add python implementation

feat: add python implementation #15

Workflow file for this run

name: Python CI
permissions:
contents: read
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
lint-and-format:
name: Lint, Format, and Type Check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"
- name: Install dependencies
run: |
cd python
uv sync --dev
- name: Run ruff linter
run: |
cd python
uv run ruff check --fix .
- name: Run ruff formatter
run: |
cd python
uv run ruff format .
- name: Check for changes
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "Code formatting or linting changes detected!"
git diff
exit 1
fi
- name: Run type checking
run: |
cd python
uvx ty check
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"
- name: Install dependencies
run: |
cd python
uv sync --dev
- name: Run unit tests
run: |
cd python
uv run pytest tests/ -v --tb=short --ignore-glob="*_integration.py"
env:
PYTHONPATH: ${{ github.workspace }}/python
integration-tests:
name: Integration Tests
runs-on: ubuntu-latest
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-integration-${{ github.head_ref || github.ref }}
cancel-in-progress: true
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"
- name: Install dependencies
run: |
cd python
uv sync --dev
- name: Run integration tests
run: |
cd python
uv run pytest tests/tools/ -v --tb=short
env:
PYTHONPATH: ${{ github.workspace }}/python
TEST_POSTHOG_API_BASE_URL: ${{ secrets.TEST_API_BASE_URL }}
TEST_POSTHOG_PERSONAL_API_KEY: ${{ secrets.TEST_API_TOKEN }}
TEST_ORG_ID: ${{ secrets.TEST_ORG_ID }}
TEST_PROJECT_ID: ${{ secrets.TEST_PROJECT_ID }}
schema-sync:
name: Schema Synchronization Check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"
- name: Install Node.js dependencies
run: pnpm install
- name: Install Python dependencies
run: |
cd python
uv sync --dev
- name: Generate schemas
run: pnpm run schema:build
- name: Check if schemas are up to date
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "Python schemas are out of sync with TypeScript definitions!"
echo "Please run 'pnpm run schema:build' to regenerate the schemas."
git diff
exit 1
fi