resolve Linux path casing and invalid lint targets in python-precommit.yml
AGENTQL REPOSITORY ANALYSIS & BUG REPORT REPORT
================================================================================ Repository: https://github.com/tinyfish-io/agentql.git Total Files Audited: 105+ (Python, JavaScript, Google Colab, GitHub Workflows, Templates)
- TOP 5 IDENTIFIED BUGS SUMMARY
-
[HIGH] CI/CD Failure in
.github/workflows/python-precommit.yml- Issue: Case-sensitive path mismatch (
examples/Pythonvsexamples/python), non-existent Pylint targets (application_examples examples), and invalidworking-directorykeyword on action step. - Impact: Python CI checks never trigger on PRs on Linux runners and fail when run manually.
- Issue: Case-sensitive path mismatch (
-
[HIGH] Colab Crash in
examples/python/run_script_online_in_google_colab/main.ipynb- Issue: Typo import
from google.colab import user_data(with underscore) followed byuserdata.get(...)without underscore, plus missingawaitonbrowser.new_page(). - Impact: Fatal
ImportErrorandNameErrorcrash on Cell 6 for all Google Colab users.
- Issue: Typo import
-
[MEDIUM] Runtime AttributeError in
.templates/python/template_async.py- Issue: Query defines
search_btn, but code executesawait response.search_button.click(). - Impact: Any new project started with this async template crashes on the first run.
- Issue: Query defines
-
[MEDIUM] Broken Pagination & Infinite Loop in
examples/js/collect-paginated-ecommerce-data/main.js&examples/python/collect_paginated_ecommerce_listing_data/main.py- Issue: In JS,
paginationInfois an Array, sopaginationInfo.hasNextPageisundefined, causing infinite scraping of page 2. In Python, missingbreakwhenhas_next_pageisFalse. - Impact: Wastes API credits and fills datasets with duplicate items.
- Issue: In JS,
-
[MEDIUM] ESM/CommonJS Mismatches in
examples/js/perform-sentiment-analysis/main.js&examples/js/use-remote-browser/main.js- Issue: CommonJS
require('openai/index.mjs')throwsERR_REQUIRE_ESM, anduse-remote-browseruses ES module syntax in a CommonJS package. - Impact: Scripts fail to run directly under standard Node.js runtime.
- Issue: CommonJS
================================================================================ 2. COMPLETE GITHUB ISSUE & PR SUBMISSION TEMPLATE (BUG 1)
A. GITHUB ISSUE TITLE
fix(ci): resolve Linux path casing and invalid lint targets in python-precommit.yml
B. GITHUB ISSUE BODY
🐛 Bug Description
The Python CI workflow in .github/workflows/python-precommit.yml currently fails or silently skips checks on pull requests due to three issues:
-
Linux Path Casing Mismatch (
examples/Pythonvsexamples/python): The workflow defines path filters and working directories asexamples/Python(with a capitalP). Because GitHub Actions runs onubuntu-latest(case-sensitive Linux ext4 filesystem) and the actual repository folder isexamples/python, the workflow never triggers on PR changes and fails withDirectory not foundif executed. -
Non-Existent Pylint Targets: Line 43 runs
pylint --disable=R,C application_examples examples. Neitherapplication_examplesnorexamplesexists inexamples/python, causing Pylint to immediately crash with exit code 2 (Cannot find 'application_examples'). -
Misconfigured Step Properties:
working-directoryis placed underuses: isort/isort-action@master, which is invalid syntax for action steps. Running lint and format checks viapoetry runensures the correct virtual environment is used.
🔍 Steps to Reproduce
- Push a commit modifying any file in
examples/python/. - Notice that the GitHub Actions path trigger
examples/Python/**fails to match on case-sensitive Linux runners. - Running
pylint application_examples exampleslocally insideexamples/pythonfails immediately: pylint: error: Cannot find 'application_examples'
🛠️ Proposed Solution / Code Diff
--- a/.github/workflows/python-precommit.yml +++ b/.github/workflows/python-precommit.yml @@ -4,7 +4,7 @@ on: pull_request: types: [opened, synchronize, reopened] paths:
-
- "examples/Python/**"
-
- "examples/python/**"
jobs: python-pre-commit: @@ -34,23 +34,22 @@ jobs: # ----- install dependencies ----- #---------------------------------------------- - name: Install dependencies
-
working-directory: ./examples/Python
-
working-directory: ./examples/python run: | poetry install --no-interaction --no-root --with dev - name: Lint check
-
working-directory: ./examples/Python -
run: pylint --disable=R,C application_examples examples
-
working-directory: ./examples/python -
run: poetry run pylint --disable=R,C $(git ls-files '*.py') - name: Code style check
-
working-directory: ./examples/Python -
run: black . --check
-
working-directory: ./examples/python run: poetry run black . --check - name: Imports sort check
-
working-directory: ./examples/Python -
uses: isort/isort-action@master
-
working-directory: ./examples/python -
run: poetry run isort --check-only . - name: Static check
-
working-directory: ./examples/Python
-
working-directory: ./examples/python uses: jakebailey/pyright-action@v2
📄 Full Fixed Workflow File (.github/workflows/python-precommit.yml):
name: Python Pre-commit checks
on: pull_request: types: [opened, synchronize, reopened] paths: - "examples/python/**"
jobs: python-pre-commit: name: Pre-commit checks runs-on: ubuntu-latest steps: - name: Checkout Repository uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.3
virtualenvs-create: false
virtualenvs-in-project: true
installer-parallel: true
#----------------------------------------------
# ----- install dependencies -----
#----------------------------------------------
- name: Install dependencies
working-directory: ./examples/python
run: |
poetry install --no-interaction --no-root --with dev
- name: Lint check
working-directory: ./examples/python
run: poetry run pylint --disable=R,C $(git ls-files '*.py')
- name: Code style check
working-directory: ./examples/python
run: poetry run black . --check
- name: Imports sort check
working-directory: ./examples/python
run: poetry run isort --check-only .
- name: Static check
working-directory: ./examples/python
uses: jakebailey/pyright-action@v2
continue-on-error: true
with:
pylance-version: latest-release
C. GITHUB PULL REQUEST (PR) TITLE
fix(ci): fix python-precommit path casing and lint targets (#issue_number)
D. GITHUB PULL REQUEST (PR) DESCRIPTION
Summary of Changes
- Fixed Path Casing: Changed
examples/Pythontoexamples/pythonso that GitHub Actions triggers and executes properly on case-sensitive Linux (ubuntu-latest) runners. - Fixed Pylint Target Paths: Replaced non-existent directory arguments (
application_examples examples) with$(git ls-files '*.py')executed through Poetry. - Unified Tooling with Poetry: Configured
black,isort, andpylintto run consistently viapoetry runusing the dependencies defined inexamples/python/pyproject.toml. ================================================================================