or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

core-functions.mdexceptions.mdindex.mdrepository-holders.mdutilities.mdversion-handling.md
tile.json

tessl/pypi-lastversion

A CLI tool to find the latest stable version of an arbitrary project

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/lastversion@3.5.x

To install, run

npx @tessl/cli install tessl/pypi-lastversion@3.5.0

index.mddocs/

lastversion

A 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.

Package Information

  • Package Name: lastversion
  • Language: Python
  • Installation: pip install lastversion
  • Python Requirements: Python ≥3.6

Core Imports

import lastversion

Most common imports for library usage:

from lastversion import latest, has_update

For version handling:

from lastversion.version import Version

For utilities:

from lastversion.utils import download_file, extract_file

Basic Usage

from 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")

Architecture

lastversion employs a flexible repository holder architecture that enables extensible support for multiple hosting platforms:

  • Core Functions: High-level API functions (latest(), has_update()) that orchestrate version discovery
  • Repository Holders: Platform-specific adapters for GitHub, GitLab, PyPI, etc., each implementing the BaseProjectHolder interface
  • Version Handling: Enhanced Version class extending PEP 440 with intelligent normalization for real-world version inconsistencies
  • Holder Factory: Dynamic holder selection based on repository URL patterns and explicit platform hints
  • Utility Layer: File operations, platform compatibility checks, and installation helpers

This design allows lastversion to handle diverse version formats and repository structures while maintaining a consistent API for consumers.

Capabilities

Core Functions

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): ...

Core Functions

Version Handling

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: ...

Version Handling

Utility Functions

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: ...

Utility Functions

Repository Holders

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): ...

Repository Holders

Exception Handling

Custom exception classes for specific error conditions encountered during version discovery and file operations.

class ApiCredentialsError(Exception): ...
class BadProjectError(Exception): ...
class TarPathTraversalException(Exception): ...

Exception Handling

Types

# 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