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

WIP: [ci] include lightgbm's dependencies in linting job #5746

Closed
wants to merge 6 commits into from

Conversation

jameslamb
Copy link
Collaborator

@jameslamb jameslamb commented Feb 26, 2023

Contributes to #3756
Contributes to #3867.

The lint CI job runs mypy, a static type-checker for Python.

The code in python-package/compat.py handles optional imports by creating placeholder empty classes and functions. For example, like this:

class pd_DataFrame: # type: ignore

Since many of lightgbm's dependencies (like pandas and matplotlib) are not currently installed during the lint CI job, it's those placeholder definitions that mypy checks. And the presence of # type: ignore comments on many of them short-circuits the type-checking process.

As a result, the lint job is currently not able to detect issues like "pandas Series do not have attribute .xyz".

This PR proposes installing all of those dependencies in the lint CI job, to improve the ability of CI to catch such incompatibilities (at least with the latest version of all installed dependencies).

@jameslamb
Copy link
Collaborator Author

This proved to be more difficult than I thought it would be. I'm going to close this to focus on other things. Sorry for the noise.

@jameslamb jameslamb closed this Jun 10, 2023
@jameslamb jameslamb deleted the ci/mypy-optional-deps branch June 10, 2023 04:54
Copy link

This pull request has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant