Created
October 13, 2014 18:15
-
-
Save davidh-raybeam/ca507e6a6dc3b148dc8a to your computer and use it in GitHub Desktop.
A shell function to quickly initialize empty python packages.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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