Skip to main content

Pyre linting plugin for pylsp

Project description

python-lsp-pyre

This is a plugin for the Python LSP Server.

It implements support for calling Meta's Pyre type checker via a subprocess.

Installation

To use this plugin, you need to install this plugin in the same virtualenv as python-lsp-server itself.

pip install python-lsp-pyre

or to make it a development requirement in Poetry

poetry add -G dev python-lsp-pyre

Then run python-lsp-server as usual, the plugin will be auto-discovered by python-lsp-server if you've installed it to the right environment. Refer to python-lsp-server and your IDE/text editor documentation on how to setup python-lsp-server. The plugin's default enabled status is True.

Editor integration

Configuration

Meta's Pyre uses .pyre_configuration files in your project to set up lint controls. It does not read pyproject.toml.

On first run of this plugin, it will detect a missing .pyre_configuration and write out one for you if the create-pyre-config configuration option is enabled. It relies on the workspace root passed to the language server for this write. This file is not immutable, and the reference documentation may be useful.

You can also use pyre init instead to set up the configuration.

The configuration written by this plugin is:

{
    "site_package_search_strategy": "all",
    "source_directories": [
        "."
    ],
    "exclude": [
        "/setup.py",
        ".*/build/.*"
    ]
}

The noteable difference from pyre init is the change to the search strategy (pep561 to all).

If the file is not present, the LSP error log, LSP output, and your editor's LSP messages will display an ABEND message containing the error from Pyre as it fails to run.

Features

This plugin adds the following features to python-lsp-server:

  • Type linting via Meta's Pyre (pyre-check)

Developing

Install development dependencies with (you might want to create a virtualenv first):

git clone https://github.com/cricalix/python-lsp-pyre python-lsp-pyre
cd python-lsp-pyre
pip install -e '.[dev]'

Alterately, if you use Poetry,

git clone https://github.com/cricalix/python-lsp-pyre python-lsp-pyre
cd python-lsp-pyre
poetry install

will set up a virtualenv if necessary, install all dependencies, and then install this project in editable/development mode.

Contributing

This plugin was written to scratch an itch. If you find it useful, great!

If something about it annoys you, or you think there's a better way to do something, you're welcome to send a PR.

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_pyre-0.1.2.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

python_lsp_pyre-0.1.2-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file python_lsp_pyre-0.1.2.tar.gz.

File metadata

  • Download URL: python_lsp_pyre-0.1.2.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for python_lsp_pyre-0.1.2.tar.gz
Algorithm Hash digest
SHA256 23f34e4d5c5917a67004f500ad36d438ba537301118e265ab77bac3f2bfdb6ba
MD5 0b9810dcc46d965314c8d357611d2a68
BLAKE2b-256 5a873f2a602ff65b9f82d1b9c9f5fdb910c94b8bc7fa715ba23d1519c9b74567

See more details on using hashes here.

File details

Details for the file python_lsp_pyre-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for python_lsp_pyre-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ced7453b9dd6839cedda6fd5af66af6aa3b7179932bd8e2d88fe159c67d4491f
MD5 346f81a432dc85bbe31c1d89eeba7e68
BLAKE2b-256 daa124bb996c2736c7b4c5fc94f525a4e2dedefd967c4336ef70706e92713c3e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page