pyright-polite


Namepyright-polite JSON
Version 1.0.4 PyPI version JSON
download
home_page
SummaryAn intelligent cross-platform wrapper for pyright that makes it less noisy.
upload_time2023-04-10 13:21:10
maintainer
docs_urlNone
author
requires_python>=3.7
license
keywords pyright quiet
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pyright-polite

[![PyPi Version][pypi-img]][pypi-url]
[![License][license-img]][license-url]
[![Continuous Integration][ci-img]][ci-url]
[![Code Coverage][coverage-img]][coverage-url]
[![Python Versions][python-img]][python-url]

[pypi-img]: https://img.shields.io/pypi/v/pyright-polite.svg
[pypi-url]: https://pypi.org/project/pyright-polite
[license-img]:  https://img.shields.io/github/license/jamielinux/pyright-polite.svg
[license-url]: https://github.com/jamielinux/pyright-polite/blob/main/LICENSE
[ci-img]: https://github.com/jamielinux/pyright-polite/actions/workflows/ci.yml/badge.svg
[ci-url]: https://github.com/jamielinux/pyright-polite/actions/workflows/ci.yml
[coverage-img]: https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/jamielinux/ed2d4df7c2b137ac89778db60ef8894f/raw/pyright-polite.covbadge.json
[coverage-url]: https://github.com/jamielinux/pyright-polite/actions/workflows/ci.yml
[python-img]: https://img.shields.io/pypi/pyversions/pyright-polite.svg
[python-url]: https://pypi.org/project/pyright-polite

---

**pyright-polite** is an intelligent cross-platform wrapper for [pyright][0] that makes
it less noisy.

Force pyright to be more respectful with your attention :rotating_light:

[0]: https://github.com/microsoft/pyright

## What does it do?

With **pyright-polite**:

```console
$ pyright-polite
Found 7 source files
0 errors, 0 warnings, 0 informations
```

Without:

```console
$ pyright
WARNING: there is a new pyright version available (v1.1.300 -> v1.1.301).
Please install the new version or set PYRIGHT_PYTHON_FORCE_VERSION to `latest`

No configuration file found.
pyproject.toml file found at /projects/pyright_polite.
Loading pyproject.toml file at /projects/pyright_polite/pyproject.toml
Assuming Python version 3.11
Assuming Python platform Linux
Auto-excluding **/node_modules
Auto-excluding **/__pycache__
Auto-excluding **/.*
stubPath /projects/pyright_polite/typings is not a valid directory.
Searching for source files
Found 7 source files
pyright 1.1.300
0 errors, 0 warnings, 0 informations
Completed in 1.006sec
```

Now pyright is just as polite as your other tools:

```console
$ hatch run lint
cmd [1] | - ruff check .
cmd [2] | - black --quiet --check --diff .
cmd [3] | - pyright-polite
Found 8 source files
0 errors, 0 warnings, 0 informations
cmd [4] | - ssort --check --diff .
8 files would be left unchanged
```

Error messages are still shown (eg, if your pyright config file is invalid).

## Installation

You need `pyright` installed (ie, available somewhere in your `PATH`).

See pyright's installation instructions [here][installation]. Usually people install
either the [pyright npm][pkg_npm] or the [pyright PyPI][pkg_pypi] package.

```console
$ npm install pyright  # alternatively: pip install pyright
$ pip install pyright-polite
```

Linux, macOS and Windows are all supported.

[pkg_pypi]: https://pypi.org/project/pyright/
[pkg_npm]: https://www.npmjs.com/package/pyright
[installation]: https://microsoft.github.io/pyright/#/installation

## Usage

**pyright-polite** takes the same arguments as pyright.

```console
$ pyright-polite -h
Usage: pyright-polite [options] files...
  Options:
  --createstub <IMPORT>              Create type stub file(s) for import
  --dependencies                     Emit import dependency information
  -h,--help                          Show this help message
  --ignoreexternal                   Ignore external imports for --verifytypes
  --lib                              Use library code to infer types when stubs are missing
  --level <LEVEL>                    Minimum diagnostic level (error or warning)
  --outputjson                       Output results in JSON format
  -p,--project <FILE OR DIRECTORY>   Use the configuration file at this location
  --pythonplatform <PLATFORM>        Analyze for a specific platform (Darwin, Linux, Windows)
  --pythonversion <VERSION>          Analyze for a specific version (3.3, 3.4, etc.)
  --skipunannotated                  Skip analysis of functions with no type annotations
  --stats                            Print detailed performance stats
  -t,--typeshed-path <DIRECTORY>     Use typeshed type stubs at this location
  -v,--venv-path <DIRECTORY>         Directory that contains virtual environments
  --verbose                          Emit verbose diagnostics
  --verifytypes <PACKAGE>            Verify type completeness of a py.typed package
  --version                          Print Pyright version
  --warnings                         Use exit code of 1 if warnings are reported
  -w,--watch                         Continue to run and watch for changes


  Note: pyright-polite does not filter output from `--dependencies` or `--stats`.

```

