Tips & Tricks¶
In order to have even more automation you can supplement usage of py-template with a set of predefined aliases.
These aliases should be placed either in
~/.bashrc
(forbash
shell) or/.zshrc
(forzsh
shell). For other shells please see their respective documentation.
Check below for even more automation:
Clone & Initialize¶
Function below will:
- Clone repository
- Install
poetry
dependencies - Setup necessary
pre-commit
hooks
Feel free to rename this function to whatever you like!
# Git Clone Initialize Python
gclip () {
# Automatically clones and initializes a git repo (for Python language)
# USAGE: gclip <repo_url>
url=$1
# Get last part of url without .git extension and use it as repo name
repo_name="$(echo "${url##*/}" | cut -f 1 -d '.')"
git clone "${url}"
cd "${repo_name}"
poetry install --all-extras
poetry run pre-commit install -t pre-commit -t commit-msg
}
Example usage (from command line):
Note: SSH
protocol is of course supported by the function above