Skip to content

Add transpiler for Python 3.10 #2

Add transpiler for Python 3.10

Add transpiler for Python 3.10 #2

name: Check Transpilation
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
check-transpilation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Install dependencies
run: |
pip install libcst ruff
- name: Run transpiler
run: |
# First, remove any existing test directory
rm -rf src/jaxls/_py310_test
# Run the transpiler
python transpile_py310.py src/jaxls src/jaxls/_py310_test
- name: Compare transpiled output
run: |
# Use diff with specific flags for better comparison
# -r: recursive
# -q: brief output (only show which files differ)
# --exclude: exclude __pycache__ directories
if ! diff -rq --exclude="__pycache__" src/jaxls/_py310 src/jaxls/_py310_test; then
echo "Error: Transpiled code is out of date!"
echo "Differences found:"
diff -ru --exclude="__pycache__" src/jaxls/_py310 src/jaxls/_py310_test || true
echo ""
echo "Please run: python transpile_py310.py src/jaxls src/jaxls/_py310"
exit 1
fi
echo "Transpiled code is up to date!"
- name: Cleanup
if: always()
run: |
rm -rf src/jaxls/_py310_test