Skip to content

Use language: script for cudf-polars-ir-signatures pre-commit hook#22384

Merged
rapids-bot[bot] merged 1 commit intorapidsai:mainfrom
vyasr:fix/pre-commit-cudf-polars-ir-signatures
May 6, 2026
Merged

Use language: script for cudf-polars-ir-signatures pre-commit hook#22384
rapids-bot[bot] merged 1 commit intorapidsai:mainfrom
vyasr:fix/pre-commit-cudf-polars-ir-signatures

Conversation

@vyasr
Copy link
Copy Markdown
Contributor

@vyasr vyasr commented May 5, 2026

Description

The cudf-polars-ir-signatures pre-commit hook uses language: python but is just a local script (./ci/check_cudf_polars_ir.py) that only depends on stdlib modules (ast, argparse, sys, typing) and has a #!/usr/bin/env python3 shebang.

With language: python, pre-commit unnecessarily creates a virtualenv for this hook. language: script is the correct setting — it runs the entry point directly as an executable, relying on the shebang for interpreter selection, with no virtualenv overhead.

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

The hook is a local script (./ci/check_cudf_polars_ir.py) that only uses
stdlib modules and has a shebang line. Using language: python was causing
pre-commit to unnecessarily create a virtualenv. language: script is the
correct setting for local executable scripts.
@vyasr vyasr requested a review from a team as a code owner May 5, 2026 20:41
@vyasr vyasr requested a review from jameslamb May 5, 2026 20:41
@vyasr vyasr added improvement Improvement / enhancement to an existing function non-breaking Non-breaking change cudf-polars Issues specific to cudf-polars ci labels May 5, 2026
@GPUtester GPUtester moved this to In Progress in cuDF Python May 5, 2026
@vyasr vyasr added non-breaking Non-breaking change and removed non-breaking Non-breaking change labels May 5, 2026
Copy link
Copy Markdown
Member

@jameslamb jameslamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, seems fine. By definition if precommit is runnable you must have a Python interpreter around, and this seems fine if you're not picky about which one.

@vyasr
Copy link
Copy Markdown
Contributor Author

vyasr commented May 6, 2026

Sure, seems fine. By definition if precommit is runnable you must have a Python interpreter around, and this seems fine if you're not picky about which one.

The language key is used to determine the installation mechanism, more than the actual language of the hook, and the installation causes problems in some environments because for a local hook it will try to run pip install . and that can fail without the necessary requirements, e.g.

[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('/home/nfs/vyasr/.cache/pre-commit/repoh77sil0l/py_env-python3/bin/python', '-mpip', 'install', '.')
return code: 1
stdout: (none)
stderr:
    ERROR: Directory '.' is not installable. Neither 'setup.py' nor 'pyproject.toml' found.

I think whether or not it fails is probably dependent on pre-commit version and the behavior has changed. IOW lying about the language of the hook is the lesser of two evils since in some cases the status quo can fail outright.

@vyasr
Copy link
Copy Markdown
Contributor Author

vyasr commented May 6, 2026

/merge

@rapids-bot rapids-bot Bot merged commit 10993fb into rapidsai:main May 6, 2026
99 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in cuDF Python May 6, 2026
@vyasr vyasr deleted the fix/pre-commit-cudf-polars-ir-signatures branch May 6, 2026 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci cudf-polars Issues specific to cudf-polars improvement Improvement / enhancement to an existing function non-breaking Non-breaking change

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants