Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove unused imports #6424

Merged
merged 1 commit into from
Mar 12, 2025

Conversation

jameslamb
Copy link
Member

@jameslamb jameslamb commented Mar 11, 2025

Contributes to #6403

While working on that, my IDE highlighted a few unused imports. Looked into that a bit and saw that this project is currently configured to ignore flake8's warnings about unused imports:

cuml/python/cuml/.flake8

Lines 27 to 28 in c5c0656

# imported but unused
F401

I went back to the PR that introduced that (#4983) and didn't see any discussion that made me think that was the intended long-term state.

This proposes:

  • enforcing flake8's unused imports check
  • removing unused imports

Notes for Reviewers

Benefits of these changes

Approach I took

Removed F401 exclusion from .flake8, then ran

pre-commit run --all-files

Manually went through the suggestions and looked at the usage.

For library code:

  • added # noqa: F401 for imports that looked like they were intentional (e.g. for their side effects)
  • removed anything that looked unused

For test code:

  • preserved any unused imports from cuml itself, via #noqa comments
    • just importing from a module gives you some minimal test coverage of it, I didn't want to accidentally remove any of that
  • removed anything else that looked unused

@jameslamb jameslamb added improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Mar 11, 2025
Copy link

copy-pr-bot bot commented Mar 11, 2025

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@github-actions github-actions bot added the Cython / Python Cython or Python issue label Mar 11, 2025
@jameslamb
Copy link
Member Author

/ok to test

@jameslamb jameslamb changed the title WIP: remove unused imports remove unused imports Mar 12, 2025
@jameslamb jameslamb marked this pull request as ready for review March 12, 2025 13:49
@jameslamb jameslamb requested a review from a team as a code owner March 12, 2025 13:49
Copy link
Contributor

@csadorf csadorf left a comment

Choose a reason for hiding this comment

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

Fantastic!

@csadorf
Copy link
Contributor

csadorf commented Mar 12, 2025

/merge

@rapids-bot rapids-bot bot merged commit 6e75981 into rapidsai:branch-25.04 Mar 12, 2025
68 of 70 checks passed
@jameslamb jameslamb deleted the remove-unused-imports branch March 12, 2025 15:12
@jcrist
Copy link
Member

jcrist commented Mar 12, 2025

Thanks James!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Cython / Python Cython or Python issue improvement Improvement / enhancement to an existing function non-breaking Non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants