Last active
November 11, 2018 21:47
-
-
Save Menziess/84683f01cce4af35924e84e383184fbf to your computer and use it in GitHub Desktop.
Create basic python project quickly.
This file contains 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
#!/bin/bash | |
GREEN='\033[1;32m' | |
WHITE='\033[0m' | |
EDITORCONFIG='https://gist.githubusercontent.com/Menziess/97ce53ea86d70e4e95eef6097ea40a72/raw/d0780eba0$ | |
SETTINGS_JSON='https://gist.githubusercontent.com/Menziess/dc3d46c4c7743c08626ea2d325d313a3/raw/05411512$ | |
if [ $# -eq 0 ] | |
then | |
echo "Please provide a new project name" && exit 1 | |
else | |
if [ -d $1 ]; then | |
echo $1 "already exists." | |
exit 1 | |
fi | |
echo -e "Creating new project: ${GREEN}$1${WHITE}" | |
fi | |
mkdir $1 | |
cd $1 | |
# Create virtual environment | |
virtualenv venv && | |
source venv/bin/activate && | |
python -m pip install -U yapf && | |
# Download basic config files | |
curl -o .editorconfig $EDITORCONFIG | |
# Create vscode settings folder | |
mkdir .vscode | |
cd .vscode | |
curl -o settings.json $SETTINGS_JSON | |
cd .. | |
# Create file to start programming | |
touch app.py | |
echo -e "${GREEN}"$1 "${WHITE}has been created" | |
read -r -p "Do you wish to open the project in vscode? [Y/n] " input | |
case $input in | |
[yY][eE][sS]|[yY]) | |
code . | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment