diff --git a/.github/workflows/python-checks.yml b/.github/workflows/python-checks.yml new file mode 100644 index 000000000..4a877b760 --- /dev/null +++ b/.github/workflows/python-checks.yml @@ -0,0 +1,43 @@ +name: Python Code Quality Checks + +on: + pull_request: + branches: + - main + # Only run the workflow if files in these specific Python directories are changed + paths: + - 'python/agents/**.py' + - 'python/notebooks/**.py' + - 'python/notebooks/**.ipynb' + +jobs: + python-checks: + runs-on: ubuntu-latest + + steps: + - name: โฌ‡๏ธ Checkout Repository + uses: actions/checkout@v4 + + - name: ๐Ÿ Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: โš™๏ธ Install Tools (Matching Makefile) + run: pip install black flake8 isort nbqa + + # --- Black/iSort Check for .py files --- + - name: ๐Ÿ“ Run Black and iSort Checks + run: | + black --check --diff python/agents/ python/notebooks/ + isort --check-only --diff python/agents/ python/notebooks/ + + # --- Flake8 Check for all .py files --- + - name: ๐Ÿงน Run Flake8 Linting + run: flake8 ./python/ + + # --- Black/iSort Check for .ipynb files (using nbqa) --- + - name: ๐Ÿ““ Check Notebooks (nbqa) + run: | + nbqa black --check --diff python/notebooks/ + nbqa isort --check-only --diff python/notebooks/ \ No newline at end of file