Skip to content

A Template Repository for Python Module (in GIT)

License

Notifications You must be signed in to change notification settings

ZenithClown/python-git-template

Repository files navigation

Python GIT Template
GitHub issues GitHub stars GitHub forks

TEMPLATE Design built specifically for python Language, with necessary file structure as required. This TEMPLATE DOES NOT COME with a LICENSE File, but you can easily add a required license from GitHub. However, special files like .gitignore .gitattributes are included. The TEMPLATE now includes as LICENSE file, and other files are kept as is.

Follow the steps to create a new license file as below:

  • Open the Repository
  • Click "Add file" > "Create a New File"
  • Type the name of the File as: LICENSE or LICENSE.txt or LICENSE.md
  • Click on "Choose a License Template"
  • Review and Submit
  • Commit Changes as Required

NOTE: some optional usage, specifications, and helpful links are as below:

  1. You can add GitHub Repository Badges from Shields IO - if this is a Public Repository;
  2. TAB (size = 4) has been used for indentation, except this file (README.md).
  3. .github/workflows is added however, it is recomended that you create your own workflows either using GitHub Actions or on your own.
  4. Basic docker files are added for convention, modify it as per requirement. Recomended to delete the file, if not required.
  5. The repository uses markdown instead of rich text format, so make necessary changes to file extension/type as required.

Quick Start Guide

Introduced in 2019, users can now create a repository from templates in GitHub. To do this, simply head over to any repository settings and enable "Template Repository" from the Options Menu. When creating a new repository from this template, you can just click on Use this template available in this repository (refer the picture below).

use_this_template_demo

Creating a NEW Repository from Template

Template Repository is not limited to GitHub, and you can setup your own local-file structure for the same. The following describes the usage of rsync which is available in most linux distros, more information on rsync.

# Note the use of rsync
rsync -rh ~/source/directory /destination/directory

Setup Information

The template provides a general structure that I use (highly motivated from pandas dir and coding structure). There needs to be several things that need to be changed, just after initializing with the template, which are as follows:

  • PKG variable under setup.py has to be replaced with the module name and directory name pkg-name,
  • Define High-Level Version Name (like 0.0.1, 0.1, 1.1, etc.) in pkg-name/VERSION file, to be interpreted by setup.py, and
  • Define/Check/Update Author Name, Copyright Information (if any) in setup.py and pkg-name/__init__.py.

TIP: Install using pip by moving into the parent directory, with the following folder:

debmalya@machine:~$ ls -l
drwxrwxr-x 3 debmalya debmalya    4096 Aug 30 12:04  PYTHON_GIT_TEMPLATE

Finally, install it via:

pip install ./PYTHON_GIT_TEMPLATE # Normal Installation
pip install -e ./PYTHON_GIT_TEMPLATE # Installation in Editable Mode

flake8 Convention

Use the command flake8 . --count --exit-zero --max-complexity=10 --statistics to generate a report.