Name | pyvista-mypy-plugin JSON |
Version |
0.1
JSON |
| download |
home_page | None |
Summary | Mypy plugin for the PyVista project. |
upload_time | 2024-12-11 21:02:04 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
license | MIT |
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": "pyvista-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": "Mypy plugin for the PyVista project.",
"version": "0.1",
"project_urls": {
"Homepage": "https://github.com/pyvista/pyvista-mypy-plugin"
},
"split_keywords": [
"mypy",
" typing"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "488e8827341a857909b788abb9d0d54bebcd75ff5c6caf83d25fa12099c0dba0",
"md5": "801c9d5dc9257d200c49fd14161b9c8b",
"sha256": "2c093dfff9c1a947a2467552b1449a1df402e015059fc329e3011b4b237ae650"
},
"downloads": -1,
"filename": "pyvista_mypy_plugin-0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "801c9d5dc9257d200c49fd14161b9c8b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 3997,
"upload_time": "2024-12-11T21:02:04",
"upload_time_iso_8601": "2024-12-11T21:02:04.901981Z",
"url": "https://files.pythonhosted.org/packages/48/8e/8827341a857909b788abb9d0d54bebcd75ff5c6caf83d25fa12099c0dba0/pyvista_mypy_plugin-0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-11 21:02:04",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "pyvista",
"github_project": "pyvista-mypy-plugin",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pyvista-mypy-plugin"
}