Shing Lyu

Disable pycodestyle Check in SageMaker Notebooks

By Shing Lyu    

Disclaimer: This content reflects my personal opinions, not those of any organizations I am or have been affiliated with. Code samples are provided for illustration purposes only, use with caution and test thoroughly before deployment.

The solution in this post is originally proposed by MattC and krassowski in this StakeOverflow thread. I just added some screenshots. Thanks to Nadhya Polanco for pointing me to this solution.

(To view a larger version of a screenshot, right-click on the image and select Open Image in New Tab.)

By default, when you use JupyterLab in Amazon SageMaker Studio, you’ll see some Python code being highlighted with pycodestyle syntax check error. This can get distracting if you don’t care about them or have the checks in the CI/CD pipeline already.

Problem

Here is how you can disable it:

Disable the pycodestyle check completely

First, click the Settings menu > Settings Editor. Settings There are a lot of items in the Settings Editor. Search for Langauge Servers. Language Servers Uncheck the pylsp.plugins.pycodestyle.enabled. Deselect PyLSP Now you have a clean notebook. Disabled

Disable certain checks

If you only need to disable some rules, here is how you can do it.

Right-click on the line with highlighted code > Show diagnostics panel Show Diagnostics The diagnostics panel will show up. Right click on the rule you want to ignore > Ignore diagnostics like this > Ignore diagnostics with “EXXX” code. Ignore Diagnostics

Want to learn Rust? Check out my book: