forked from OpenAdaptAI/OpenAdapt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat : Add download update feature in user app. Issue OpenAdaptAI#755
- Loading branch information
1 parent
ce9ef55
commit c480f65
Showing
4 changed files
with
104 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,19 @@ | ||
"""Get the version of the package.""" | ||
|
||
import importlib.metadata | ||
import requests | ||
import json | ||
|
||
APP_VERSION_URL = "https://api.github.com/repos/OpenAdaptAI/OpenAdapt/releases?per_page=10&page=1" | ||
|
||
def get_version() -> str: | ||
"""Get the version of the package.""" | ||
return importlib.metadata.version("openadapt") | ||
|
||
def get_latest_version() -> str: | ||
response = requests.get(APP_VERSION_URL, stream=True) | ||
data = json.loads(response.text) | ||
return data[0]['tag_name'].replace('v', '') | ||
|
||
if __name__ == "__main__": | ||
print(get_version()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters