Skip to content

fix(python): multipart file upload parameter fixes, python core utility bugfix. #1210

fix(python): multipart file upload parameter fixes, python core utility bugfix.

fix(python): multipart file upload parameter fixes, python core utility bugfix. #1210

name: python
on:
pull_request:
paths:
- "generators/python/**"
branches:
- main
workflow_call:
jobs:
compile:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Install Dependencies
working-directory: ./generators/python
run: poetry install
- name: Type check
working-directory: ./generators/python
run: poetry run mypy
- name: pre-commit
working-directory: ./generators/python
run: poetry run pre-commit run --all-files
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Update models for testing
working-directory: ./generators/python
env:
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
run: |
npm install -g fern-api
docker build -f ./pydantic/Dockerfile -t ferntest/fern-pydantic-model:0.0.0 .
cd tests/utils/example_models
fern generate --group dummy_types --local || true
cd ../typeddict_models
fern generate --group dummy_td_types --local || true
cd ../union_utils
fern generate --group dummy_union_types --local || true
cd ../unaliased_models
fern generate --group dummy_unaliased_types --local || true
- name: Install Dependencies - Pydantic V1
working-directory: ./generators/python
run: |
poetry add pydantic=^1.10
poetry lock
poetry install
- name: Unit Test - Pydantic V1
working-directory: ./generators/python
# We have to ignore these tests as they pull in the custom config which uses a model validator,
# the syntax of which is not valid in Pydantic V1, now that we've moved to V2.
run: poetry run pytest -sv --ignore ./tests/utils/casing --ignore ./tests/sdk
- name: Install Dependencies - Pydantic V2
working-directory: ./generators/python
run: |
poetry add pydantic=^2.8.2
poetry lock
poetry install
- name: Unit Test - Pydantic V2
working-directory: ./generators/python
run: poetry run pytest -sv