### Install lastversion via pip Source: https://github.com/dvershinin/lastversion/blob/master/README.md The easiest way to install lastversion is by using pip, the Python package installer. Ensure you have pip available. ```bash pip install lastversion ``` -------------------------------- ### Install Packages with `lastversion` CLI Source: https://context7.com/dvershinin/lastversion/llms.txt Install the latest version of packages as RPM, deb, or AppImage. For AppImages, they are typically installed to the user's Applications directory. ```bash sudo lastversion install mailspring sudo lastversion install fluent-reader # installs AppImage to ~/Applications/ ``` -------------------------------- ### lastversion Configuration File Example Source: https://context7.com/dvershinin/lastversion/llms.txt Example YAML configuration for lastversion, specifying cache and backend settings. Supports file or Redis backends. ```yaml # ~/.config/lastversion/lastversion.yml cache: # Release data cache: stores parsed JSON release data with TTL release_cache: enabled: true ttl: 3600 # seconds (1 hour) # Cache backend: "file" (default) or "redis" backend: file file: path: null # null = OS default (~/.cache/lastversion) max_age: 86400 # Auto-cleanup: remove entries older than 24 h max_size: 104857600 # 100 MB # Redis backend (requires: pip install lastversion[redis]) redis: url: "redis://localhost:6379/0" # takes precedence over host/port host: localhost port: 6379 db: 0 password: null key_prefix: "lastversion:" ``` -------------------------------- ### Install AppImage Source: https://github.com/dvershinin/lastversion/blob/master/README.md Fetch and install the latest AppImage for a project. The AppImage is a self-contained Linux executable. `lastversion` installs it under `~/Applications/` and makes it executable. ```bash lastversion install fluent-reader ``` -------------------------------- ### Install lastversion via YUM (RPM-based systems) Source: https://github.com/dvershinin/lastversion/blob/master/README.md Install lastversion on CentOS, RHEL, Fedora, or Amazon Linux using YUM. This involves adding a repository and then installing the package. ```bash sudo yum -y install https://extras.getpagespeed.com/release-latest.rpm sudo yum -y install lastversion ``` -------------------------------- ### Example GitHub Source Tarball URL Source: https://github.com/dvershinin/lastversion/wiki/Use-in-automatic-RPM-building An example of a GitHub source tarball URL for the apache/incubator-pagespeed-ngx repository, highlighting the release tag. ```text https://github.com/apache/incubator-pagespeed-ngx/archive/v1.13.35.2-stable/incubator-pagespeed-ngx-v1.13.35.2-stable.tar.gz ``` -------------------------------- ### Generated RPM Spec File Example Source: https://github.com/dvershinin/lastversion/wiki/Use-in-automatic-RPM-building An example of a generated .spec file after processing with lastversion and jinja2, showing the updated version and source URL. ```spec Name: ipsum Version: 1.0.1 URL: https://github.com/lorem/ipsum Source0: %{url}/archive/v%{version}/%{name}-v%{version}.tar.gz ... %prep %autosetup -n %{name}-%{version} ... ``` -------------------------------- ### Get Latest Release by Owner/Name Source: https://github.com/dvershinin/lastversion/blob/master/README.md An equivalent invocation using the owner/name format of the repository. ```bash lastversion gperftools/gperftools ``` -------------------------------- ### Automate RPM Installation with Cron Source: https://github.com/dvershinin/lastversion/blob/master/README.md Set up an auto-updater cron job to ensure a package is always on its latest RPM version. This will automatically install newer `.rpm` releases. ```bash @daily /usr/bin/lastversion install mailspring -y 2>/dev/null ``` -------------------------------- ### Install RPM Asset Source: https://github.com/dvershinin/lastversion/blob/master/README.md Install an RPM asset for a project if your system has `yum` or `dnf`. This command finds the latest release, filters for `.rpm` assets, and passes them to the package manager. ```bash sudo lastversion install mailspring ``` -------------------------------- ### Get pre-release version Source: https://github.com/dvershinin/lastversion/blob/master/README.md Use the --pre switch to retrieve the version of the latest pre-release if no stable release is available or if you specifically want the pre-release version. ```bash lastversion --pre mautic/mautic ``` -------------------------------- ### Generated RPM Spec File Example Source: https://github.com/dvershinin/lastversion/wiki/Use-in-automatic-RPM-building An example of a generated RPM spec file using dynamic versioning information, including a stable tag. ```spec %global upstream_version 1.13.35.2 %global upstream_name incubator-pagespeed-ngx URL: https://github.com/apache/incubator-pagespeed-ngx Source0: %{url}/archive/v%{upstream_version}-stable/%{upstream_name}-v%{upstream_version}-stable.tar.gz .... %autosetup -n %{upstream_name}-%{upstream_version}-stable ``` -------------------------------- ### Get Latest Release by Repository URL Source: https://github.com/dvershinin/lastversion/blob/master/README.md Pass the repository URL as the sole argument to find the latest release. ```bash lastversion https://github.com/gperftools/gperftools ``` -------------------------------- ### Get Latest Version from GitHub Source: https://github.com/dvershinin/lastversion/blob/master/README.md Use this command to fetch the latest stable version of a project hosted on GitHub. The output is the version string. ```bash lastversion apache/incubator-pagespeed-ngx #> 1.13.35.2 ``` -------------------------------- ### Get specific release details using branch notation Source: https://github.com/dvershinin/lastversion/blob/master/README.md Combine the branch notation with flags like --assets to retrieve details for a specific release version. ```bash lastversion php:7.2.33 --assets ``` -------------------------------- ### Use lastversion_dir in %prep section Source: https://github.com/dvershinin/lastversion/blob/master/docs/spec-preparing.md Utilize the `lastversion_dir` macro within the `%prep` section to correctly specify the extracted directory name, ensuring proper build setup. ```rpmspec %prep %autosetup -n %{lastversion_dir} ``` -------------------------------- ### RPM spec file preparation for lastversion Source: https://context7.com/dvershinin/lastversion/llms.txt Example of an RPM spec file configured to work with lastversion. It uses %global macros to define upstream details and versioning constraints. ```rpmspec # mypackage.spec – prepared for lastversion %global upstream_github google %global upstream_name brotli %global lastversion_tag x # filled by lastversion %global lastversion_dir x # filled by lastversion %global lastversion_sem patch # only allow patch updates Name: brotli Version: 1.1.0 Release: 1%{?dist} URL: https://github.com/%{upstream_github}/%{name} Source0: %{url}/archive/%{lastversion_tag}/%{name}-%{lastversion_tag}.tar.gz License: MIT %prep %autosetup -n %{lastversion_dir} ``` -------------------------------- ### Get Version String (Text) Source: https://github.com/dvershinin/lastversion/blob/master/docs/api.md Retrieves only the version string of the latest release as plain text. ```APIDOC ## GET /text/version ### Description Returns only the version string corresponding to the latest release. ### Method GET ### Endpoint `/text/version?project=project_id` ### Parameters #### Query Parameters - **project** (string) - Required - The identifier for the project (e.g., `linux`, `nginx`, `WordPress/WordPress`). - **major** (string) - Optional - Filters results to a specific major version (e.g., `4` to get the last 4.x version). ### Request Example ```bash curl -X GET "https://lastversion.p.rapidapi.com/text/version?project=torvalds/linux" \ -H "X-RapidAPI-Key: YOUR_RAPIDAPI_KEY" \ -H "X-RapidAPI-Host: lastversion.p.rapidapi.com" ``` ### Response #### Success Response (200) - (string) - The version string of the latest release. #### Response Example ``` 6.12 ``` ``` -------------------------------- ### Get Latest Version from a URL Source: https://github.com/dvershinin/lastversion/blob/master/README.md Fetch the latest stable version of a project directly from its website URL. This is useful for projects not hosted on common repositories. ```bash lastversion https://transmissionbt.com/ #> 3.0 ``` -------------------------------- ### Commercial RapidAPI - Get Asset URLs Source: https://context7.com/dvershinin/lastversion/llms.txt Retrieve a list of asset URLs for a project's release. ```APIDOC ## Asset URLs ### Description Fetches a list of URLs for all assets associated with a project's latest release. ### Method GET ### Endpoint `https://lastversion.p.rapidapi.com/assets?project=` ### Parameters #### Query Parameters - **project** (string) - Required - The project identifier (e.g., `telegramdesktop/tdesktop`). #### Headers - **X-RapidAPI-Key** (string) - Required - Your RapidAPI key. - **X-RapidAPI-Host** (string) - Required - `lastversion.p.rapidapi.com`. ### Request Example ```bash curl -X GET "https://lastversion.p.rapidapi.com/assets?project=telegramdesktop/tdesktop" \ -H "X-RapidAPI-Key: YOUR_RAPIDAPI_KEY" \ -H "X-RapidAPI-Host: lastversion.p.rapidapi.com" ``` ### Response #### Success Response (200) - **assets** (array) - A list of asset objects, each containing details like `name` and `url`. ### Response Example ```json { "assets": [ { "name": "tsetup-x64.exe", "url": "https://github.com/.../tsetup-x64.exe" }, { "name": "..." } ] } ``` ``` -------------------------------- ### Get asset URLs from RapidAPI Source: https://context7.com/dvershinin/lastversion/llms.txt Retrieve a list of asset URLs for a project's releases from the commercial RapidAPI. Requires API key and host headers. ```bash curl -X GET "https://lastversion.p.rapidapi.com/assets?project=telegramdesktop/tdesktop" \ -H "X-RapidAPI-Key: YOUR_RAPIDAPI_KEY" \ -H "X-RapidAPI-Host: lastversion.p.rapidapi.com" ``` -------------------------------- ### RPM Spec File Versioning Source: https://github.com/dvershinin/lastversion/wiki/Use-in-automatic-RPM-building Example of how to define version and source in an RPM spec file when the release tag differs from the version number. ```spec Version: 1.14.0.0 Source0: https://github.com/apache/incubator-pagespeed-ngx/archive/v%{version}.tar.gz#/incubator-pagespeed-ngx-%{version} ``` -------------------------------- ### Get asset URLs for download Source: https://github.com/dvershinin/lastversion/blob/master/README.md Use the --assets flag to output URLs for all assets of the latest release. These URLs can be piped to download utilities like wget. ```bash wget $(lastversion --assets mautic/mautic) ``` -------------------------------- ### Get Project Version from PyPI Source: https://github.com/dvershinin/lastversion/blob/master/README.md Fetch the latest version of a Python project hosted on PyPI by providing its URL. Ensure the `--at pip` switch is used for shorter repository names. ```bash lastversion https://pypi.org/project/requests/ lastversion requests --at pip ``` -------------------------------- ### Get Latest Version Information Source: https://github.com/dvershinin/lastversion/blob/master/README.md Use `lastversion.latest` to retrieve the latest version information for a repository. The `output_format='version'` returns a Version object, suitable for comparisons. ```python from lastversion import latest from packaging import version latest_mautic_version = latest("mautic/mautic", output_format='version', pre_ok=True) print(f'Latest Mautic version: {latest_mautic_version}') if latest_mautic_version >= version.parse('1.8.1'): print('It is newer') ``` -------------------------------- ### lastversion CLI Exit Codes for Scripting Source: https://context7.com/dvershinin/lastversion/llms.txt Examples of lastversion CLI commands and their corresponding exit codes (0-4) for success, failure, comparison results, and errors, useful for shell scripting. ```bash # Exit 0: success / version found / leftmost arg is NEWER than -gt arg lastversion nginx/nginx echo $? # 0 # Exit 1: no release found or repo does not exist lastversion nonexistent-owner/nonexistent-repo echo $? # 1 # Exit 2: -gt comparison — rightmost arg is NEWER (no update available) lastversion 1.2.4 -gt 1.2.3 echo $? # 0 (1.2.4 is newer → update "needed") lastversion 1.2.3 -gt 1.2.4 echo $? # 2 (1.2.3 is NOT newer than 1.2.4 → no update) # Exit 3: --assets filter matched nothing lastversion telegramdesktop/tdesktop --assets --filter nonexistent echo $? # 3 # Exit 4: API credentials error or semver constraint violation lastversion mypackage.spec --sem patch # exits 4 if only minor/major bump found echo $? # 4 # Practical scripting pattern CURRENT="1.2.3" LATEST=$(lastversion nginx/nginx -gt "$CURRENT") case $? in 0) echo "Update to $LATEST" ;; 2) echo "Already on latest" ;; 1) echo "Lookup failed" ;; esac ``` -------------------------------- ### Get Latest Release Details as Dictionary Source: https://github.com/dvershinin/lastversion/blob/master/README.md When `output_format='dict'` is used with `lastversion.latest`, a dictionary containing release details like version, source, tag date, URL, and tag name is returned. This is useful for programmatic access to release metadata. ```python from lastversion import latest release_info = latest("owner/repo", output_format='dict') # Example of accessing dictionary keys: # print(release_info['version']) # print(release_info['tag_date']) ``` -------------------------------- ### Get Latest Release Version with lastversion.latest() Source: https://context7.com/dvershinin/lastversion/llms.txt Retrieve the latest stable version of a project. Supports various output formats and filtering options. Use `pre_ok=True` to include pre-releases. ```python from lastversion import latest from packaging import version # --- 1. Get a Version object (default) --- v = latest("mautic/mautic") print(v) # e.g. 5.1.1 print(type(v)) # ``` ```python # --- 2. Include pre-releases --- v_pre = latest("mautic/mautic", pre_ok=True) print(v_pre) # e.g. 5.2.0b1 ``` ```python # --- 3. Constrain to a major branch --- php72 = latest("php/php-src", major="7.2") print(php72) # 7.2.34 # Using colon shorthand in CLI: lastversion php:7.2 ``` ```python # --- 4. Full release dict (GitHub) --- release = latest("dvershinin/lastversion", output_format="dict") print(release["version"]) # Version object print(release["tag_name"]) # e.g. "v3.6.10" print(release["source_url"]) # tarball download URL print(release["assets"]) # list of asset download URLs print(release["source"]) # "github" print(release["tag_date"]) # "2024-11-01 12:00:00" ``` ```python # --- 5. JSON-serializable dict --- import json release_json = latest("nginx/nginx", output_format="json") print(json.dumps(release_json, indent=2)) ``` ```python # --- 6. Source tarball URL --- src_url = latest("mautic/mautic", output_format="source") print(src_url) # https://github.com/mautic/mautic/archive/5.1.1/mautic-5.1.1.tar.gz ``` ```python # --- 7. Asset download URLs --- assets = latest("telegramdesktop/tdesktop", output_format="assets") for url in assets: print(url) ``` ```python # --- 8. Tag name only --- tag = latest("openssl/openssl", output_format="tag") print(tag) # e.g. "openssl-3.3.1" ``` ```python # --- 9. Only consider releases whose tag contains "chart" --- chart_v = latest( "https://github.com/lastversion-test-repos/autoscaler", only="chart" ) print(chart_v) # 9.16.0 ``` ```python # --- 10. Exclude releases containing "chart" --- no_chart = latest( "https://github.com/lastversion-test-repos/autoscaler", exclude="chart" ) print(no_chart) # 1.23.0 ``` ```python # --- 11. Only even (stable) minor versions like Linux kernel --- even_v = latest("torvalds/linux", even=True) print(even_v) ``` ```python # --- 12. PyPI project --- requests_v = latest("requests", at="pip") print(requests_v) # e.g. 2.31.0 ``` ```python # --- 13. Wikipedia (OS versions) --- rocky_v = latest("rocky", at="wiki") print(rocky_v) # e.g. 9.4 ``` ```python # --- 14. Skip release cache for fresh data --- fresh = latest("nginx/nginx", skip_release_cache=True) ``` ```python # --- 15. Custom cache TTL (requires cache enabled in config) --- cached = latest("nginx/nginx", cache_ttl=7200) ``` -------------------------------- ### Clone Project and Set Up Virtual Environment Source: https://github.com/dvershinin/lastversion/blob/master/BUILD.md Clone the project repository and create a virtual environment for isolated dependency management. Activate the virtual environment before proceeding. ```bash git clone ... lastversion && cd lastversion # we need a virtualenv for latest pip, setuptools or things will choke on Markdown description virtualenv venv # activate the virtualenv . venv/bin/activate # update pip pip install -U pip setuptools twine ``` -------------------------------- ### Lastversion CLI Help Output Source: https://github.com/dvershinin/lastversion/blob/master/README.md Displays all available command-line options for controlling output and behavior, including actions, filtering, and formatting. ```text usage: lastversion [-h] [--pre] [--sem {major,minor,patch,any}] [-v] [-d [FILENAME]] [--format {version,assets,source,json,tag}] [--assets] [--source] [-gt VER] [-b MAJOR] [--only REGEX] [--exclude REGEX] [--filter REGEX] [--having-asset [ASSET]] [-su] [--even] [--changelog] [--at {github,gitlab,bitbucket,pip,hg,sf,website-feed,local,helm_chart,wiki,system,wp,gitea}] [-y] [--version] [{get,download,extract,unzip,test,format,install,update-spec}] Find the latest software release. positional arguments: {get,download,extract,unzip,test,format,install,update-spec} Action to run. Default: get Repository in format owner/name or any URL that belongs to it, or a version string optional arguments: -h, --help show this help message and exit --pre Include pre-releases in potential versions --sem {major,minor,patch,any} Semantic versioning level base to print or compare against -v, --verbose Will give you an idea of what is happening under the hood, -vv to increase verbosity level -d [FILENAME], -o [FILENAME], --download [FILENAME], --output [FILENAME] Download with custom filename --format {version,assets,source,json,tag} Output format --assets Returns assets download URLs for last release --source Returns only source URL for last release -gt VER, --newer-than VER Output only if last version is newer than given version -b MAJOR, --major MAJOR, --branch MAJOR Only consider releases of a specific major version, e.g. 2.1.x --only REGEX Only consider releases containing this text. Useful for repos with multiple projects inside --exclude REGEX Only consider releases NOT containing this text. Useful for repos with multiple projects inside --even Only even versions like 1.[2].x, or 3.[6].x are considered as stable --filter REGEX Filters --assets result by a regular expression --having-asset [ASSET] Only consider releases with this asset -su, --shorter-urls A tiny bit shorter URLs produced --at {github,gitlab,bitbucket,pip,hg,sf,website-feed,local,helm_chart,wiki,system,wp,gitea} If the repo argument is one word, specifies where to look up the project. The default is via internal lookup or GitHub Search -y, --assumeyes Automatically answer yes for all questions --version show program's version number and exit --changelog Generate RPM %changelog entry (1–7 concise bullets) ``` -------------------------------- ### Get full JSON release info from public API Source: https://context7.com/dvershinin/lastversion/llms.txt Retrieve comprehensive release information for a GitHub repository in JSON format using the public API. Results are cached for 2 hours. ```bash curl https://lastversion-api.getpagespeed.com/dvershinin/lastversion ``` -------------------------------- ### Download Latest WordPress Release (bash) Source: https://github.com/dvershinin/lastversion/blob/master/docs/api.md This script combines fetching the source URL using curl and then downloading the tarball using wget. It automates the process of getting the latest release. Requires RapidAPI key and host headers. ```bash wget $(curl -X GET "https://lastversion.p.rapidapi.com/text/source?project=WordPress/WordPress" -H "X-RapidAPI-Key: YOUR_RAPIDAPI_KEY" -H "X-RapidAPI-Host: lastversion.p.rapidapi.com") ``` -------------------------------- ### Get Only Version Number Source: https://github.com/dvershinin/lastversion/blob/master/docs/api.md Append '?version' to the URL to get only the version number of the repository. ```APIDOC ## GET /?version ### Description Retrieves only the latest version number of a GitHub repository. ### Method GET ### Endpoint `https://lastversion-api.getpagespeed.com/?version` ### Parameters #### Path Parameters - **github-repo** (string) - Required - The GitHub repository in the format 'owner/repo'. #### Query Parameters - **version** (boolean) - Optional - If present, returns only the version string. ### Response #### Success Response (200) - **version** (string) - The latest version number of the repository. ### Request Example `https://lastversion-api.getpagespeed.com/dvershinin/lastversion?version` ### Response Example ``` 1.2.3 ``` ``` -------------------------------- ### Get Latest Version Source: https://github.com/dvershinin/lastversion/blob/master/docs/api.md Make a GET request to this endpoint to retrieve the latest version of a specified GitHub repository in JSON format. ```APIDOC ## GET / ### Description Retrieves the latest version of a GitHub repository. ### Method GET ### Endpoint `https://lastversion-api.getpagespeed.com/` ### Parameters #### Path Parameters - **github-repo** (string) - Required - The GitHub repository in the format 'owner/repo'. ### Response #### Success Response (200) - **version** (string) - The latest version number of the repository. ### Request Example `https://lastversion-api.getpagespeed.com/dvershinin/lastversion` ### Response Example ```json { "version": "1.2.3" } ``` ``` -------------------------------- ### Source Platform Selection with `lastversion` CLI Source: https://context7.com/dvershinin/lastversion/llms.txt Specify the source platform for version lookups when it might be ambiguous, such as using `--at pip` for PyPI or `--at github` for GitHub. You can also provide a direct URL to a package index. ```bash lastversion requests --at pip lastversion nginx --at github lastversion https://pypi.org/project/requests/ ``` -------------------------------- ### Build single binary Source: https://github.com/dvershinin/lastversion/blob/master/CLAUDE.md Creates a single executable binary for the project. This is a backup option; prefer CI for releases. ```bash make one-file ``` -------------------------------- ### Build and Upload Python Package Source: https://github.com/dvershinin/lastversion/blob/master/BUILD.md Generate a source distribution of the Python package and upload it to PyPI using `twine`. Use the test PyPI repository for initial uploads. ```bash # create source distribution python setup.py sdist # upload to test PyPi twine upload --repository-url https://test.pypi.org/legacy/ dist/* # uptload to the real thing twine upload dist/* ``` -------------------------------- ### Get Latest Version Number Only Source: https://github.com/dvershinin/lastversion/blob/master/docs/api.md Append '?version' to the URL to get only the version number of the GitHub repository. The API caches results for 2 hours. ```http https://lastversion-api.getpagespeed.com/?version ``` -------------------------------- ### Test Version String Formatting Source: https://github.com/dvershinin/lastversion/blob/master/README.md Use the `test` command for troubleshooting or formatting version strings. It can identify clear versions, indicate when a version is unclear, and normalize release candidates. ```bash lastversion test 'blah-1.2.3-devel' # > 1.2.3.dev0 lastversion test '1.2.x' # > False (no clear version) lastversion test '1.2.3-rc1' # > 1.2.3rc1 ``` -------------------------------- ### Multi-Project Repository Handling with `lastversion` CLI Source: https://context7.com/dvershinin/lastversion/llms.txt Manage version lookups for repositories that host multiple distinct projects. Use `--only` to include specific projects and `--exclude` to ignore others. ```bash lastversion --only chart https://github.com/lastversion-test-repos/autoscaler # 9.16.0 lastversion --exclude chart https://github.com/lastversion-test-repos/autoscaler # 1.23.0 ``` -------------------------------- ### Output Format: Version Source: https://github.com/dvershinin/lastversion/blob/master/README.md The default output format, simply displays the well-formatted version number of the latest release. ```bash lastversion --format version ``` -------------------------------- ### Get Latest Version JSON Source: https://github.com/dvershinin/lastversion/blob/master/docs/api.md Make a GET request to this endpoint to retrieve the latest version of a GitHub repository in JSON format. The API caches results for 2 hours. ```http https://lastversion-api.getpagespeed.com/ ``` -------------------------------- ### Include Pre-releases with `lastversion` CLI Source: https://context7.com/dvershinin/lastversion/llms.txt Fetch the latest pre-release version by using the `--pre` flag. ```bash lastversion --pre mautic/mautic # 5.2.0b1 ``` -------------------------------- ### Commercial RapidAPI - Get Version (Text) Source: https://context7.com/dvershinin/lastversion/llms.txt Retrieve only the version string as plain text. ```APIDOC ## Version only (plain text) ### Description Fetches the latest version string for a specified project as plain text. ### Method GET ### Endpoint `https://lastversion.p.rapidapi.com/text/version?project=` ### Parameters #### Query Parameters - **project** (string) - Required - The project identifier (e.g., `torvalds/linux`). - **major** (string) - Optional - Filters for a specific major version (e.g., `4`). #### Headers - **X-RapidAPI-Key** (string) - Required - Your RapidAPI key. - **X-RapidAPI-Host** (string) - Required - `lastversion.p.rapidapi.com`. ### Request Example ```bash curl -X GET "https://lastversion.p.rapidapi.com/text/version?project=torvalds/linux" \ -H "X-RapidAPI-Key: YOUR_RAPIDAPI_KEY" \ -H "X-RapidAPI-Host: lastversion.p.rapidapi.com" ``` ### Response #### Success Response (200) - **version** (string) - The latest version string. ### Response Example ``` 6.12 ``` ``` -------------------------------- ### Display Latest Release Source URL Source: https://github.com/dvershinin/lastversion/blob/master/README.md Use the `--format source` or `--source` flag to display the source URL of the latest release. ```bash lastversion --format source mautic/mautic ``` -------------------------------- ### Configure URL and Source0 for GitHub projects Source: https://github.com/dvershinin/lastversion/blob/master/docs/spec-preparing.md Format the `URL:` and `Source0:` tags using `lastversion` macros to ensure correct version and archive fetching. `lastversion` will update `lastversion_tag` and `lastversion_dir` macros. ```rpmspec %global upstream_github %global lastversion_tag x %global lastversion_dir x Name: URL: https://github.com/%{upstream_github}/%{name} Source0: %{url}/archive/%{lastversion_tag}/%{name}-%{lastversion_tag}.tar.gz ``` -------------------------------- ### Download Assets with `lastversion` CLI Source: https://context7.com/dvershinin/lastversion/llms.txt Download the latest release assets. You can specify an output file using the `-o` option. ```bash lastversion download mautic/mautic lastversion download mautic/mautic -o mautic.tar.gz ``` -------------------------------- ### Commercial RapidAPI - Get Source Tarball URL Source: https://context7.com/dvershinin/lastversion/llms.txt Retrieve the URL for the source tarball of a project. ```APIDOC ## Source tarball URL ### Description Fetches the direct URL to the source tarball for a given project. ### Method GET ### Endpoint `https://lastversion.p.rapidapi.com/source?project=` ### Parameters #### Query Parameters - **project** (string) - Required - The project identifier (e.g., `WordPress/WordPress`). #### Headers - **X-RapidAPI-Key** (string) - Required - Your RapidAPI key. - **X-RapidAPI-Host** (string) - Required - `lastversion.p.rapidapi.com`. ### Request Example ```bash curl -X GET "https://lastversion.p.rapidapi.com/source?project=WordPress/WordPress" \ -H "X-RapidAPI-Key: YOUR_RAPIDAPI_KEY" \ -H "X-RapidAPI-Host: lastversion.p.rapidapi.com" ``` ### Response #### Success Response (200) - **url** (string) - The URL of the source tarball. ### Response Example ```json { "url": "https://github.com/WordPress/WordPress/archive/6.7.1/WordPress-6.7.1.tar.gz" } ``` ``` -------------------------------- ### Commercial RapidAPI - Get Version (JSON) Source: https://context7.com/dvershinin/lastversion/llms.txt Retrieve only the version string in JSON format for a project. ```APIDOC ## Version only (JSON) ### Description Fetches the latest version string for a specified project in JSON format. ### Method GET ### Endpoint `https://lastversion.p.rapidapi.com/version?project=` ### Parameters #### Query Parameters - **project** (string) - Required - The project identifier (e.g., `torvalds/linux`). - **major** (string) - Optional - Filters for a specific major version (e.g., `4`). #### Headers - **X-RapidAPI-Key** (string) - Required - Your RapidAPI key. - **X-RapidAPI-Host** (string) - Required - `lastversion.p.rapidapi.com`. ### Request Example ```bash curl -X GET "https://lastversion.p.rapidapi.com/version?project=torvalds/linux" \ -H "X-RapidAPI-Key: YOUR_RAPIDAPI_KEY" \ -H "X-RapidAPI-Host: lastversion.p.rapidapi.com" ``` ### Response #### Success Response (200) - **version** (string) - The latest version string. ### Response Example ```json { "version": "6.12" } ``` ``` -------------------------------- ### Runtime Configuration Access and Modification Source: https://context7.com/dvershinin/lastversion/llms.txt Python code demonstrating how to access lastversion's configuration at runtime using `get_config()` and how to override settings temporarily with `config.set()` or per-call with `cache_ttl`. ```python # Runtime config access from lastversion.config import get_config config = get_config() print(config.release_cache_enabled) # False (default) print(config.cache_backend) # "file" print(config.file_cache_path) # ~/.cache/lastversion print(config.release_cache_ttl) # 3600 # Override at runtime (does not write to file) config.set("cache.release_cache.enabled", True) config.set("cache.release_cache.ttl", 7200) # Use with latest() — TTL override per call from lastversion import latest v = latest("nginx/nginx", cache_ttl=300) # 5-minute TTL for this call v2 = latest("nginx/nginx", skip_release_cache=True) # bypass cache entirely ``` -------------------------------- ### Public REST API - Get Version String Source: https://context7.com/dvershinin/lastversion/llms.txt Retrieve only the version string for a GitHub repository. ```APIDOC ## Get only the version string ### Description Fetches just the latest version string for a specified GitHub repository. ### Method GET ### Endpoint `https://lastversion-api.getpagespeed.com//?version` ### Parameters #### Path Parameters - **owner** (string) - Required - The GitHub username or organization. - **repo** (string) - Required - The GitHub repository name. #### Query Parameters - **version** (boolean) - Required - Parameter to request only the version string. ### Request Example ```bash curl "https://lastversion-api.getpagespeed.com/dvershinin/lastversion?version" ``` ### Response #### Success Response (200) - **version** (string) - The latest version string. ### Response Example ``` 3.6.10 ``` ``` -------------------------------- ### Output Format: Source Source: https://github.com/dvershinin/lastversion/blob/master/README.md Outputs the link to the source archive, regardless of whether the release has additional assets. ```bash lastversion --format source ``` -------------------------------- ### Commercial RapidAPI - Get Text Source URL Source: https://context7.com/dvershinin/lastversion/llms.txt Retrieve the source tarball URL as plain text. ```APIDOC ## Download latest source via text/source endpoint ### Description Fetches the source tarball URL as plain text, allowing direct download. ### Method GET ### Endpoint `https://lastversion.p.rapidapi.com/text/source?project=` ### Parameters #### Query Parameters - **project** (string) - Required - The project identifier (e.g., `WordPress/WordPress`). #### Headers - **X-RapidAPI-Key** (string) - Required - Your RapidAPI key. - **X-RapidAPI-Host** (string) - Required - `lastversion.p.rapidapi.com`. ### Request Example ```bash wget $(curl -s -X GET "https://lastversion.p.rapidapi.com/text/source?project=WordPress/WordPress" \ -H "X-RapidAPI-Key: YOUR_RAPIDAPI_KEY" \ -H "X-RapidAPI-Host: lastversion.p.rapidapi.com") ``` ### Response #### Success Response (200) - **url** (string) - The URL of the source tarball. ### Response Example ``` https://github.com/WordPress/WordPress/archive/6.7.1/WordPress-6.7.1.tar.gz ``` ``` -------------------------------- ### Commercial RapidAPI - Get Release Object Source: https://context7.com/dvershinin/lastversion/llms.txt Retrieve the full release object for a project using the commercial RapidAPI. ```APIDOC ## Full release object ### Description Fetches the complete release details as a JSON object for a given project via the commercial RapidAPI. ### Method GET ### Endpoint `https://lastversion.p.rapidapi.com/release?project=` ### Parameters #### Query Parameters - **project** (string) - Required - The project identifier (e.g., `nginx`). #### Headers - **X-RapidAPI-Key** (string) - Required - Your RapidAPI key. - **X-RapidAPI-Host** (string) - Required - `lastversion.p.rapidapi.com`. ### Request Example ```bash curl -X GET "https://lastversion.p.rapidapi.com/release?project=nginx" \ -H "X-RapidAPI-Key: YOUR_RAPIDAPI_KEY" \ -H "X-RapidAPI-Host: lastversion.p.rapidapi.com" ``` ### Response #### Success Response (200) - **version** (string) - The latest version string. - **type** (string) - The type of release. - ... (other release details) ### Response Example ```json { "version": "1.27.3", "type": "release", "..." } ``` ``` -------------------------------- ### Public REST API - Get Release Info Source: https://context7.com/dvershinin/lastversion/llms.txt Retrieve full JSON release information for any GitHub repository. ```APIDOC ## Get full JSON release info ### Description Fetches the complete release details in JSON format for a specified GitHub repository. ### Method GET ### Endpoint `https://lastversion-api.getpagespeed.com//` ### Parameters #### Path Parameters - **owner** (string) - Required - The GitHub username or organization. - **repo** (string) - Required - The GitHub repository name. ### Request Example ```bash curl https://lastversion-api.getpagespeed.com/dvershinin/lastversion ``` ### Response #### Success Response (200) - **version** (string) - The latest version string. - **tag_name** (string) - The tag name of the release. - ... (other release details) ### Response Example ```json { "version": "3.6.10", "tag_name": "v3.6.10", "..." } ``` ``` -------------------------------- ### Get Latest Release of Lastversion Itself Source: https://github.com/dvershinin/lastversion/blob/master/README.md Use the special value `self` to find the latest release of the `lastversion` tool. ```bash lastversion self ``` -------------------------------- ### Basic Version Lookup with `lastversion` CLI Source: https://context7.com/dvershinin/lastversion/llms.txt Perform basic version lookups for specified repositories, projects, or keywords like 'linux' or 'self' (for lastversion itself). The output is typically the latest stable version string. ```bash lastversion apache/incubator-pagespeed-ngx # 1.13.35.2 lastversion linux # 6.9.3 lastversion wordpress # 6.5.5 lastversion self # 3.6.10 (lastversion looks up its own latest) ``` -------------------------------- ### Get Source Download URL Source: https://github.com/dvershinin/lastversion/blob/master/docs/api.md Retrieves the URL to download the source tarball corresponding to the latest release of a project. ```APIDOC ## GET /source ### Description Returns JSON containing the URL to download the source tarball for the latest release. ### Method GET ### Endpoint `/source?project=project_id` ### Parameters #### Query Parameters - **project** (string) - Required - The identifier for the project (e.g., `linux`, `nginx`, `WordPress/WordPress`). ### Request Example ```bash curl -X GET "https://lastversion.p.rapidapi.com/source?project=WordPress/WordPress" \ -H "X-RapidAPI-Key: YOUR_RAPIDAPI_KEY" \ -H "X-RapidAPI-Host: lastversion.p.rapidapi.com" ``` ### Response #### Success Response (200) - (string) - The URL to download the source tarball. #### Response Example ``` https://github.com/WordPress/WordPress/archive/6.7.1/WordPress-6.7.1.tar.gz ``` ``` -------------------------------- ### Get Source Download URL (Text) Source: https://github.com/dvershinin/lastversion/blob/master/docs/api.md Retrieves only the URL to download the source tarball for the latest release as plain text. ```APIDOC ## GET /text/source ### Description Returns only the URL to download the source tarball corresponding to the latest release. ### Method GET ### Endpoint `/text/source?project=project_id` ### Parameters #### Query Parameters - **project** (string) - Required - The identifier for the project (e.g., `linux`, `nginx`, `WordPress/WordPress`). ### Request Example ```bash curl -X GET "https://lastversion.p.rapidapi.com/text/source?project=WordPress/WordPress" \ -H "X-RapidAPI-Key: YOUR_RAPIDAPI_KEY" \ -H "X-RapidAPI-Host: lastversion.p.rapidapi.com" ``` ### Response #### Success Response (200) - (string) - The URL to download the source tarball. #### Response Example ``` https://github.com/WordPress/WordPress/archive/6.7.1/WordPress-6.7.1.tar.gz ``` ``` -------------------------------- ### Get Release Information Source: https://github.com/dvershinin/lastversion/blob/master/docs/api.md Fetches comprehensive JSON data about the latest release of a project, including version, type, and other details. ```APIDOC ## GET /release ### Description Returns JSON with various information about the latest release, including a mandatory `version` field. ### Method GET ### Endpoint `/release?project=project_id` ### Parameters #### Query Parameters - **project** (string) - Required - The identifier for the project (e.g., `linux`, `nginx`, `WordPress/WordPress`). ### Request Example ```bash curl -X GET "https://lastversion.p.rapidapi.com/release?project=nginx" \ -H "X-RapidAPI-Key: YOUR_RAPIDAPI_KEY" \ -H "X-RapidAPI-Host: lastversion.p.rapidapi.com" ``` ### Response #### Success Response (200) - **version** (string) - The version string of the latest release. - **type** (string) - The type of the release (e.g., `release`). - ... (other release information) #### Response Example ```json { "version": "1.27.3", "type": "release", "...": "..." } ``` ``` -------------------------------- ### Output Format: Assets Source: https://github.com/dvershinin/lastversion/blob/master/README.md Outputs a newline-separated list of asset download URLs for the latest release. If no assets are found, it provides a link to the source archive. ```bash lastversion --format assets ``` -------------------------------- ### Get version only (JSON) from RapidAPI Source: https://context7.com/dvershinin/lastversion/llms.txt Retrieve only the version string in JSON format from the commercial RapidAPI. Requires API key and host headers. ```bash curl -X GET "https://lastversion.p.rapidapi.com/version?project=torvalds/linux" \ -H "X-RapidAPI-Key: YOUR_RAPIDAPI_KEY" \ -H "X-RapidAPI-Host: lastversion.p.rapidapi.com" ``` -------------------------------- ### Get only version string from public API Source: https://context7.com/dvershinin/lastversion/llms.txt Retrieve only the version string for a GitHub repository using the public API. This is useful for scripting and automation. ```bash curl "https://lastversion-api.getpagespeed.com/dvershinin/lastversion?version" ``` -------------------------------- ### Test Version Parsing Source: https://github.com/dvershinin/lastversion/blob/master/CHANGELOG.md Use the `test` command to see how a given tag would be parsed as a version. This is useful for verifying parsing logic. ```bash lastversion test 'release-3_0_2' ``` -------------------------------- ### Get Spec Tag using Lastversion and JQ Source: https://github.com/dvershinin/lastversion/wiki/Use-in-automatic-RPM-building Command to retrieve the 'spec_tag' from a repository using 'lastversion' in JSON format and then processing it with 'jq'. ```bash lastversion --format json apache/incubator-pagespeed-ngx | jq -r .spec_tag ``` -------------------------------- ### Display Latest Release Assets Source: https://github.com/dvershinin/lastversion/blob/master/README.md Use the `--assets` flag to display the download URL for the latest release assets. By default, output is filtered by OS. ```bash lastversion --assets mautic/mautic #> https://github.com/mautic/mautic/archive/2.15.1/mautic-2.15.1.tar.gz ``` -------------------------------- ### Download latest source release Source: https://github.com/dvershinin/lastversion/blob/master/README.md Use the 'download' command to fetch the most recent source release of a project. This is the default behavior if no specific asset is requested. ```bash lastversion download mautic/mautic ``` -------------------------------- ### Bulk input from file for version extraction Source: https://context7.com/dvershinin/lastversion/llms.txt Process multiple repositories from a file to extract version information. Supports reading from stdin. ```bash lastversion --format version -i repos.txt ``` ```bash echo "nginx/nginx\nwordpress/wordpress" | lastversion --format version -i - ``` -------------------------------- ### Get Project Version from Mercurial Repository Source: https://github.com/dvershinin/lastversion/blob/master/README.md Supports checking versions from Mercurial repositories by providing the repository URL. This is primarily for projects like NGINX. ```bash lastversion https://hg.example.com/project/ ```