npt-promote


Namenpt-promote JSON
Version 0.1 PyPI version JSON
download
home_page
SummaryMypy plugin to add type promotions between NumPy and builtin data types.
upload_time2024-01-10 19:07:42
maintainer
docs_urlNone
author
requires_python>=3.8
licenseMIT
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 `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": "",
    "name": "npt-promote",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "mypy,typing,numpy",
    "author": "",
    "author_email": "",
    "download_url": "",
    "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 `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.1",
    "project_urls": {
        "Homepage": "https://github.com/pyvista/npt-promote"
    },
    "split_keywords": [
        "mypy",
        "typing",
        "numpy"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "435e0dd9f0b8b2313b0c13302e1ee2ce6b3b6cfca31c42eb8b529b8e6c6f5576",
                "md5": "37c5624821257241bf48c9ad87bdcd0f",
                "sha256": "550bea11867e248b2484d9672c66a082c2832898fcef5637ca0008c0bf8bba1e"
            },
            "downloads": -1,
            "filename": "npt_promote-0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "37c5624821257241bf48c9ad87bdcd0f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 4023,
            "upload_time": "2024-01-10T19:07:42",
            "upload_time_iso_8601": "2024-01-10T19:07:42.354552Z",
            "url": "https://files.pythonhosted.org/packages/43/5e/0dd9f0b8b2313b0c13302e1ee2ce6b3b6cfca31c42eb8b529b8e6c6f5576/npt_promote-0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-10 19:07:42",
    "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"
}
        
Elapsed time: 0.22290s