{"id":13608952,"url":"https://github.com/mlshapiro/jupyterlab-flake8","last_synced_at":"2025-04-12T17:33:23.361Z","repository":{"id":43174540,"uuid":"129121371","full_name":"mlshapiro/jupyterlab-flake8","owner":"mlshapiro","description":"Jupyterlab python linter for notebooks and text files using flake8","archived":false,"fork":false,"pushed_at":"2021-09-16T16:01:09.000Z","size":1119,"stargazers_count":111,"open_issues_count":8,"forks_count":10,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-03-19T11:53:54.449Z","etag":null,"topics":["flake8","jupyterlab","jupyterlab-extension","python"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mlshapiro.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-11T16:16:59.000Z","updated_at":"2024-10-24T00:49:44.000Z","dependencies_parsed_at":"2022-08-31T01:22:50.552Z","dependency_job_id":null,"html_url":"https://github.com/mlshapiro/jupyterlab-flake8","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlshapiro%2Fjupyterlab-flake8","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlshapiro%2Fjupyterlab-flake8/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlshapiro%2Fjupyterlab-flake8/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlshapiro%2Fjupyterlab-flake8/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mlshapiro","download_url":"https://codeload.github.com/mlshapiro/jupyterlab-flake8/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248605425,"owners_count":21132168,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flake8","jupyterlab","jupyterlab-extension","python"],"created_at":"2024-08-01T19:01:31.275Z","updated_at":"2025-04-12T17:33:18.351Z","avatar_url":"https://github.com/mlshapiro.png","language":"TypeScript","funding_links":[],"categories":["JupyterLab扩展","Integrations"],"sub_categories":[],"readme":"# Jupyterlab-flake8\n\n[![Github Actions Status](https://github.com/mlshapiro/jupyterlab-flake8/workflows/Build/badge.svg)](https://github.com/mlshapiro/jupyterlab-flake8/actions/workflows/build.yml)\n\nJupyterlab extension to lint python notebooks and python files in the text editor. Uses [`flake8`](http://flake8.pycqa.org/en/latest/) python library for linting.\n\n\u003e Note: This extension will only work if you can load the terminal in jupyterlab\n\n\u003cimg src=\"img/example.png\" /\u003e\n\n\u003cimg src=\"img/editor-example.png\" /\u003e\n\n## Prerequisites\n\n- JupyterLab \u003e= 3.x\n\n```bash\n$ conda install jupyterlab  # if using conda\n$ pip install jupyterlab    # if using pip\n```\n\n- [`flake8`](http://flake8.pycqa.org/en/latest/) python package\n\n```bash\n$ conda install flake8   # if using conda\n$ pip install flake8     # if using pip\n```\n\n## Installation\n\nFor JupyterLab 3.x:\n\n```bash\npip install jupyterlab_flake8\n```\n\nFor JupyterLab 2.x:\n\n```bash\njupyter labextension install jupyterlab-flake8@0.6.1\n```\n\n## Uninstall\n\nTo remove the extension, execute:\n\n```bash\npip uninstall jupyterlab_flake8\n```\n\n## Usage\n\nWhen 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.\n\nThe 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.\n\n## Settings\n\nPlugin is configured in the Jupyter Lab _Advanced Settings_.\nIf you are using a specific conda environment, you must explicitly set this environment in the `conda_env` variable of the plugin settings.\n\n\u003cimg src=\"img/settings.png\" /\u003e\n\nToggle shortcuts are also available in the view menu:\n\n- Enable Flake8\n  - Turns on or off linting in the notebook\n- Output Flake8 Browser Console Logs\n  - Turn on browser console logs for debugging the extension\n\n\u003cimg src=\"img/options.png\" width=\"300\" /\u003e\n\n## Configure Flake8\n\nThe notebook linter is configured the same way as the `flake8` command line tool. See the [`flake8` project configuration documentation](http://flake8.pycqa.org/en/latest/user/configuration.html#project-configuration) for all options.\n\nAs an example, if you want to ignore certain warnings:\n\n- Create `.flake8` file in the same directory as the notebook\n- Specify a `[flake8]` block in a valid INI format\n\n```ini\n[flake8]\nignore =\n    F812,   # list comprehension redefines\n    H101    # Use TODO(NAME)\nexclude =\n    .git,\n    __pycache__,\n    docs/source/conf.py,\n    dist\nmax-complexity = 10\n```\n\nThe `flake8` linter will then use this configuration in the notebook.\n\n## Contributing\n\n### Development install\n\nNote: You will need NodeJS to build the extension package.\n\nThe `jlpm` command is JupyterLab's pinned version of\n[yarn](https://yarnpkg.com/) that is installed with JupyterLab. You may use\n`yarn` or `npm` in lieu of `jlpm` below.\n\n```bash\n# Clone the repo to your local environment\n# Change directory to the jupyterlab_flake8 directory\n# Install package in development mode\npip install -e .\n\n# Link your development version of the extension with JupyterLab\njupyter labextension develop . --overwrite\n\n# Rebuild extension Typescript source after making changes\njlpm run build\n```\n\nYou 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.\n\n```bash\n# Watch the source directory in one terminal, automatically rebuilding when needed\njlpm run watch\n\n# Run JupyterLab in another terminal\njupyter lab\n```\n\nWith 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).\n\nBy default, the `jlpm run build` command 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:\n\n```bash\njupyter lab build --minimize=False\n```\n\n### Development uninstall\n\n```bash\npip uninstall jupyterlab_flake8\n```\n\nIn development mode, you will also need to remove the symlink created by `jupyter labextension develop`\ncommand. To find its location, you can run `jupyter labextension list` to figure out where the `labextensions`\nfolder is located. Then you can remove the symlink named `jupyterlab-flake8` within that folder.\n\n### Packaging the extension\n\nSee [RELEASE](RELEASE.md)\n\n## Acknowledgment\n\n- Used https://github.com/ijmbarr/jupyterlab_spellchecker as a starting point\n\n## Contributors\n\n- [mcnuttandrew](https://github.com/mcnuttandrew)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmlshapiro%2Fjupyterlab-flake8","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmlshapiro%2Fjupyterlab-flake8","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmlshapiro%2Fjupyterlab-flake8/lists"}