update-checker is a Python module (current version 0.18.0, last updated August 2020) that programmatically checks for updates to Python packages. It provides a simple API to determine if a newer version of a specified package is available. The library's release cadence appears to be infrequent, with the last update several years ago.
pip install update-checkerVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to instantiate the `UpdateChecker` and use its `check` method to query for available updates for a given package and its current version. The `result` object provides details about the update if one is found.
Before integrating, verify if the package you intend to monitor is whitelisted. If not, consider contributing to the project or using an alternative update checking mechanism.
Understand that 'update-checker' is purely for notification. You will need to use `pip` or other package management tools in your deployment process to apply any identified updates.
Exercise caution and thorough testing if using with Python versions released after 2020. Consider alternative, more actively maintained libraries for update checking if this becomes a concern.
Install the package using pip: `pip install update-checker` or ensure you are in the correct virtual environment.
The correct module name for import uses an underscore: `from update_checker import UpdateChecker`.
Always check if the result of `checker.check()` is not `None` before accessing its attributes:
```python
from update_checker import UpdateChecker
checker = UpdateChecker('your-package', '1.0.0')
update_info = checker.check()
if update_info: # Add this check
if update_info.has_update:
print(f'Update available: {update_info.latest_version}')
else:
print('Could not retrieve update information.')
```Ensure both `package_name` and `current_version` are passed as strings to the `UpdateChecker` constructor:
```python
from update_checker import UpdateChecker
# Fix: Ensure all arguments are strings
checker = UpdateChecker('requests', '1.0.0')
update_info = checker.check()
```