Package: jupyterlab-flake8
Jupyterlab-flake8Jupyterlab extension to lint python notebooks and python files in the text editor. Usesflake8python library for linting.Note: This extension will only work if you can load the terminal in jupyterlabPrerequisitesJupyterLab >= 3.x$condainstalljupyterlab# if using conda$pipinstalljupyterlab# if using pipflake8python package$condainstallflake8# if using conda$pipinstallflake8# if using pipInstallationFor JupyterLab 3.x:pipinstalljupyterlab_flake8For JupyterLab 2.x:jupyterlabextensioninstalljupyterlab-flake8@0.6.1UninstallTo remove the extension, execute:pipuninstalljupyterlab_flake8UsageWhen the extension is installed, the linter will automatically be toggled on and configured to show error messages. The linter will run when you change cells.The linter will run on state change of the notebook or the text editor. State changes occur when the document is saved, the cell is changed, or on some carriage returns.SettingsPlugin is configured in the Jupyter LabAdvanced Settings.
If you are using a specific conda environment, you must explicitly set this environment in theconda_envvariable of the plugin settings.Toggle shortcuts are also available in the view menu:Enable Flake8Turns on or off linting in the notebookOutput Flake8 Browser Console LogsTurn on browser console logs for debugging the extensionConfigure Flake8The notebook linter is configured the same way as theflake8command line tool. See theflake8project configuration documentationfor all options.As an example, if you want to ignore certain warnings:Create.flake8file in the same directory as the notebookSpecify a[flake8]block in a valid INI format[flake8]ignore=F812,   # list comprehension redefinesH101    # Use TODO(NAME)exclude=.git,__pycache__,docs/source/conf.py,distmax-complexity=10Theflake8linter will then use this configuration in the notebook.ContributingDevelopment installNote: You will need NodeJS to build the extension package.Thejlpmcommand is JupyterLab's pinned version ofyarnthat is installed with JupyterLab. You may useyarnornpmin lieu ofjlpmbelow.# Clone the repo to your local environment# Change directory to the jupyterlab_flake8 directory# Install package in development modepipinstall-e.# Link your development version of the extension with JupyterLabjupyterlabextensiondevelop.--overwrite# Rebuild extension Typescript source after making changesjlpmrunbuildYou can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension.# Watch the source directory in one terminal, automatically rebuilding when neededjlpmrunwatch# Run JupyterLab in another terminaljupyterlabWith the watch command running, every saved change will immediately be built locally and available in your running JupyterLab. Refresh JupyterLab to load the change in your browser (you may need to wait several seconds for the extension to be rebuilt).By default, thejlpm run buildcommand generates the source maps for this extension to make it easier to debug using the browser dev tools. To also generate source maps for the JupyterLab core extensions, you can run the following command:jupyterlabbuild--minimize=FalseDevelopment uninstallpipuninstalljupyterlab_flake8In development mode, you will also need to remove the symlink created byjupyter labextension developcommand. To find its location, you can runjupyter labextension listto figure out where thelabextensionsfolder is located. Then you can remove the symlink namedjupyterlab-flake8within that folder.Packaging the extensionSeeRELEASEAcknowledgmentUsedhttps://github.com/ijmbarr/jupyterlab_spellcheckeras a starting pointContributorsmcnuttandrew