Skip to content

Latest commit

 

History

History
51 lines (36 loc) · 1.09 KB

File metadata and controls

51 lines (36 loc) · 1.09 KB

🐍 Init Python Project

A shell script to bootstrap a new Python project, ready to code in seconds.

⚡ Terminal Shortcut

Add this alias to ~/.bashrc or ~/.zshrc:

alias init-python='bash /path/to/init_python.sh'

💾 How to save the alias

  1. Open your shell configuration file:
  • Bash: ~/.bashrc
  • Zsh: ~/.zshrc
  1. Add this line at the end:
  alias init-python='bash /path/to/init_python.sh'
  1. Save the file

  2. Reload the configuration:

  source ~/.bashrc    # or source ~/.zshrc for zsh

Then run:

  init-python

🚀 What happens when you run it

The script asks for:

  1. A project name (default: myPythonProject)
  2. Whether to initialize a Git repository (y/N)

Then it:

  1. Creates the project folder
  2. If Git is enabled, runs git init, creates .gitignore with .venv, creates an initial commit, and renames the branch to main
  3. Creates requirements.txt
  4. Copies main.py and README.md from examples/
  5. Creates a virtual environment in .venv
  6. Activates the virtual environment
  7. Upgrades pip