nbproject.dev.infer_pypackages#

nbproject.dev.infer_pypackages(content, add_pkgs=None, pin_versions=True)#

Parse notebook object and infer all pypackages.

This does not account for additional packages in file metadata.

For the user-facing functionality, see pypackage().

Parameters:
  • content (Notebook) – A notebook to infer pypackages from.

  • add_pkgs (Optional[Iterable], default: None) – Additional packages to add.

  • pin_versions (bool, default: True) – If True, fixes versions from the current environment.

Examples

>>> pypackages = nbproject.dev.infer_pypackages(nb)
>>> pypackages
{"scanpy": "1.8.7", "pandas": "1.4.3"}