Skip to main content

Auto-updater for programs

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-2.0.0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

zm_au-2.0.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file zm_au-2.0.0.tar.gz.

File metadata

  • Download URL: zm_au-2.0.0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.4 Darwin/22.5.0

File hashes

Hashes for zm_au-2.0.0.tar.gz
Algorithm Hash digest
SHA256 00e02bd6526e0ed25466f4b1f28b31838e2057ec2cc568fdcd269c4aa90c228a
MD5 748b5476f452b58f440250c978f07ea5
BLAKE2b-256 6269548927e0e6cc7c4b2e204e012805cabc745c3a7410d4468c80041551670b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: zm_au-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.4 Darwin/22.5.0

File hashes

Hashes for zm_au-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9be8498fd5c80b1682b99dfca1385fb71f2840db35d8bac17740a97b0f2db10e
MD5 5e643ea4b68cd70024efa462ed526a4a
BLAKE2b-256 67dc39247872b90b49b34d6641792f27a47ff11851e39ed04f547b711ad942ed

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