Black plugin for the Python LSP Server
Project description
python-lsp-black
Black plugin for the Python LSP Server.
Install
In the same virtualenv
as python-lsp-server
:
pip install python-lsp-black
Usage
To avoid unexpected results you should make sure yapf
and autopep8
are not installed.
python-lsp-black
can either format an entire file or just the selected text.- The code will only be formatted if it is syntactically valid Python.
- Text selections are treated as if they were a separate Python file. Unfortunately this means you can't format an indented block of code.
python-lsp-black
will use your project's pyproject.toml if it has one.
Development
To install the project for development you need to specify the dev optional dependencies:
python -m venv .venv
. .venv/bin/activate
pip install -e .[dev]
This project uses pre-commit hooks to control code quality, install them to run them when creating a git commit, thus avoiding seeing errors when you create a pull request:
pre-commit install
To run tests:
make test
To run linters:
make lint # just a shortcut to pre-commit run -a
make <linter_name> # black, flake8, isort, mypy
To upgrade the version of the pre-commit hooks:
pre-commit autoupdate
# check and git commit changes to .pre-commit-config.yaml
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
python-lsp-black-1.0.1.tar.gz
(4.6 kB
view hashes)
Built Distribution
Close
Hashes for python_lsp_black-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62a5f2f5dd1fcaead9e3ba9407cdb00024c50c461903a23c7bc7c01ee123d248 |
|
MD5 | f55b43626ac62673158df1e5815cd982 |
|
BLAKE2b-256 | eea40b4b62c368747d33e6d0a7fc7f47138b6aa7506340342321fc6fc691ddfd |