## How does it work?

**pyright-polite** is hilariously over-engineered, but robust.

It aims to display everything in exactly the same format and colorisation as pyright
(minus the useless messages), and takes advantage of pyright's `--outputjson` option
when possible. It launches `pyright` as a subprocess and reads from both stderr and
stdout using `asyncio` tasks, which means that `--watch` is also supported.

For insight into what messages get hidden, see the [`print_filtered`][print_filtered]
method.

[print_filtered]: https://github.com/jamielinux/pyright-polite/blob/main/src/pyright_polite/pyright.py#L183-L233

## Isn't this a bit overkill?

Yes :rofl:

It was primarily a fun weekend project to learn `asyncio`.

## Why is pyright so noisy?

If you're wondering why `pyright` has to remind us that `typings is not a valid
directory` (among other useless messages) on literally every single launch, see
[pyright #4594][issue4594] for what the developers have to say:

> The current information output by the cli is there for a reason.

[issue4594]: https://github.com/microsoft/pyright/issues/4594

## License

`pyright-polite` is distributed under the terms of the [MIT][license] license.

[license]: https://spdx.org/licenses/MIT.html

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "pyright-polite",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "pyright,quiet",
    "author": "",
    "author_email": "Jamie Nguyen <j@jamielinux.com>",
    "download_url": "https://files.pythonhosted.org/packages/e8/04/9f66694b8c4dcf09bdb7205cfe83f13a721d1daa1f2db466ab1c617873cd/pyright_polite-1.0.4.tar.gz",
    "platform": null,
    "description": "# pyright-polite\n\n[![PyPi Version][pypi-img]][pypi-url]\n[![License][license-img]][license-url]\n[![Continuous Integration][ci-img]][ci-url]\n[![Code Coverage][coverage-img]][coverage-url]\n[![Python Versions][python-img]][python-url]\n\n[pypi-img]: https://img.shields.io/pypi/v/pyright-polite.svg\n[pypi-url]: https://pypi.org/project/pyright-polite\n[license-img]:  https://img.shields.io/github/license/jamielinux/pyright-polite.svg\n[license-url]: https://github.com/jamielinux/pyright-polite/blob/main/LICENSE\n[ci-img]: https://github.com/jamielinux/pyright-polite/actions/workflows/ci.yml/badge.svg\n[ci-url]: https://github.com/jamielinux/pyright-polite/actions/workflows/ci.yml\n[coverage-img]: https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/jamielinux/ed2d4df7c2b137ac89778db60ef8894f/raw/pyright-polite.covbadge.json\n[coverage-url]: https://github.com/jamielinux/pyright-polite/actions/workflows/ci.yml\n[python-img]: https://img.shields.io/pypi/pyversions/pyright-polite.svg\n[python-url]: https://pypi.org/project/pyright-polite\n\n---\n\n**pyright-polite** is an intelligent cross-platform wrapper for [pyright][0] that makes\nit less noisy.\n\nForce pyright to be more respectful with your attention :rotating_light:\n\n[0]: https://github.com/microsoft/pyright\n\n## What does it do?\n\nWith **pyright-polite**:\n\n```console\n$ pyright-polite\nFound 7 source files\n0 errors, 0 warnings, 0 informations\n```\n\nWithout:\n\n```console\n$ pyright\nWARNING: there is a new pyright version available (v1.1.300 -> v1.1.301).\nPlease install the new version or set PYRIGHT_PYTHON_FORCE_VERSION to `latest`\n\nNo configuration file found.\npyproject.toml file found at /projects/pyright_polite.\nLoading pyproject.toml file at /projects/pyright_polite/pyproject.toml\nAssuming Python version 3.11\nAssuming Python platform Linux\nAuto-excluding **/node_modules\nAuto-excluding **/__pycache__\nAuto-excluding **/.*\nstubPath /projects/pyright_polite/typings is not a valid directory.\nSearching for source files\nFound 7 source files\npyright 1.1.300\n0 errors, 0 warnings, 0 informations\nCompleted in 1.006sec\n```\n\nNow pyright is just as polite as your other tools:\n\n```console\n$ hatch run lint\ncmd [1] | - ruff check .\ncmd [2] | - black --quiet --check --diff .\ncmd [3] | - pyright-polite\nFound 8 source files\n0 errors, 0 warnings, 0 informations\ncmd [4] | - ssort --check --diff .\n8 files would be left unchanged\n```\n\nError messages are still shown (eg, if your pyright config file is invalid).\n\n## Installation\n\nYou need `pyright` installed (ie, available somewhere in your `PATH`).\n\nSee pyright's installation instructions [here][installation]. Usually people install\neither the [pyright npm][pkg_npm] or the [pyright PyPI][pkg_pypi] package.\n\n```console\n$ npm install pyright  # alternatively: pip install pyright\n$ pip install pyright-polite\n```\n\nLinux, macOS and Windows are all supported.\n\n[pkg_pypi]: https://pypi.org/project/pyright/\n[pkg_npm]: https://www.npmjs.com/package/pyright\n[installation]: https://microsoft.github.io/pyright/#/installation\n\n## Usage\n\n**pyright-polite** takes the same arguments as pyright.\n\n```console\n$ pyright-polite -h\nUsage: pyright-polite [options] files...\n  Options:\n  --createstub <IMPORT>              Create type stub file(s) for import\n  --dependencies                     Emit import dependency information\n  -h,--help                          Show this help message\n  --ignoreexternal                   Ignore external imports for --verifytypes\n  --lib                              Use library code to infer types when stubs are missing\n  --level <LEVEL>                    Minimum diagnostic level (error or warning)\n  --outputjson                       Output results in JSON format\n  -p,--project <FILE OR DIRECTORY>   Use the configuration file at this location\n  --pythonplatform <PLATFORM>        Analyze for a specific platform (Darwin, Linux, Windows)\n  --pythonversion <VERSION>          Analyze for a specific version (3.3, 3.4, etc.)\n  --skipunannotated                  Skip analysis of functions with no type annotations\n  --stats                            Print detailed performance stats\n  -t,--typeshed-path <DIRECTORY>     Use typeshed type stubs at this location\n  -v,--venv-path <DIRECTORY>         Directory that contains virtual environments\n  --verbose                          Emit verbose diagnostics\n  --verifytypes <PACKAGE>            Verify type completeness of a py.typed package\n  --version                          Print Pyright version\n  --warnings                         Use exit code of 1 if warnings are reported\n  -w,--watch                         Continue to run and watch for changes\n\n\n  Note: pyright-polite does not filter output from `--dependencies` or `--stats`.\n\n```\n\n## How does it work?\n\n**pyright-polite** is hilariously over-engineered, but robust.\n\nIt aims to display everything in exactly the same format and colorisation as pyright\n(minus the useless messages), and takes advantage of pyright's `--outputjson` option\nwhen possible. It launches `pyright` as a subprocess and reads from both stderr and\nstdout using `asyncio` tasks, which means that `--watch` is also supported.\n\nFor insight into what messages get hidden, see the [`print_filtered`][print_filtered]\nmethod.\n\n[print_filtered]: https://github.com/jamielinux/pyright-polite/blob/main/src/pyright_polite/pyright.py#L183-L233\n\n## Isn't this a bit overkill?\n\nYes :rofl:\n\nIt was primarily a fun weekend project to learn `asyncio`.\n\n## Why is pyright so noisy?\n\nIf you're wondering why `pyright` has to remind us that `typings is not a valid\ndirectory` (among other useless messages) on literally every single launch, see\n[pyright #4594][issue4594] for what the developers have to say:\n\n> The current information output by the cli is there for a reason.\n\n[issue4594]: https://github.com/microsoft/pyright/issues/4594\n\n## License\n\n`pyright-polite` is distributed under the terms of the [MIT][license] license.\n\n[license]: https://spdx.org/licenses/MIT.html\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "An intelligent cross-platform wrapper for pyright that makes it less noisy.",
    "version": "1.0.4",
    "split_keywords": [
        "pyright",
        "quiet"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "861fb71804d2100ff349f90d5c96723cbedc7121411c61672711e02169fb5a23",
                "md5": "b4d2acd973eb42ba6f6bf31d64261679",
                "sha256": "e272728d8633b53f3e01e5277423c8ef32f47098faa83e2d0be3de322e32093b"
            },
            "downloads": -1,
            "filename": "pyright_polite-1.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b4d2acd973eb42ba6f6bf31d64261679",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 16422,
            "upload_time": "2023-04-10T13:21:09",
            "upload_time_iso_8601": "2023-04-10T13:21:09.022362Z",
            "url": "https://files.pythonhosted.org/packages/86/1f/b71804d2100ff349f90d5c96723cbedc7121411c61672711e02169fb5a23/pyright_polite-1.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e8049f66694b8c4dcf09bdb7205cfe83f13a721d1daa1f2db466ab1c617873cd",
                "md5": "a05b7a39b59e5b5d21ac26bfcd68eb6d",
                "sha256": "1ee150ca7bebb5d0b56192bec019a903467407fb7ae7567de96626af52015df6"
            },
            "downloads": -1,
            "filename": "pyright_polite-1.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "a05b7a39b59e5b5d21ac26bfcd68eb6d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 17299,
            "upload_time": "2023-04-10T13:21:10",
            "upload_time_iso_8601": "2023-04-10T13:21:10.232818Z",
            "url": "https://files.pythonhosted.org/packages/e8/04/9f66694b8c4dcf09bdb7205cfe83f13a721d1daa1f2db466ab1c617873cd/pyright_polite-1.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-10 13:21:10",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "pyright-polite"
}
        
Elapsed time: 0.05754s