A package to include linters in Databricks notebooks: pycodestyle
Project description
Linters magic
Magic function for pycodestyle module in Jupyter-Lab or Databricks notebooks.
Current version: 0.1.6
Versions of dependencies:
- python: 3.8
- pycodestyle: 2.8.0
- ipython: 8.1.1
Note that we've tested it only on Databricks notebooks
Installation
pip install lintersmagic
Usage
Enable the magic function by using the lintersmagic module in a cell
%load_ext lintersmagic
To check a cell once:
use the function as first line in your cell to check compliance with pycodestyle as such:
%%pycodestyle
To auto check each cell:
If you want this compliance checking turned on by default for each cell then run this magic line function in an empty cell:
%pycodestyle_on
You only need to call this once (observe the single %).
To turn off the auto-checking for each cell use:
%pycodestyle_off
Config options for %pycodestyle_on (version >= 0.5)
- The option
--ignoreor-iwill add the the named error(s) to the ignore list
Example to ignore the errors E225 and E265:
%pycodestyle_on --ignore E225,E265
Remember to avoid spaces between declaring multiple errors.
- With the option
--max_line_lengthor-mthe max-line-length can be customised.
Example to set the line length to 119 characters instead of the default 79:
%pycodestyle_on --max_line_length 119
The options can be combined as well.
See notebooks in notebook directory for example use cases, as such:
Pycodestyle (notebook)
Contribution
Dependencies and package
Handled by Poetry (documentation)
To get a new package:
poetry build
To install the dependencies:
poetry install
To publish a new version:
poetry publish
Tests
poetry run ipython tests/*.py
Useful links
-
This project adds a magic function in Ipython. Here is the documentation: Built-in magic commands
-
This project uses a callback with magic functions. Here is the documentation: IPython Events
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lintersmagic-0.1.6.tar.gz.
File metadata
- Download URL: lintersmagic-0.1.6.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.7 CPython/3.8.5 Linux/5.13.0-35-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75a99cc90982badf252700aa09e8b9c952b3618a02886010086642a6f199a3ab
|
|
| MD5 |
447455e6830b04fa1a1cdba057b57111
|
|
| BLAKE2b-256 |
bb202f9c9f33ecceac56db638abb7c31c0e534c41e1863a73ec99380ea534705
|
File details
Details for the file lintersmagic-0.1.6-py3-none-any.whl.
File metadata
- Download URL: lintersmagic-0.1.6-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.7 CPython/3.8.5 Linux/5.13.0-35-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07f802a9980eebcb19a3e364ed6412b0539375d5cd4ea99f8f6e0863923afd80
|
|
| MD5 |
cdfabae222c64d9ea9bb1635cefc8c44
|
|
| BLAKE2b-256 |
79e5311a3b324602de4a9d8593debcb2ec2c6064327d5168fc349032ad11ada0
|