Skip to content

[Code scan] Declare IPython dependency for notebook integration #128

Description

@njzjz

This issue was found by a Codex global code scan of the repository.

Affected code:

dargs/dargs/notebook.py

Lines 27 to 32 in b4db564

from IPython.display import HTML, display
from dargs import Argument, Variant
from dargs.dargs import _resolve_ref
__all__ = ["JSON"]

dargs/pyproject.toml

Lines 18 to 22 in b4db564

dependencies = [
"typeguard>=4",
'typing_extensions; python_version < "3.8"',
]
requires-python = ">=3.7"

dargs/pyproject.toml

Lines 30 to 43 in b4db564

[project.optional-dependencies]
test = [
"ipython",
"jsonschema",
"pyyaml",
]
typecheck = [
"ty==0.0.17",
"sphinx",
"ipython",
]
yaml = [
"pyyaml",
]

dargs/README.md

Lines 28 to 34 in b4db564

## Additional features
- [PEP 484](https://peps.python.org/pep-0484/) type annotations
- Native integration with [Sphinx](https://github.com/sphinx-doc/sphinx), [DP-GUI](https://github.com/deepmodeling/dpgui), and [Jupyter Notebook](https://jupyter.org/)
- JSON encoder for `Argument` and `Variant` classes
- Generate [JSON schema](https://json-schema.org/) from an `Argument`, which can be further integrated with JSON editors such as [Visual Studio Code](https://code.visualstudio.com/)
- Load dict values from external JSON/YAML files via the `$ref` key

Problem:
The README advertises native Jupyter Notebook integration, and dargs.notebook imports IPython.display at module import time. However, IPython is only listed under the test and typecheck extras, not as a runtime dependency or a notebook extra.

Reproducer in a minimal runtime environment without IPython:

from dargs.notebook import JSON

Observed behavior:

ModuleNotFoundError: No module named 'IPython'

Expected behavior:
Either declare a dedicated notebook extra such as dargs[notebook] that includes IPython and document it, or make dargs.notebook fail with a clear optional-dependency message.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions