Basic program and file updater for Github
Project description
Pydater
When you make a program associated with Github, you can easily update with this module without the need to write an update system.
Specify the path, write a version and leave the rest to the module
Installation
Use the package manager pip to install pydater
.
pip install pydater
Usage
-
First of all, you should save your current version number from github.
-
Create a repository for this or use an existing one.
-
Create a
.json
file namedversion.json
in the repo. -
Its content must be
{ "version" : "<version_number>"}
. -
After doing this and saving, copy the
raw link
of theversion.json
file -
Come back to the relevant repo and import your most up-to-date program/application/software.
-
As a last step, copy the
download link
of your program/application/software in the relevant repo.
Example for Update 0.1
from Pydate import pydate
path = r"C:\Users\...\MyFolder"
raw = "https://raw.githubusercontent.com/..."
pd = pydate.PyDate(path= path, raw_link= raw)
if pd.create_version_file(0.1):
print("Update File Created")
else:
print("Update File Already Exists")
if pd.isUpdate:
print("Current")
else:
print("Not Current")
pd.downloadLink(url="<download_link_here>",extension="<'.exe' or '.pdf' or '.py' or 'bla_bla'>")
pd.writeNewVersion()
Example for Update 0.2
from Pydate import pydate
path = r"C:\Users\...\MyFolder"
raw = "https://raw.githubusercontent.com/..."
pd = pydate.PyDate(path= path, raw_link= raw)
if pd.create_version_file(0.1):
print("Update File Created")
else:
print("Update File Already Exists")
if pd.isUpdate:
print("Current")
else:
print("Not Current")
pd.downloaded_name = "program.exe"
pd.downloadLink(url="<download_link_here>")
pd.openNewVersion()
-
Added
downloaded_name
is added ➥ propertyopenNewVersion
is added ➥ method
-
Removed
writeNewVersion
is removed ➥ method
About the Pydate
Class
-
createVersionFile
(method): If the version file does not exist, it will create it. The resulting file is ajson
file. ReturnsFalse
if the version file exists. ReturnsTrue
if the version file does not exist. Takesone float argument
-
get_version
(property): Returns version file written on github -
isUpdate
(property): ReturnsTrue
if Current,False
if Not Current. -
downloadLink
(method): The argument given to the PyDate class is used as the path. Creates a folder namedInstalled
. His argument; Download link of program/file/exe available on Github. -
downloaded_name
(property): Value by adding an extension to the end of the name. eg:pd.downloaded_name = "my_file_name.exe"
or eg:pd.downloaded_name = "my_file_name.py"
... Examples can be expanded. -
openNewVersion
(method): Opens the downloaded file in theInstalled
folder and upgrades theversion.json
version.
Author
License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.