-
Notifications
You must be signed in to change notification settings - Fork 0
/
pycatalyst.sh
executable file
·75 lines (55 loc) · 2.12 KB
/
pycatalyst.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
# Replace <YOUR_GITHUB_USERNAME> with your actual GitHub username
GITHUB_USERNAME="YOUR_GITHUB_USERNAME"
# Note: This script works in conjunction with the 'source' command to persist directory changes in the current terminal session.
# You can create an alias in your .zshrc or .bashrc file like this:
# alias np='source /path/to/start_python_project.sh'
# Check if project name argument is provided
if [ $# -eq 0 ]; then
echo "Error: Please provide a project name."
echo "Usage: ./start_python_project.sh <project_name>"
exit 1
fi
echo "PyCatalyst - Python Quick Start Script v0.2"
# Get project name as a command-line argument
project_name=$1
# Create project directory
cd "$HOME/Dropbox/dev_projects/python_projects"
mkdir "$project_name"
cd "$project_name"
# Initialize virtual environment
virtualenv -p python3 venv
source venv/bin/activate
# Install dependencies (e.g., requests and numpy)
pip install python-dotenv
# Create main script and add starter code
cat <<EOL > main.py
import os
from dotenv import load_dotenv
# Automatically load the .env file from the current directory or parent directories
load_dotenv()
# Access the API keys
twilio_api_key = os.getenv('API_KEY_TWILIO')
stripe_api_key = os.getenv('API_KEY_STRIPE')
openai_api_key = os.getenv('API_KEY_OPENAI')
print(f'Twilio API Key: {twilio_api_key}')
print(f'Stripe API Key: {stripe_api_key}')
print(f'OpenAI API Key: {openai_api_key}')
EOL
# Create requirements.txt file
echo "python-dotenv" > requirements.txt
# Create README.md file
touch README.md
# Initialize version control (Git)
git init
# Create a new repository on GitHub
gh repo create "$project_name" --private
# Set up the remote repository
git remote add origin "https://github.com/$GITHUB_USERNAME/$project_name.git"
echo "Current working directory: $(pwd)"
echo "Git repository initialized and remote repository set up."
echo "Project setup complete. Happy coding!"
# Open main.py in Visual Studio Code in a new window, and bring main.py to focus
code --new-window . --goto main.py
# Ensure terminal ends in the new project directory
cd "$HOME/Dropbox/dev_projects/python_projects/$project_name"