Mypy plugin for the PyVista project.
Project description
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:
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:
Install it with:
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:
[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:
[tool.mypy]
plugins = [
'pyvista_mypy_plugin',
]
Testing
First, install pyvista-mypy-plugin with dev requirements:
python -m pip install pyvista-mypy-plugin[dev]
To run the tests, execute:
pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyvista_mypy_plugin-0.2.dev0-py3-none-any.whl.
File metadata
- Download URL: pyvista_mypy_plugin-0.2.dev0-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6fee66fe989a31daaf6a914effaac4798ae1896fa57dbd13b98f322c9aaccc20
|
|
| MD5 |
c0ef70b30ca1055883f2525c5078af88
|
|
| BLAKE2b-256 |
46ad44bb99f76fc5fe09294934de052d09ba334fdbfdb9af85a5a7c9f08a7e8a
|