ducktype-mypy-plugin


Nameducktype-mypy-plugin JSON
Version 0.2.dev1 PyPI version JSON
download
home_pageNone
SummaryDuck-typing plugin for mypy.
upload_time2024-12-17 21:08:51
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseMIT
keywords mypy typing
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pyvista-mypy-plugin
Mypy plugin for the PyVista project.

This plugin is primarily used for type-promotion between related classes that do not
inherit from each other. For example, the abstract class `pyvista.DataSet` does not
inherit from `vtk.vtkDataSet`, and will generate type errors wherever a `vtk.vtkDataSet`
is expected. Without this plugin, the following is a type error:

``` python
from pyvista import DataSet
from vtkmodules.vtkCommonDataModel import vtkDataSet

x: vtkDataSet
x = DataSet()  # error: Incompatible types in assignment (expression has type "DataSet", variable has type "vtkDataSet")'
```

(Note that the example above is not valid at runtime since `DataSet` is an abstract
class and cannot be instantiated.)

With this plugin, `DataSet` is promoted as type `vtkDataSet`, allowing `DataSet`
type to be used wherever `vtkDataSet` is used.

## Installation

Dependencies:
- [mypy](https://github.com/python/mypy)
- [pyvista](https://github.com/pyvista/pyvista)
- [vtk](https://pypi.org/project/vtk/)

Install it with:

``` bash
python -m pip install pyvista-mypy-plugin
```

Alternatively, add `pyvista-mypy-plugin` as a project dependency wherever `mypy` is
used, e.g. as an optional dev requirement in `pyproject.toml`:

``` toml
[project.optional-dependencies]
dev = ["mypy", "pyvista-mypy-plugin"]
```

## Usage

To enable the plugin, it must be added to your project's mypy configuration file.
E.g. add the following to `pyproject.toml`:

``` toml
[tool.mypy]
plugins = [
  'pyvista_mypy_plugin',
]
```

## Testing

First, install `pyvista-mypy-plugin` with dev requirements:
``` bash
python -m pip install pyvista-mypy-plugin[dev]
```

To run the tests, execute:
``` bash
pytest
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "ducktype-mypy-plugin",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "mypy, typing",
    "author": null,
    "author_email": null,
    "download_url": null,
    "platform": null,
    "description": "# pyvista-mypy-plugin\nMypy plugin for the PyVista project.\n\nThis plugin is primarily used for type-promotion between related classes that do not\ninherit from each other. For example, the abstract class `pyvista.DataSet` does not\ninherit from `vtk.vtkDataSet`, and will generate type errors wherever a `vtk.vtkDataSet`\nis expected. Without this plugin, the following is a type error:\n\n``` python\nfrom pyvista import DataSet\nfrom vtkmodules.vtkCommonDataModel import vtkDataSet\n\nx: vtkDataSet\nx = DataSet()  # error: Incompatible types in assignment (expression has type \"DataSet\", variable has type \"vtkDataSet\")'\n```\n\n(Note that the example above is not valid at runtime since `DataSet` is an abstract\nclass and cannot be instantiated.)\n\nWith this plugin, `DataSet` is promoted as type `vtkDataSet`, allowing `DataSet`\ntype to be used wherever `vtkDataSet` is used.\n\n## Installation\n\nDependencies:\n- [mypy](https://github.com/python/mypy)\n- [pyvista](https://github.com/pyvista/pyvista)\n- [vtk](https://pypi.org/project/vtk/)\n\nInstall it with:\n\n``` bash\npython -m pip install pyvista-mypy-plugin\n```\n\nAlternatively, add `pyvista-mypy-plugin` as a project dependency wherever `mypy` is\nused, e.g. as an optional dev requirement in `pyproject.toml`:\n\n``` toml\n[project.optional-dependencies]\ndev = [\"mypy\", \"pyvista-mypy-plugin\"]\n```\n\n## Usage\n\nTo enable the plugin, it must be added to your project's mypy configuration file.\nE.g. add the following to `pyproject.toml`:\n\n``` toml\n[tool.mypy]\nplugins = [\n  'pyvista_mypy_plugin',\n]\n```\n\n## Testing\n\nFirst, install `pyvista-mypy-plugin` with dev requirements:\n``` bash\npython -m pip install pyvista-mypy-plugin[dev]\n```\n\nTo run the tests, execute:\n``` bash\npytest\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Duck-typing plugin for mypy.",
    "version": "0.2.dev1",
    "project_urls": {
        "Homepage": "https://github.com/pyvista/ducktype-mypy-plugin"
    },
    "split_keywords": [
        "mypy",
        " typing"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9d3bdf557d60945ae72e54594ea6533f9ddecc4e3d029f6af589fe30a0ef061f",
                "md5": "64433a2047718a900fa42ef8bd2ac2b4",
                "sha256": "0326374829ea3f34033d90ef11cc550e3d3281f273f74cf1465689fe26b98a79"
            },
            "downloads": -1,
            "filename": "ducktype_mypy_plugin-0.2.dev1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "64433a2047718a900fa42ef8bd2ac2b4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 5834,
            "upload_time": "2024-12-17T21:08:51",
            "upload_time_iso_8601": "2024-12-17T21:08:51.824264Z",
            "url": "https://files.pythonhosted.org/packages/9d/3b/df557d60945ae72e54594ea6533f9ddecc4e3d029f6af589fe30a0ef061f/ducktype_mypy_plugin-0.2.dev1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-17 21:08:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pyvista",
    "github_project": "ducktype-mypy-plugin",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "ducktype-mypy-plugin"
}
        
Elapsed time: 0.44792s