nb-mypy


Namenb-mypy JSON
Version 1.0.5 PyPI version JSON
download
home_pagehttps://gitlab.tue.nl/jupyter-projects/nb_mypy
SummaryNb Mypy is a facility to automatically run mypy on Jupyter notebook cells as they are executed, whilst retaining information about the execution history.
upload_time2023-03-17 13:46:03
maintainer
docs_urlNone
authorLars van den Haak, Tom Verhoeff
requires_python>=3.8
licenseMIT
keywords type checking notebooks ipython mypy
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Nb Mypy

_Nb Mypy_ is a facility to automatically run [`mypy`](http://mypy-lang.org/) on Jupyter notebook cells as they are executed, whilst retaining information about the execution history.


## Installation

* _Nb Mypy_ relies on the packages mypy and astor, but those should be automatically installed.
* _Nb Mypy_ can be installed like:
```bash
python3 -m pip install nb_mypy
```

Once installed, you can load it via `%load_ext nb_mypy` in a cell of  a Jupyter notebook using the IPython kernel.

### Installation from source
The package can also be installed from source, using pip:
```bash
python3 -m pip install .
```

## Usage

In Jupyter notebooks where you want to apply
automatic type checking,
you can load this extension to do type checking by executing
(in a code cell) the line magic `%load_ext nb_mypy`.

With the line magic `%nb_mypy` you can modify the behaviour of _Nb Mypy_

Here are the ways to use the line magic `%nb_mypy`
* `%nb_mypy -v`: show version
* `%nb_mypy`: show the current state
* `%nb_mypy On`: enable automatic type checking
* `%nb_mypy Off`: disable automatic type checking
* `%nb_mypy DebugOn`: enable debug mode
* `%nb_mypy DebugOff`: disable debug mode
* `%nb_mypy mypy-options` [OPTIONS]: Provide extra options to mypy (for example --strict)

### Load automatically
This package is an iPython extension, thus it can be loaded automatically by adding the following line to your iPython configuration file.
```python
c.InteractiveShellApp.extensions = ['nb_mypy']
```
The configuration file can (probably) be found at `~/.ipython/profile_default/ipython_config.py` or created by executing `ipython profile create`.
To add options, for instance, always have strict type checking on, you can add the following.
```python
c.InteractiveShellApp.exec_lines = ['%nb_mypy mypy-options --strict']
```


## Examples

For examples, see the Jupyter notebook [`Nb_Mypy.ipynb`](https://gitlab.tue.nl/jupyter-projects/nb_mypy/-/blob/master/Nb_Mypy.ipynb).

            

Raw data

            {
    "_id": null,
    "home_page": "https://gitlab.tue.nl/jupyter-projects/nb_mypy",
    "name": "nb-mypy",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "Type Checking,Notebooks,IPython,MyPy",
    "author": "Lars van den Haak, Tom Verhoeff",
    "author_email": "l.b.vandenhaak@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/ee/1b/c804ec8e3e112d098d4512e031e6382f608df66da2ab2616cd1600652149/nb_mypy-1.0.5.tar.gz",
    "platform": "Linux",
    "description": "# Nb Mypy\n\n_Nb Mypy_ is a facility to automatically run [`mypy`](http://mypy-lang.org/) on Jupyter notebook cells as they are executed, whilst retaining information about the execution history.\n\n\n## Installation\n\n* _Nb Mypy_ relies on the packages mypy and astor, but those should be automatically installed.\n* _Nb Mypy_ can be installed like:\n```bash\npython3 -m pip install nb_mypy\n```\n\nOnce installed, you can load it via `%load_ext nb_mypy` in a cell of  a Jupyter notebook using the IPython kernel.\n\n### Installation from source\nThe package can also be installed from source, using pip:\n```bash\npython3 -m pip install .\n```\n\n## Usage\n\nIn Jupyter notebooks where you want to apply\nautomatic type checking,\nyou can load this extension to do type checking by executing\n(in a code cell) the line magic `%load_ext nb_mypy`.\n\nWith the line magic `%nb_mypy` you can modify the behaviour of _Nb Mypy_\n\nHere are the ways to use the line magic `%nb_mypy`\n* `%nb_mypy -v`: show version\n* `%nb_mypy`: show the current state\n* `%nb_mypy On`: enable automatic type checking\n* `%nb_mypy Off`: disable automatic type checking\n* `%nb_mypy DebugOn`: enable debug mode\n* `%nb_mypy DebugOff`: disable debug mode\n* `%nb_mypy mypy-options` [OPTIONS]: Provide extra options to mypy (for example --strict)\n\n### Load automatically\nThis package is an iPython extension, thus it can be loaded automatically by adding the following line to your iPython configuration file.\n```python\nc.InteractiveShellApp.extensions = ['nb_mypy']\n```\nThe configuration file can (probably) be found at `~/.ipython/profile_default/ipython_config.py` or created by executing `ipython profile create`.\nTo add options, for instance, always have strict type checking on, you can add the following.\n```python\nc.InteractiveShellApp.exec_lines = ['%nb_mypy mypy-options --strict']\n```\n\n\n## Examples\n\nFor examples, see the Jupyter notebook [`Nb_Mypy.ipynb`](https://gitlab.tue.nl/jupyter-projects/nb_mypy/-/blob/master/Nb_Mypy.ipynb).\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Nb Mypy is a facility to automatically run mypy on Jupyter notebook cells as they are executed, whilst retaining information about the execution history.",
    "version": "1.0.5",
    "split_keywords": [
        "type checking",
        "notebooks",
        "ipython",
        "mypy"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ee1bc804ec8e3e112d098d4512e031e6382f608df66da2ab2616cd1600652149",
                "md5": "0532b88dc77cba981ac5130de90f42c4",
                "sha256": "f95244c0b9ea8e0e5924e3e5a4ad07e6c44efb9a005f902c210fed5450765c07"
            },
            "downloads": -1,
            "filename": "nb_mypy-1.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "0532b88dc77cba981ac5130de90f42c4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 7333,
            "upload_time": "2023-03-17T13:46:03",
            "upload_time_iso_8601": "2023-03-17T13:46:03.847695Z",
            "url": "https://files.pythonhosted.org/packages/ee/1b/c804ec8e3e112d098d4512e031e6382f608df66da2ab2616cd1600652149/nb_mypy-1.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-17 13:46:03",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "nb-mypy"
}
        
Elapsed time: 0.04772s