Skip to main content

Nb Mypy is a facility to automatically run mypy on Jupyter notebook cells as they are executed, whilst retaining information about the execution history.

Project description

Nb Mypy

Nb Mypy is a facility to automatically run mypy 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:
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 is build via PyPA's build, make sure you have the latest available via

python3 -m pip install --upgrade build

You can then build the package from the current directory where pyproject.toml is located:

python3 -m build

Now you can install it using

python3 -m pip install --no-index --find-links=./dist nb_mypy

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

Examples

For examples, see the Jupyter notebook Nb_Mypy.ipynb.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nb_mypy-1.0.3.tar.gz (7.0 kB view hashes)

Uploaded Source

Built Distribution

nb_mypy-1.0.3-py3-none-any.whl (7.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page