Skip to main content

A alternative pip magic to jupyter's %pip. It shows if you need to restart python after %smart_pip install

Project description

Smart pip magic

A alternative pip magic to jupyter's %pip. It shows if you need to restart python after %pip install based on if existing imported modules are affected.

Install

pip install smart-pip-magic

Usage

Enable smart pip:

import smart_pip
%pip install [opts] [list of package specifications]

At the end of pip standard output, it will alert you if need to restart python and list all affected imported modules.

Add action hook to act on affected imported modules by the end of %pip install. If no such module is found, hooks are not invoked.

import smart_pip
def hook(modules_whose_files_changed: Callable[[List[str]], None]) -> None:
    print('hook called on ' + str(modules_whose_files_changed))
smart_pip.add_reload_hook(hook)

Testing

pip install .[dev]
pytest

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

smart_pip_magic-0.1.2.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

smart_pip_magic-0.1.2-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file smart_pip_magic-0.1.2.tar.gz.

File metadata

  • Download URL: smart_pip_magic-0.1.2.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for smart_pip_magic-0.1.2.tar.gz
Algorithm Hash digest
SHA256 66e742c8cfff1b9a742853d91fe1f7779a4db0817d35f478de5c9f52b0c3d00c
MD5 ec31829ab39059e400dc8874dd22319c
BLAKE2b-256 e5e8c986d38d35345a71f6d50502c9aebfef50230da2c1356853b66e2f5587f2

See more details on using hashes here.

File details

Details for the file smart_pip_magic-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for smart_pip_magic-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 04afbfe0a46a9f7d0ed710afd226f5c74c3af59e08fa01f67042fa1a3f0c1fa0
MD5 a23682de77639fa63667e6646a3bc1de
BLAKE2b-256 80112f45aac58e1984edd11d929c78221531e1ce784717b628bd3cb481580b24

See more details on using hashes here.

Supported by

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