Skip to main content

Auto-updater for programs

Reason this release was yanked:

moved to Poetry

Project description

zm-au

zm-au is a developer tool that provides an auto-updating API for programs. Note that this can be a bad idea for many reasons, so you should probably ask the user first.

Sorry for prefixing the name with "zm", but I'm sure I'll have to do that again as I have no creative names for anything anymore.

Usage

zm-au comes with two useful auto-updaters, PipAU and PipGitHubAU, and a class to base an auto-updater off of.

Let's say you are creating a Python package called skippitybop and you want it to notify the user when there is an update available on PyPI for it. Simply insert this code where you want the update check to happen.

from zm_au import PipAU

updater = PipAU("skippitybop")
updater.update(prompt=True)

When the code is run, if there is an update available on PyPI, the user will be prompted to install it via pip. If the user chooses to install it, the program will exit on success. Or failure, for that matter.

Take a guess what prompt=False would do.

Let's say you are creating a Python package called boppityskip on "bigboi"'s GitHub repo and you want it to notify the user when there is an update available on GitHub releases for it, probably because the package is private and not on PyPI. Insert this code where you want the update check to happen.

from zm_au import PipGitHubAU

updater = PipGitHubAU("boppityskip", "bigboi/boppityskip", check_prerelease=True, dist="whl")
updater.update(prompt=True)

When the code is run, if there is an update available on GitHub releases (including prereleases) that is a whl file, the user will be prompted to install it via pip. Again, if the user chooses to install it, the program will exit on success or failure.

You can build your own AUs by making a class that inherits from BaseAU. Override the following functions as such.

  • _get_current_version - Must return the current version of the package
  • _get_latest_version - Must return the latest version of the package
  • _download - Must download the package and return the filename of the downloaded file
  • _update - Must install a package whose location is passed via the only parameter of this function

Be smart about how you use this!

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

zm-au-1.0.1.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

zm_au-1.0.1-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file zm-au-1.0.1.tar.gz.

File metadata

  • Download URL: zm-au-1.0.1.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/54.2.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.4

File hashes

Hashes for zm-au-1.0.1.tar.gz
Algorithm Hash digest
SHA256 efcbd87d17864304ead6d4abf815bd9c3789222810c0c37fbfcee5edf9d30ca4
MD5 1f6d21e7f8e6056d56387b6426ac59c7
BLAKE2b-256 ca44f8c01c77f36d34d3cc96323a498c9a2bd95fcbaafb95a85e28096a6799b5

See more details on using hashes here.

File details

Details for the file zm_au-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: zm_au-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/54.2.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.4

File hashes

Hashes for zm_au-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 118286dce625307ee8e29285cf043d817959fdf4a481e19965b8d863a150cbf9
MD5 f4cdf2fb10a695fe638635167de303b1
BLAKE2b-256 1d2aba3fb27e497fb3d66b6545caac523a950ac4f9f336616634793ee0c38adc

See more details on using hashes here.

Supported by

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