Skip to main content

Query PyPI for critical updates available available for your users installation of your package.

Project description

version-tracker

https://img.shields.io/pypi/v/version_tracker.svg https://img.shields.io/travis/prabhakk-mw/version_tracker.svg Documentation Status

Query PyPI for critical updates available available for your users installation of your package.

Details

Import this Python package into your Python packages to query PyPI for critical updates to your package.

This is particularly useful when you would like to notify your users that the version of your package, that they have installed has critical updates that they should update their package.

Requirements

Your package must follow Semantic Versioning.

Given a version number MAJOR.MINOR.PATCH, increment the:

  1. MAJOR version when you make incompatible API changes

  2. MINOR version when you add functionality in a backward compatible manner

  3. PATCH version when you make backward compatible bug fixes

APIs

  1. High Level API

    def get_update_notification(pkg_name: str, severity_level: int = 2) -> str:
  2. Low Level API

    def query(pkg_name: str) -> dict[str, str]:

How to use version-tracker

  1. Add version-tracker to the list of your package’s dependencies.

    # Update your SETUP.PY to include version-tracker as shown:
    INSTALL_REQUIRES = [
            "aiohttp>=3.7.4",
            "psutil",
            "aiohttp_session[secure]",
            "version-tracker",
            ]
  2. Include the module from your source code and use the APIs provided. See example below:

    import version_tracker
    
    # Get the name of your own package
    package_name = str(__name__).split(".")[0]
    
    # Returns a pre-formatted string for use with any logging information, that can be used to warn users of available updates.
    logger.info("HIGH SEVERITY LEVEL log:")
    logger.info(
        version_tracker.get_update_notification(
            package_name, version_tracker.HIGH_SEVERITY_LEVEL
        )
    )
    
    logger.info("MEDIUM SEVERITY LEVEL log:")
    logger.info(
        version_tracker.get_update_notification(
            package_name, version_tracker.MEDIUM_SEVERITY_LEVEL
        )
    )
    
    logger.info("LOW SEVERITY LEVEL log:")
    logger.info(
        version_tracker.get_update_notification(
            package_name, version_tracker.LOW_SEVERITY_LEVEL
        )
    
    # Low Level API:
    
    # Returns version information about the current package.
    version_info = version_tracker.query(package_name)
    
    # version_info is a Dictionary with the following information:
    #  "latest": latest_version,
    #  "is_major": str(major_update),
    #  "is_minor": str(minor_update),
    #  "is_patch": str(patch_update),
    #  "commit_messages": commit_msg,
    
    # Shows the latest version of your package that is available on PyPI
    print(version_info['latest'])
    
    # Shows whether the updates on PyPI are major in Nature. ie: Update found in the MAJOR portion of the Semantic version.
    print(version_info['is_major'])
    
    # Shows any available commit messages related the updates between installed version and latest version.
    print(version_info['commit_messages'])
  3. Sample output from a package that is using the Above APIs and run on an installation which has version 0.1.0, but PyPI has version 0.10.0 installed

History

0.1.0 (2023-11-23)

  • First release on PyPI.

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

version_tracker-0.1.1.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

version_tracker-0.1.1-py2.py3-none-any.whl (6.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file version_tracker-0.1.1.tar.gz.

File metadata

  • Download URL: version_tracker-0.1.1.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for version_tracker-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a6ee15ef6ceca820740e838936a1a0cbd9d60ce4ad7352d44013ff93dfba0cf4
MD5 356c5907b5cca96061e16456d2ed8471
BLAKE2b-256 62611bd3621b7be299b092dce8d5749ad70b8c998f818deaccda92a9c168c943

See more details on using hashes here.

File details

Details for the file version_tracker-0.1.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for version_tracker-0.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 9dad29e655d585b76d31aaa0e5d75f1ceb6bc6beeb877ba16e5620ab5c092409
MD5 04ffbc3137e791032f7a853d218885d8
BLAKE2b-256 6525e1deab52b49608ae0d168e8d30aae8ed97a90631b0ef11bc349faabd85d4

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