A CLI tool to find the latest stable version of an arbitrary project
npx @tessl/cli install tessl/pypi-lastversion@3.5.0A comprehensive Python CLI tool and library that helps developers and system administrators determine the latest stable version of software projects across multiple platforms and repositories. It intelligently handles inconsistent version formatting, filters out pre-releases, and provides programmatic access to version information from GitHub, GitLab, BitBucket, PyPI, Mercurial, SourceForge, Wikipedia, WordPress plugin directory, and RSS/ATOM feeds.
pip install lastversionimport lastversionMost common imports for library usage:
from lastversion import latest, has_updateFor version handling:
from lastversion.version import VersionFor utilities:
from lastversion.utils import download_file, extract_filefrom lastversion import latest, has_update
# Get the latest version of a project
latest_version = latest("mautic/mautic")
print(f"Latest Mautic version: {latest_version}")
# Check if an update is available
current_version = "1.2.3"
update_available = has_update("mautic/mautic", current_version)
if update_available:
print(f"Update available: {update_available}")
else:
print("No update available")
# Get version information as dictionary
version_info = latest("mautic/mautic", output_format="dict")
print(f"Release info: {version_info}")
# Check PyPI packages specifically
latest_requests = latest("requests", at="pip")
print(f"Latest requests version: {latest_requests}")
# Download the latest release
latest("apache/incubator-pagespeed-ngx", output_format="source")lastversion employs a flexible repository holder architecture that enables extensible support for multiple hosting platforms:
latest(), has_update()) that orchestrate version discoveryThis design allows lastversion to handle diverse version formats and repository structures while maintaining a consistent API for consumers.
Primary API functions for version discovery and update checking. These functions provide the main interface for determining latest versions across multiple platforms and checking for available updates.
def latest(repo, output_format="version", pre_ok=False, assets_filter=None, short_urls=False, major=None, only=None, at=None, having_asset=None, exclude=None, even=False, formal=False): ...
def has_update(repo, current_version, pre_ok=False, at=None): ...
def check_version(value): ...Enhanced version class and utilities for parsing, normalizing, and comparing software versions. Extends PEP 440 with intelligent handling of real-world version inconsistencies.
class Version(PackagingVersion):
def __init__(self, version: str): ...
@staticmethod
def special_cases_transformation(version: str) -> str: ...File operations, platform compatibility checks, and system integration utilities. Includes download, extraction, and installation helpers for retrieved software releases.
def download_file(url: str, local_filename: str = None) -> str: ...
def extract_file(url: str, to_dir: str = ".") -> Any: ...
def rpm_installed_version(name: str) -> str: ...Platform-specific adapters for different hosting services and package repositories. Each holder implements specialized logic for parsing version information from its respective platform.
class HolderFactory:
HOLDERS: dict
DEFAULT_HOLDER: str
@staticmethod
def get_instance_for_repo(repo: str, at: str = None): ...Custom exception classes for specific error conditions encountered during version discovery and file operations.
class ApiCredentialsError(Exception): ...
class BadProjectError(Exception): ...
class TarPathTraversalException(Exception): ...# Version type that extends packaging.version.Version with additional normalization
class Version(PackagingVersion):
def __init__(self, version: str): ...
def __str__(self) -> str: ...
def __eq__(self, other) -> bool: ...
def __lt__(self, other) -> bool: ...
def __le__(self, other) -> bool: ...
def __gt__(self, other) -> bool: ...
def __ge__(self, other) -> bool: ...
# Base repository holder interface
class BaseProjectHolder:
CACHE_DISABLED: bool
# Holder factory for creating platform-specific handlers
class HolderFactory:
HOLDERS: dict[str, type]
DEFAULT_HOLDER: str