Name | npt-promote JSON |
Version |
0.2
JSON |
| download |
home_page | None |
Summary | Mypy plugin to add type promotions between NumPy and builtin data types. |
upload_time | 2024-12-09 18:02:35 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | MIT |
keywords |
mypy
typing
numpy
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# npt-promote
Mypy plugin to add type promotions between NumPy and builtin data types.
The main use case for this plugin is to enable generic use of `bool`, `int` and `float`
type annotations with NumPy arrays, e.g.
``` python
import numpy as np
import numpy.typing as npt
x: npt.NDArray[float] = np.array((42.0))
```
## Installation
Dependencies:
- [mypy](https://github.com/python/mypy)
- [NumPy](https://github.com/numpy/numpy)
Install it with:
``` bash
python -m pip install npt-promote
```
Alternatively, add `npt-promote` as a project dependency wherever `mypy` is used,
e.g. as an optional dev requirement in `pyproject.toml`:
``` toml
[project.optional-dependencies]
dev = ["mypy", "npt-promote"]
```
## Usage
To enable the plugin, it must be added to your project's mypy configuration file
along with NumPy's mypy plugin. E.g. add the following to `pyproject.toml`:
``` toml
[tool.mypy]
plugins = [
'numpy.typing.mypy_plugin',
'npt_promote',
]
```
## pre-commit
To use the plugin with `mypy` as a `pre-commit` hook, it must be added as a
dependency, e.g. add the following to `.pre-commit-config.yaml`:
``` yaml
- repo: https://github.com/pre-commit/mirrors-mypy
hooks:
- id: mypy
additional_dependencies: [
"npt-promote"
]
```
## Testing
First, install `npt-promote` with dev requirements:
``` bash
python -m pip install npt-promote[dev]
```
To run the tests, execute:
``` bash
pytest
```
Raw data
{
"_id": null,
"home_page": null,
"name": "npt-promote",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "mypy, typing, numpy",
"author": null,
"author_email": null,
"download_url": null,
"platform": null,
"description": "# npt-promote\nMypy plugin to add type promotions between NumPy and builtin data types.\n\nThe main use case for this plugin is to enable generic use of `bool`, `int` and `float`\ntype annotations with NumPy arrays, e.g.\n\n``` python\nimport numpy as np\nimport numpy.typing as npt\n\nx: npt.NDArray[float] = np.array((42.0))\n```\n\n## Installation\n\nDependencies:\n- [mypy](https://github.com/python/mypy)\n- [NumPy](https://github.com/numpy/numpy)\n\nInstall it with:\n\n``` bash\npython -m pip install npt-promote\n```\n\nAlternatively, add `npt-promote` as a project dependency wherever `mypy` is used,\ne.g. as an optional dev requirement in `pyproject.toml`:\n\n``` toml\n[project.optional-dependencies]\ndev = [\"mypy\", \"npt-promote\"]\n```\n\n## Usage\n\nTo enable the plugin, it must be added to your project's mypy configuration file\nalong with NumPy's mypy plugin. E.g. add the following to `pyproject.toml`:\n\n``` toml\n[tool.mypy]\nplugins = [\n 'numpy.typing.mypy_plugin',\n 'npt_promote',\n]\n```\n\n## pre-commit\nTo use the plugin with `mypy` as a `pre-commit` hook, it must be added as a\ndependency, e.g. add the following to `.pre-commit-config.yaml`:\n``` yaml\n- repo: https://github.com/pre-commit/mirrors-mypy\n hooks:\n - id: mypy\n additional_dependencies: [\n \"npt-promote\"\n ]\n```\n\n## Testing\n\nFirst, install `npt-promote` with dev requirements:\n``` bash\npython -m pip install npt-promote[dev]\n```\n\nTo run the tests, execute:\n``` bash\npytest\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Mypy plugin to add type promotions between NumPy and builtin data types.",
"version": "0.2",
"project_urls": {
"Homepage": "https://github.com/pyvista/npt-promote"
},
"split_keywords": [
"mypy",
" typing",
" numpy"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0e79b6c4b8021e60b5a2927a9109350b19a88eb006111a6739af92e5f56c7a96",
"md5": "3dd10459f7685c20c7da3622c404bbd2",
"sha256": "f501cdcebf5fd98980dfa7da318300fcbef1024cd2728d416380fe43dc7f2e88"
},
"downloads": -1,
"filename": "npt_promote-0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3dd10459f7685c20c7da3622c404bbd2",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 4061,
"upload_time": "2024-12-09T18:02:35",
"upload_time_iso_8601": "2024-12-09T18:02:35.142431Z",
"url": "https://files.pythonhosted.org/packages/0e/79/b6c4b8021e60b5a2927a9109350b19a88eb006111a6739af92e5f56c7a96/npt_promote-0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-09 18:02:35",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "pyvista",
"github_project": "npt-promote",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "npt-promote"
}