Using Git files in Python (2023-09-26 10:40:32)

One of the ways to store project files and functions in different versions is GitHub. Now, if we want to reuse these files in our own Python projects, we need a functional script. which we will get to know later.

این چیه؟

We consider three steps for this. We have to clone the relevant repository from Git. Move the relevant folder or files out of it and delete the folder containing the extra files. Finally, call the existing functions. Since these codes are different for Windows and Linux, we will present them separately as a practical example.

#Windows OS
import os
os.system("git clone https://github.com/dmahdipour/pytorch")
os.system("move pytorch/py_functions .")
os.system("rmdir /s /q pytorch")
from py_functions import data_setup, engine)

 

#Linux OS
import os
os.system("git clone https://github.com/dmahdipour/pytorch")
os.system("mv pytorch/py_functions .")
os.system("rm -rf pytorch")
from py_functions import data_setup, engine


Comments


Inchieh is both an idea and a learning challenge for us (and of course for anyone who wants to be with us). The purpose of the idea can be seen from its name. You are supposed to say what each picture is. فارسی