A shell script to bootstrap a new Python project, ready to code in seconds.
Add this alias to ~/.bashrc or ~/.zshrc:
alias init-python='bash /path/to/init_python.sh'- Open your shell configuration file:
- Bash:
~/.bashrc - Zsh:
~/.zshrc
- Add this line at the end:
alias init-python='bash /path/to/init_python.sh'-
Save the file
-
Reload the configuration:
source ~/.bashrc # or source ~/.zshrc for zshThen run:
init-pythonThe script asks for:
- A project name (default:
myPythonProject) - Whether to initialize a Git repository (
y/N)
Then it:
- Creates the project folder
- If Git is enabled, runs
git init, creates.gitignorewith.venv, creates an initial commit, and renames the branch tomain - Creates
requirements.txt - Copies
main.pyandREADME.mdfromexamples/ - Creates a virtual environment in
.venv - Activates the virtual environment
- Upgrades
pip