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
.jsonfile namedversion.jsonin the repo. -
Its content must be
{ "version" : "<version_number>"}. -
After doing this and saving, copy the
raw linkof theversion.jsonfile -
Come back to the relevant repo and import your most up-to-date program/application/software.
-
As a last step, copy the
download linkof 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_nameis added ➥ propertyopenNewVersionis added ➥ method
-
Removed
writeNewVersionis removed ➥ method
Example For Update 1.0
import os
from Pydate import pydate
path = r"C:\Users\...\MyFolder"
raw = "https://raw.githubusercontent.com/..."
pd = pydate.PyDate(path= path, raw_link= raw)
if pd.createVersionFile(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.saveNewVersion(open_=False)
print(pd.readNewVersion["version"])
- Added
readNewVersionis added ➥ propertysaveNewVersionis added ➥ method
- Removed
openNewVersionis removed ➥ method
Example For Update 1.0.5
- Ability to update scripts
from Pydate import PyDate
path = r"C:\Users\..\myfolder"
pd = Pydate(path=path,isScript=True) # if `isScript` is `False` script update cannot be used
script_raw_link = "https://raw.githubusercontent.com/Arif-Helmsys/test/main/deneme.py" # The content in the link is an updated script
pd.scriptUpdate(script_raw_link,myscript="myscript")
- Added
scriptUpdateis added ➥ method
About the Pydate Class
-
createVersionFile(method): If the version file does not exist, it will create it. The resulting file is ajsonfile. ReturnsFalseif the version file exists. ReturnsTrueif the version file does not exist. Takesone float argument -
get_version(property): Returns version file written on github -
isUpdate(property): ReturnsTrueif Current,Falseif Not Current. -
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"...https://raw.githubusercontent.com/Arif-Helmsys/test/main/deneme.py Examples can be expanded. -
readNewVersion(property): Returns the version of the locally created version file -
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. -
saveNewVersion(method): Upgrades the version value written in the locally maintained version. json file to the version on github. Takes one parameter. DefaultTrue. If open_ parameter isTrue: Opens the downloaded file in theInstalledfolder and upgrades theversion.jsonversion. If open_ parameter isFalse: only upgrades the version of the script at the specified location -
scriptUpdate(method): Scripts update. Compares your main script with the current script you keep on githu If your main script is not the same as the one you keep up to date on github, it will update it.:param script_raw_link: eg:'https://raw.githubusercontent.com/.../../main/myScript.py'
:param myscript: the name of my main script eg msyscript
The method returns a bool value. If True, it is up to date. If False, it is not up-to-date. If false, change your script and write your script on github so that your relevant main script will be updated.
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.
Source Distribution
File details
Details for the file pydater-1.0.9.tar.gz.
File metadata
- Download URL: pydater-1.0.9.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f9e1501329f18bc0cd865935c44b54362513dad5b37d73ef8395c66a7e1e619
|
|
| MD5 |
13eb675d3030473d9a9fb0dc96ba775b
|
|
| BLAKE2b-256 |
1e3da73e4ba0f06a879fd1d28b162fc258b590224d8ac29e03c5ac68b2031c5f
|