Skip to content
πŸ“¬ Send a notification when there is an update available for your package
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.editorconfig
.gitignore
LICENSE
Pipfile
Pipfile.lock
README.rst
example.py
setup.py
update_notipy.py

README.rst

πŸ“¬ update-notipy

Send a notification when there is an update available for your package! Py-port of update-notifier.

Install

pipenv install update_notipy

or

pip install update_notipy

Usage

from update_notipy import update_notify

update_notify(
    <pkg_name>,
    <pkg_version>,
    callback=<callback>,
    message=<message>,
    defer=<True|False>).notify()

Arguments

  • pkg_name: str: name of the package as registered on PyPI
  • pkg_version: str: version of the installed package, to be compared with the latest one
  • callback: Callable: function to be called instead of printing the standard message
  • message: str: custom message to be printed
  • defer: bool: set to True if you want to notify the user when the app closes

Examples

from update_notipy import update_notify

__version__ = "0.1.0"

update_notify('pkg-info', __version__).notify()

#    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
#    β”‚                                           β”‚
#    β”‚   Update available 0.1.0 β†’ 0.1.2          β”‚
#    β”‚   Run pip install -U pkg-info to update   β”‚
#    β”‚                                           β”‚
#    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

def foo():
    four = 2 + 2
    print(four)

update_notify('pkg-info', __version__, callback=foo).notify()

# 4

update_notify('pkg-info', __version__, message="Hello, world!").notify()

# Hello, world!
You can’t perform that action at this time.