Skip to content

Commit

Permalink
feat: 'notebook' extra requirement with nbformat
Browse files Browse the repository at this point in the history
Simplifies `pip install radon nbformat` to `pip install radon[notebook]`.
Protects against changing underlying dependency in future.
  • Loading branch information
kieran-ryan committed Dec 23, 2024
1 parent 9a94514 commit 9df08f0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
8 changes: 5 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ With Pip:
$ pip install radon
If you want to configure Radon from `pyproject.toml` and you run Python <3.11,
you'll need the extra `toml` dependency:
you will need to install the extra `toml` dependency:

.. code-block:: sh
Expand Down Expand Up @@ -159,9 +159,11 @@ Usage with Jupyter Notebooks

Radon can be used with ``.ipynb`` files to inspect code metrics for Python cells. Any ``%`` macros will be ignored in the metrics.

.. note::
You will need to install the extra `notebook` dependency:

Jupyter Notebook support requires the optional ``nbformat`` package. To install, run ``pip install nbformat``.
.. code-block:: sh
$ pip install radon[notebook]
To enable scanning of Jupyter notebooks, add the ``--include-ipynb`` flag.

Expand Down
6 changes: 4 additions & 2 deletions docs/commandline.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@ Usage with Jupyter Notebooks

Radon can be used with ``.ipynb`` files to inspect code metrics for Python cells. Any ``%`` macros will be ignored in the metrics.

.. note::
You will need to install the extra `notebook` dependency:

.. code-block:: sh
Jupyter Notebook support requires the optional ``nbformat`` package. To install, run ``pip install nbformat``.
$ pip install radon[notebook]
To enable scanning of Jupyter notebooks, add the ``--include-ipynb`` flag with any of the commands.

Expand Down
5 changes: 4 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import os

from setuptools import setup, find_packages

import radon


Expand Down Expand Up @@ -27,7 +29,8 @@
'colorama>=0.4.1;python_version>"3.4"',
],
extras_require={
'toml': ["tomli>=2.0.1"]
'toml': ["tomli>=2.0.1"],
'notebook': ['nbformat'],
},
entry_points={
'console_scripts': ['radon = radon:main'],
Expand Down

0 comments on commit 9df08f0

Please sign in to comment.