Find, download and apply latest release from a GitHub repo.
Project description
GitHubUpdater
GitHubUpdater is a Python tool that allows you to manage and apply updates to your application directly from a GitHub repository. It checks for the latest release or pre-release, downloads the necessary assets, and installs the update.
Features
- Automatically fetches the latest release or pre-release from GitHub.
- Downloads and installs release assets.
- Supports a variety of archive formats (ZIP, GTAR, GZIP, etc.).
- Manages session cleanup and handles shutdown gracefully.
- Works with both frozen applications (like PyInstaller) and scripts.
Installation
You can install GitHubUpdater directly from PyPI:
pip install gh_auto_updater
Usage
1. Basic Usage
import asyncio
from gh_auto_updater import update
from pathlib import Path
async def main():
await update(
repository_name="yourusername/your-repo",
current_version="1.0.0",
install_dir=Path("/path/to/install/dir")
)
if __name__ == "__main__":
asyncio.run(main())
2. Using Pre-releases
If you want to apply pre-releases:
await update(
repository_name="yourusername/your-repo",
current_version="1.0.0",
install_dir=Path("/path/to/install/dir"),
prerelease=True
)
3. Filter Assets by Name or Field
You can filter which assets to download by matching the asset name or other fields:
await update(
repository_name="yourusername/your-repo",
current_version="1.0.0",
install_dir=Path("/path/to/install/dir"),
asset_name_pattern=r".*win64.*", # Only download assets for Windows 64-bit
content_type=lambda ctype: ctype == "application/zip"
)
4. Running the Update Process as Admin on Windows
The tool can also request admin privileges (UAC prompt) for installation, especially useful for system-level updates.
await update(
repository_name="yourusername/your-repo",
current_version="1.0.0",
install_dir=Path("/path/to/install/dir"),
as_admin=True # Runs the installation with admin rights
)
5. Applying an Update with a Timeout Between Checks
await update(
repository_name="yourusername/your-repo",
current_version="1.0.0",
install_dir=Path("/path/to/install/dir"),
checks_rate_limit_secs=86400, # Check for updates once every 24 hours
last_check_date_path=Path("/path/to/last-check-file")
)
Parameters
repository_name(str): The GitHub repository in the format {username}/{repo_name}.current_version(str): The current version of the app.install_dir(Path): Path to the installation directory.prerelease(bool): Set to True if you want to apply pre-releases. (default: False)asset_name_pattern(str): A regex pattern to match the name of the asset you want to download.checks_rate_limit_secs(int): Rate limit checks in seconds between update checks (optional).last_check_date_path(Path): Path to store the last check date (optional).allow_plain(bool): Whether to allow plain scripts (default: False).
Supported Archive Formats
application/zipapplication/x-gtarapplication/x-gzipapplication/x-zip-compressed
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gh_auto_updater-0.1.32.tar.gz.
File metadata
- Download URL: gh_auto_updater-0.1.32.tar.gz
- Upload date:
- Size: 16.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a60f84e2777f170615c22243fa2556395939b13a5ba22fc78f3c442f12410ed
|
|
| MD5 |
83ac5e683c2bacf25e805bd4a992f6ca
|
|
| BLAKE2b-256 |
aee264303dba0c5248316f42bc6d20ebfd450a796c2d85f3c3a7f3d69823060f
|
File details
Details for the file gh_auto_updater-0.1.32-py3-none-any.whl.
File metadata
- Download URL: gh_auto_updater-0.1.32-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d59a1e802f0cf64480c990b7ed7657f90f11c538b1160388a0eaa8424ad89ec1
|
|
| MD5 |
fbd195275a3e474c2364b1b7edb67514
|
|
| BLAKE2b-256 |
15826322e177a0625f432bbefad95c8aa56c46929ee1fa78e67f542011dc8b4d
|