-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_github.sh
More file actions
185 lines (144 loc) Β· 3.9 KB
/
Copy pathsetup_github.sh
File metadata and controls
185 lines (144 loc) Β· 3.9 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
#!/usr/bin/env bash
set -euo pipefail
# Usage: ./prepare_github.sh [repo-slug] [public|private]
# Example: ./prepare_github.sh entropic-collatz-conjector public
# 1. Parse arguments
REPO_SLUG=${1:-entropic-collatz-conjector}
VISIBILITY=${2:-public}
# 2. Full human-readable title for README
FULL_TITLE="Entropic Collatz Conjector"
echo "π§ Scaffolding project for GitHub as '$REPO_SLUG' ($VISIBILITY)β¦"
# 3. Create necessary directories
mkdir -p src configs tests .github/workflows
# 4. Create .gitignore
cat > .gitignore << 'EOF'
# Byte-compiled / optimized files
__pycache__/
*.py[cod]
*$py.class
# Virtual environments
.env
venv/
# Logs
*.log
# macOS files
.DS_Store
# Windows files
Thumbs.db
# IDE / Editor folders
.vscode/
.idea/
EOF
# 5. Create requirements.txt
pip freeze > requirements.txt
# 6. Create README.md
cat > README.md << EOF
# $FULL_TITLE
_Repository slug:_ \`$REPO_SLUG\`
---
## Abstract
This project explores the Collatz Conjecture using entropy and clustering techniques. It involves analyzing the behavior of the Collatz sequence and its related properties.
---
## Installation
\`\`\`bash
python3 -m venv venv
source venv/bin/activate # macOS/Linux
venv\\Scripts\\activate # Windows
pip install -r requirements.txt
\`\`\`
---
## Usage
\`\`\`bash
python entropic_collatz_conjector.py
\`\`\`
---
## Project Structure
$REPO_SLUG/
βββ .gitignore
βββ LICENSE
βββ README.md
βββ requirements.txt
βββ entropic_collatz_conjector.py
βββ test_seed.py
βββ src/
β βββ your_module.py
βββ configs/
β βββ default.yaml
βββ tests/
β βββ test_basic.py
βββ .github/
βββ workflows/
βββ ci.yml
---
## License
This project is licensed under the MIT License. See [LICENSE](LICENSE) for details.
EOF
# 7. Create LICENSE (MIT)
cat > LICENSE << 'EOF'
MIT License
Copyright (c) 2025 Your Name
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software...
EOF
# 8. Create src/your_module.py
cat > src/your_module.py << 'EOF'
def core_function(x):
"""
TODO: Implement the core functionality.
"""
return 42
EOF
# 9. Create configs/default.yaml
cat > configs/default.yaml << 'EOF'
param1: 0.1
param2: 100
EOF
# 10. Create tests/test_basic.py
cat > tests/test_basic.py << 'EOF'
import pytest
from src.your_module import core_function
def test_core_function_returns_expected():
assert core_function(0) == 42
EOF
# 11. Create GitHub Actions CI workflow
cat > .github/workflows/ci.yml << 'EOF'
name: Continuous Integration
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: pip install -r requirements.txt
- name: Run tests
run: pytest --maxfail=1 --disable-warnings -q
EOF
# 12. Initialize Git and make the first commit
if [ ! -d .git ]; then
git init
fi
git add .
git commit -m "chore: initial scaffold with docs, tests, and CI workflow"
# 13. Create GitHub repo & push (if gh CLI is available)
if command -v gh &> /dev/null; then
echo "π Creating GitHub repository '$REPO_SLUG' ($VISIBILITY)β¦"
gh repo create "$REPO_SLUG" --"$VISIBILITY" --source=. --remote=origin --push
else
echo "β οΈ GitHub CLI not found. Please manually create a repo named '$REPO_SLUG', then:"
echo " git remote add origin git@github.com:YOUR_USERNAME/$REPO_SLUG.git"
echo " git branch -M main"
echo " git push -u origin main"
fi
echo "β
Project is now GitHub-ready!"