rapidsai / deployment

RAPIDS Deployment Documentation
https://docs.rapids.ai/deployment/stable/
9 stars 27 forks source link

enforce ruff checks on Python code in notebooks (fixes #333) #370

Closed jameslamb closed 2 months ago

jameslamb commented 2 months ago

Fixes #333.

source/examples/rapids-1brc-single-node/notebook.ipynb:cell 7:1:1: I001 [*] Import block is un-sorted or un-formatted
source/examples/rapids-1brc-single-node/notebook.ipynb:cell 12:13:121: E501 Line too long (129 > 120)
source/examples/rapids-autoscaling-multi-tenant-kubernetes/notebook.ipynb:cell 43:2:1: E402 Module level import not at top of cell
source/examples/rapids-autoscaling-multi-tenant-kubernetes/notebook.ipynb:cell 43:3:1: E402 Module level import not at top of cell
source/examples/rapids-autoscaling-multi-tenant-kubernetes/notebook.ipynb:cell 51:6:1: I001 [*] Import block is un-sorted or un-formatted
source/examples/rapids-autoscaling-multi-tenant-kubernetes/notebook.ipynb:cell 51:7:42: F401 [*] `dask.distributed.wait` imported but unused
source/examples/rapids-ec2-mnmg/notebook.ipynb:cell 4:3:17: F821 Undefined name `cluster`
source/examples/rapids-ec2-mnmg/notebook.ipynb:cell 7:1:1: I001 [*] Import block is un-sorted or un-formatted
source/examples/rapids-ec2-mnmg/notebook.ipynb:cell 7:1:8: F401 [*] `math` imported but unused
source/examples/rapids-ec2-mnmg/notebook.ipynb:cell 7:2:22: F401 [*] `datetime.datetime` imported but unused
source/examples/rapids-ec2-mnmg/notebook.ipynb:cell 7:4:8: F401 [*] `cudf` imported but unused
source/examples/rapids-ec2-mnmg/notebook.ipynb:cell 7:5:8: F401 [*] `dask` imported but unused
source/examples/rapids-ec2-mnmg/notebook.ipynb:cell 7:13:22: F401 [*] `dateutil.parser` imported but unused
source/examples/rapids-ec2-mnmg/notebook.ipynb:cell 7:14:1: E401 [*] Multiple imports on one line
source/examples/rapids-ec2-mnmg/notebook.ipynb:cell 7:14:8: F401 [*] `configparser` imported but unused
source/examples/rapids-ec2-mnmg/notebook.ipynb:cell 7:14:22: F401 [*] `os` imported but unused
source/examples/rapids-ec2-mnmg/notebook.ipynb:cell 7:14:26: F401 [*] `contextlib` imported but unused
source/examples/rapids-ec2-mnmg/notebook.ipynb:cell 27:3:1: F821 Undefined name `cluster`
source/examples/rapids-sagemaker-higgs/notebook.ipynb:cell 3:1:1: I001 [*] Import block is un-sorted or un-formatted
source/examples/rapids-sagemaker-higgs/notebook.ipynb:cell 31:1:1: I001 [*] Import block is un-sorted or un-formatted
source/examples/time-series-forecasting-with-hpo/notebook.ipynb:cell 23:1:1: I001 [*] Import block is un-sorted or un-formatted
source/examples/time-series-forecasting-with-hpo/notebook.ipynb:cell 23:13:12: UP031 Use format specifiers instead of percent format
source/examples/time-series-forecasting-with-hpo/notebook.ipynb:cell 90:11:13: E741 Ambiguous variable name: `l`
source/examples/time-series-forecasting-with-hpo/notebook.ipynb:cell 109:1:1: I001 [*] Import block is un-sorted or un-formatted
source/examples/time-series-forecasting-with-hpo/notebook.ipynb:cell 120:46:5: F841 Local variable `t` is assigned to but never used
source/examples/time-series-forecasting-with-hpo/notebook.ipynb:cell 143:4:9: F841 Local variable `product_weights` is assigned to but never used
source/examples/xgboost-azure-mnmg-daskcloudprovider/notebook.ipynb:cell 7:1:1: I001 [*] Import block is un-sorted or un-formatted
source/examples/xgboost-azure-mnmg-daskcloudprovider/notebook.ipynb:cell 7:1:44: F401 [*] `dask.distributed.get_worker` imported but unused
source/examples/xgboost-azure-mnmg-daskcloudprovider/notebook.ipynb:cell 7:5:39: F401 [*] `cuml.dask.common.utils` imported but unused
source/examples/xgboost-azure-mnmg-daskcloudprovider/notebook.ipynb:cell 7:7:18: F401 [*] `cuml.ForestInference` imported but unused
source/examples/xgboost-azure-mnmg-daskcloudprovider/notebook.ipynb:cell 7:8:8: F401 [*] `cudf` imported but unused
source/examples/xgboost-azure-mnmg-daskcloudprovider/notebook.ipynb:cell 7:10:22: F401 [*] `datetime.datetime` imported but unused
source/examples/xgboost-azure-mnmg-daskcloudprovider/notebook.ipynb:cell 7:11:22: F401 [*] `dateutil.parser` imported but unused
source/examples/xgboost-azure-mnmg-daskcloudprovider/notebook.ipynb:cell 23:25:121: E501 Line too long (133 > 120)
source/examples/xgboost-azure-mnmg-daskcloudprovider/notebook.ipynb:cell 49:1:1: I001 [*] Import block is un-sorted or un-formatted
source/examples/xgboost-azure-mnmg-daskcloudprovider/notebook.ipynb:cell 49:37:13: B007 Loop control variable `d_1` not used within loop body
source/examples/xgboost-azure-mnmg-daskcloudprovider/notebook.ipynb:cell 49:37:18: B007 Loop control variable `m_1` not used within loop body
source/examples/xgboost-azure-mnmg-daskcloudprovider/notebook.ipynb:cell 49:37:23: B007 Loop control variable `y_1` not used within loop body
source/examples/xgboost-azure-mnmg-daskcloudprovider/notebook.ipynb:cell 78:25:23: F401 [*] `xgboost` imported but unused
source/examples/xgboost-azure-mnmg-daskcloudprovider/notebook.ipynb:cell 78:26:22: F811 [*] Redefinition of unused `ForestInference` from cell 7, line 7

Notes for Reviewers

I thought the number of remaining issues was small enough that it was time to put up a "fix everything else" PR to close this out. But if this is too large to review let me know, I'd be happy to split it up.

How I tested this

I did not run any of these notebooks.

For any places where ruff said an import was "unused", I searched through that notebook to check if it was referenced in commented-out code or in markdown blocks.

review-notebook-app[bot] commented 2 months ago

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB