Check for and download updates.. Python and GitHub?

Good day,

Let's say I want to develop a desktop app. The app should receive regular updates.

Therefore, I would like to ask how this could be possible with a public service (GitHub, for example). I would host my project (privately) on GitHub and query it via HTTP to check the version.

But… How exactly do I download the new version so that all files are overwritten (while the program is running)?

I've been looking for a solution for a long time, but haven't been able to find one. I develop in Python.

Best regards

(1 votes)
Loading...

Similar Posts

Subscribe
Notify of
5 Answers
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
medmonk
1 year ago

That is why I now want to ask how this is possible with a public service, for example (GitHub).

If your app is placed on GitHub, you should deal with the GitHub own REST API. All you need for this can be found in the related documentation. Implement everything else in Python by accessing your releases with an update function and the API.

In Python, you will then set up one or more functions to query, download, install, or possibly create a backup from the current version. Depends entirely on you and your desired program structure, whether you set everything in your own functions or work it out in a slide.

LG medmonk

medmonk
1 year ago
Reply to  GettingHeart

You set a function in your Python program and use the GitHub REST API to determine whether the version in your GitHub repository is newer (higher) than the one that has just been installed or executed.

  1. Import all required packages
  2. Compare versions with one function
  3. With the same function or another one, start the download
  4. Also unpack the Zip archive and overwrite the old files

In your program, you save the current version number in a variable and then, using the REST API, ask if the version number on GitHub is higher than that stored in your variable.

After that you implement the logic to download and install the newer version in which the files are downloaded and overwritten. As packages are actually only os, requests, shutil and zipfile necessary.

xxxbernxxx
1 year ago

The Github API lets you search for the latest releases:

https://api.github.com/repos/{owner}/{repo}/releases

Then compare version codes and make rest!