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.4
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
--ignore
or-i
will 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_length
or-m
the 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
Hashes for lintersmagic-0.1.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c47f592dd3692c4d5d1e84e4c3d725c56ba67ab8a3de84f602ccc3853aa6ca5 |
|
MD5 | 4886bc4c1728ecad07f0a32b0b293017 |
|
BLAKE2b-256 | 056aee7c0482ef9a0c5143e6b2e75e7f0037d7e6d8b7f0183add6d37064af117 |