PyUpdater Documentation
repository·main·Indexed 19 days ago
https://github.com/digital-sapphire/pyupdaterAn auto-update framework for PyInstaller-packaged applications that enables secure and efficient distribution of app updates. It provides a client-side API for checking and applying updates via AppUpdate and LibUpdate, a command-line tool for building, signing, and uploading packages, and a plugin system for extending upload capabilities.
What's inside PyUpdater
- PyUpdater is an auto-update framework designed specifically for applications packaged with PyInstaller. It provides a mechanism for the simple, secure, and efficient shipment of application updates to end-users.
What is PyUpdater?
mainPyUpdater is an auto-update library and CLI tool designed for the simple, secure, and efficient shipment of application updates. It relies on PyInstaller for bundling and provides a robust workflow for managing application versions and security.Key features of PyUpdater
mainPyUpdater provides several features for managing application lifecycles and security:
- Security: Secured with EdDSA, supports cryptographically secure offline updates, and utilizes a dual key verification system.
- Update Management: Supports release channels, automatic patch updates, and intelligent update workflows.
- Performance: Features asynchronous downloads and download progress callbacks.
- Extensibility: Uploading to the cloud is handled via plugins (e.g., S3 and SCP plugins are available).
- Asset Management: Supports versioned external assets.
- Infrastructure: Easy setup and CI/CD support, including Basic Auth support.
Manage plugin configuration settings
mainPlugin authors can manage configuration in two primary ways:
- Interactive User Input: Use the
set_config(self, config)method to prompt the user for information usingself.get_answer(). This information is then saved to the configuration on disk. Useinit_config(self, config)to map those saved configuration values to instance attributes after initialization. - Environment Variables: Configuration can also be retrieved via environment variables.
- Interactive User Input: Use the
Understand the PyUpdater local repository layout
mainPyUpdater uses a specific directory structure to manage application updates, build artifacts, and configuration. The layout is divided into two main areas: the project root (containing application code and data) and the
.pyupdaterdirectory (containing configuration and build metadata).Project Root Layout
client_config.py: A configuration file automatically generated by PyUpdater for use by the client application.pyu-data/:new/: Place newly compiled programs here when they are ready to be signed.deploy/: Contains signed updates, version metadata, and public keys staged for upload to a server.files/: Stores the most recent update of each app/library. PyUpdater uses these files as a base to create patches during subsequent builds.
.pyupdater Directory Layout
.pyupdater/:config.pyu: Stores the configuration information for the specific application.spec/: Contains PyInstaller.specfiles for different platforms (e.g.,mac.spec,win.spec,nix.spec,nix64.spec).work/: Contains build artifacts generated by PyInstaller during the build process (e.g.,.toc,.pkg,.pyzfiles).
. ├── SuperApp.py ├── client_config.py ├── pyu-data │ ├── deploy │ ├── files │ └── new └── requirements.txt .pyupdater ├── config.pyu ├── spec │ └── mac.spec └── work └── mac ├── out00-Analysis.toc └── ...How PyUpdater finds upload plugins
mainPyUpdater discovers upload plugins using
setuptoolsentry points. To make your plugin available to PyUpdater, you must register it under thepyupdater.pluginsentry point in your package'ssetup.pyfile.setup( provides=['pyupdater.plugins',], entry_points={ 'pyupdater.plugins': [ 'my_uploader = my_uploader:MyUploader', ] }, )How dual key verification works in PyUpdater
mainPyUpdater uses a dual key verification mechanism to ensure secure updates:
- An offline private key is used to sign an application-specific key pair.
- The application-specific key pair is then used to sign and verify update metadata.
- The client is shipped with the offline public key to bootstrap the entire verification process.
Compare Esky and PyUpdater configuration and update mechanisms
mainWhen migrating from Esky to PyUpdater, note the following architectural differences in how configuration, versioning, and updates are handled:
Feature Esky PyUpdater Configuration Uses setup.pySet during repository initialization Current App Version Parses local repository Set within the application script Update Versioning Parses update repository Uses a dedicated version file including hashes for security and integrity Update Process Initialize Esky client, then call update()Initialize PyUpdater client, then call update()Build your application
mainYou can build your application using either a PyInstaller spec file or a direct Python script. You must provide the
--app-versionflag.To view PyInstaller build information, use the
--pyinstaller-log-infoflag.# Build from a spec file $ pyupdater build --app-version=1.0.0 main.spec # Build from a script $ pyupdater build --app-version=1.0.0 main.pyMaintain the name attribute in the spec file
mainWhen working with the PyUpdater spec file, do not modify thenameattribute. Changing this value can break the update mechanism.Install PyUpdater with all features
mainTo install PyUpdater along with all available optional dependencies and plugins, use the
[all]extra.$ pip install --upgrade PyUpdater[all]Archive an external asset with pyupdater archive
mainTo prepare an external asset (like a
.sofile) for updates, place the file in thepyu-data/newdirectory and run thearchivecommand specifying the filename and the version number.$ pyupdater archive --name example.so --version 0.1.0