Skip to content

Instantly share code, notes, and snippets.

@davidh-raybeam
Created October 13, 2014 18:15
Show Gist options
  • Save davidh-raybeam/ca507e6a6dc3b148dc8a to your computer and use it in GitHub Desktop.
Save davidh-raybeam/ca507e6a6dc3b148dc8a to your computer and use it in GitHub Desktop.
A shell function to quickly initialize empty python packages.
# Creates directories and empty __init__.py files for the given python package in the current directory.
# Usage:
# pypkg a.python.package.name
pypkg () {
local pkgpath="$(echo $1 | sed 's:\.: :g')"
local fspath="."
for el in $pkgpath; do
fspath="${fspath}/${el}"
(mkdir "$fspath" && touch "${fspath}/__init__.py") &>/dev/null
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment