Skip to content

cython-lint failure on main #32498

Closed

Description

@ogrisel

The main branch and some PRs synchronized with it are now failing with the following cython-lint error:

/home/vsts/work/1/s/sklearn/cluster/_hdbscan/_tree.pyx:786:19: unnecessary set + generator (just use a set comprehension)
Problems detected by cython-lint, please fix them

I think this is a consequence of the merge of #32489 but weirdly enough, that PR was green and, I cannot reproduce locally on the current main:

$ pre-commit run --files sklearn/cluster/_hdbscan/_tree.pyx
[INFO] Initializing environment for https://github.com/MarcoGorelli/cython-lint.
[INFO] Installing environment for https://github.com/MarcoGorelli/cython-lint.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
check yaml...........................................(no files to check)Skipped
fix end of files.........................................................Passed
trim trailing whitespace.................................................Passed
ruff check...........................................(no files to check)Skipped
ruff format..........................................(no files to check)Skipped
mypy.................................................(no files to check)Skipped
cython-lint..............................................................Passed
prettier.............................................(no files to check)Skipped
codespell................................................................Passed

Activity

  1. ogrisel commented on Oct 14, 2025

    @ogrisel
    MemberAuthor

    If I install the latest version of cython-lint from pip I can reproduce the problem by running the command manually:

    cython-lint sklearn/cluster/_hdbscan/_tree.pyx
    /Users/ogrisel/code/scikit-learn/sklearn/cluster/_hdbscan/_tree.pyx:786:19: unnecessary set + generator (just use a set comprehension)
    
  2. lesteve commented on Oct 14, 2025

    @lesteve
    Member

    cc @MarcoGorelli for his advice whether we should expect similar linting changes in the future for cython-lint. I know that as the saying goes: it's hard to make predictions, especially about the future 😉.

    I guess until now we were a bit lazy and never needed to pin the cython-lint version but maybe we should start doing it?

  3. MarcoGorelli commented on Oct 14, 2025

    @MarcoGorelli
    Contributor

    Yeah the precommit version is behind, I push a new version out today with some new checks

    Fwiw I'd suggest running pre-commit run --all-files in ci, then there's a single command and everything stays in sync

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions