It is a CLI replica of Git and its main aim is to study git-internals !
Our Project structure looks like :
girgit/
├── venv/
├── girgit/
│ ├── __init__.py
│ └── main.py
├── README.md
├── requirements.txt
└── setup.py
Our project name and package both are girgit.
we can think of
__init__.pyas a mapping file in the sense that we specify the functions we want to expose in our final cli tool here.
e.g. from .main import main where .main is main.py in girgit's root directory
and main is the function name defined in main.py ;)
This is the heart of our program where actual work is done.
e.g.
def main():
print("Hello Girgit")Create the
setup.pyfile and run it indevelop --usermode (if invenvlike pycharm IDE no need to write--user)developmode helps to automatically reload the changes we make in source-code all we need to do is make some change and reopen the terminal and voila !
In setup.py we have used packages=find_packages() which will
auto find and link the packages that have __init__.py file in them,to
exclude tests directory if present we could write packages=find_packages(exclude="tests*")
python setup.py developYou can test it by :
from girgit import main
main