Skip to content

Python Project Initialisation Automation through Shell Scripting

Notifications You must be signed in to change notification settings

WDoyle123/PythonProjectInit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

PythonProjectInit

About

When coding in Python my directories are very consistant and therefore it made sense to automate the slightly tedious process of setting up a Python project.

Setup

  1. Git Clone
git clone https://github.com/WDoyle123/PythonProjectInit.git
cd PythonProjectInit
  1. Make script executable
chmod +x ppi.sh
  1. Move script to a directory in your PATH
mv ppi.sh /usr/local/bin/ppi
  1. Delete clone (Optional)
cd ..
rm -rf PythonProjectInit
  1. Now you can initialise a Python project by calling:
ppi

Code

#!/bin/bash

create_dir_and_init() {
    mkdir -p "$1"
    touch "$1/__init__.py"
}

# Create directories
mkdir data src figures
create_dir_and_init src/calculations 
create_dir_and_init src/visualisations
create_dir_and_init src/entities

touch src/main.py
touch requirements.txt

# Python env
python3 -m venv venv

# Create a .gitignore file
echo -e "*.pyc\n__pycache__/\nvenv/" > .gitignore

echo "Python Project Initialised"

About

Python Project Initialisation Automation through Shell Scripting

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages