Edwin Salguero
commited on
Commit
Β·
184a5a6
1
Parent(s):
1315d62
feat: Add comprehensive Dependabot PR review workflow
Browse files- Add automated review script for all 12 Dependabot PRs
- Create Cursor-specific PR review guide
- Include AI-assisted review prompts and templates
- Add trading-specific review criteria
- Support both EAName and ParallelLLC repositories
- Include local testing and Docker build validation
- Add review decision logging and tracking
- CURSOR_PR_REVIEW_GUIDE.md +269 -0
- HUGGINGFACE_PROTECTION.md +188 -0
- review_dependabot_prs.sh +177 -0
- setup_branch_protection.sh +72 -0
CURSOR_PR_REVIEW_GUIDE.md
ADDED
@@ -0,0 +1,269 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# π€ Cursor PR Review Guide for Dependabot PRs
|
2 |
+
|
3 |
+
## π― **Quick Start: Review All 12 Dependabot PRs**
|
4 |
+
|
5 |
+
### **Step 1: Run the Automated Review Script**
|
6 |
+
```bash
|
7 |
+
# Make the script executable
|
8 |
+
chmod +x review_dependabot_prs.sh
|
9 |
+
|
10 |
+
# Run the review workflow
|
11 |
+
./review_dependabot_prs.sh
|
12 |
+
```
|
13 |
+
|
14 |
+
This script will:
|
15 |
+
- β
Run local tests first
|
16 |
+
- β
Test Docker builds
|
17 |
+
- β
Open each PR in your browser
|
18 |
+
- β
Guide you through review decisions
|
19 |
+
- β
Log all decisions for tracking
|
20 |
+
|
21 |
+
## π **Cursor-Specific Review Workflow**
|
22 |
+
|
23 |
+
### **Method 1: Using Cursor's GitHub Integration**
|
24 |
+
|
25 |
+
#### **Open All PRs in Cursor:**
|
26 |
+
```bash
|
27 |
+
# In Cursor command palette (Cmd+Shift+P):
|
28 |
+
GitHub: View Pull Requests
|
29 |
+
```
|
30 |
+
|
31 |
+
#### **Review Each PR:**
|
32 |
+
1. **Select PR** from the list
|
33 |
+
2. **Review changes** in side-by-side diff
|
34 |
+
3. **Add comments** using Cursor's inline commenting
|
35 |
+
4. **Use AI assistance** for code review
|
36 |
+
5. **Approve or request changes**
|
37 |
+
|
38 |
+
### **Method 2: Direct PR URLs**
|
39 |
+
|
40 |
+
#### **EAName Repository PRs:**
|
41 |
+
```bash
|
42 |
+
# In Cursor command palette:
|
43 |
+
GitHub: Open Pull Request from URL
|
44 |
+
|
45 |
+
# Then paste these URLs one by one:
|
46 |
+
https://github.com/EAName/algorithmic_trading/pull/6
|
47 |
+
https://github.com/EAName/algorithmic_trading/pull/5
|
48 |
+
https://github.com/EAName/algorithmic_trading/pull/4
|
49 |
+
https://github.com/EAName/algorithmic_trading/pull/3
|
50 |
+
https://github.com/EAName/algorithmic_trading/pull/2
|
51 |
+
https://github.com/EAName/algorithmic_trading/pull/1
|
52 |
+
```
|
53 |
+
|
54 |
+
#### **ParallelLLC Repository PRs:**
|
55 |
+
```bash
|
56 |
+
# Same process for ParallelLLC:
|
57 |
+
https://github.com/ParallelLLC/algorithmic_trading/pull/6
|
58 |
+
https://github.com/ParallelLLC/algorithmic_trading/pull/5
|
59 |
+
https://github.com/ParallelLLC/algorithmic_trading/pull/4
|
60 |
+
https://github.com/ParallelLLC/algorithmic_trading/pull/3
|
61 |
+
https://github.com/ParallelLLC/algorithmic_trading/pull/2
|
62 |
+
https://github.com/ParallelLLC/algorithmic_trading/pull/1
|
63 |
+
```
|
64 |
+
|
65 |
+
## π **Review Checklist for Each PR**
|
66 |
+
|
67 |
+
### **Critical PRs (Review First):**
|
68 |
+
|
69 |
+
#### **1. Python 3.13 Update (PR #6)**
|
70 |
+
**Priority: HIGH**
|
71 |
+
```bash
|
72 |
+
# Check for breaking changes
|
73 |
+
- [ ] All dependencies compatible with Python 3.13
|
74 |
+
- [ ] No deprecated features used
|
75 |
+
- [ ] Performance impact minimal
|
76 |
+
- [ ] Trading logic unaffected
|
77 |
+
```
|
78 |
+
|
79 |
+
#### **2. Docker Action Updates (PRs #2, #4)**
|
80 |
+
**Priority: MEDIUM**
|
81 |
+
```bash
|
82 |
+
# Check CI/CD pipeline
|
83 |
+
- [ ] Docker builds still work
|
84 |
+
- [ ] Image size reasonable
|
85 |
+
- [ ] Security improvements
|
86 |
+
- [ ] No breaking changes
|
87 |
+
```
|
88 |
+
|
89 |
+
#### **3. GitHub Actions Updates (PRs #1, #3, #5)**
|
90 |
+
**Priority: LOW**
|
91 |
+
```bash
|
92 |
+
# Check workflow compatibility
|
93 |
+
- [ ] Actions still function
|
94 |
+
- [ ] No deprecated features
|
95 |
+
- [ ] Performance improvements
|
96 |
+
- [ ] Security enhancements
|
97 |
+
```
|
98 |
+
|
99 |
+
## π€ **Using Cursor's AI for PR Review**
|
100 |
+
|
101 |
+
### **AI-Assisted Review Commands:**
|
102 |
+
|
103 |
+
#### **1. Ask AI to Review Changes:**
|
104 |
+
```bash
|
105 |
+
# In Cursor chat:
|
106 |
+
"Review this PR for breaking changes and security issues"
|
107 |
+
```
|
108 |
+
|
109 |
+
#### **2. Check for Trading-Specific Issues:**
|
110 |
+
```bash
|
111 |
+
# In Cursor chat:
|
112 |
+
"Check if these dependency updates affect our trading algorithms or risk management"
|
113 |
+
```
|
114 |
+
|
115 |
+
#### **3. Validate CI/CD Pipeline:**
|
116 |
+
```bash
|
117 |
+
# In Cursor chat:
|
118 |
+
"Verify that these GitHub Actions updates won't break our CI/CD pipeline"
|
119 |
+
```
|
120 |
+
|
121 |
+
### **AI Review Prompts:**
|
122 |
+
|
123 |
+
#### **For Python 3.13 Update:**
|
124 |
+
```
|
125 |
+
"Review this Python 3.13 update for:
|
126 |
+
1. Breaking changes in our trading dependencies
|
127 |
+
2. Performance impact on our algorithms
|
128 |
+
3. Security improvements
|
129 |
+
4. Compatibility with our Docker setup"
|
130 |
+
```
|
131 |
+
|
132 |
+
#### **For GitHub Actions Updates:**
|
133 |
+
```
|
134 |
+
"Review these GitHub Actions updates for:
|
135 |
+
1. Workflow compatibility
|
136 |
+
2. Security improvements
|
137 |
+
3. Performance enhancements
|
138 |
+
4. Any deprecated features"
|
139 |
+
```
|
140 |
+
|
141 |
+
## π **Review Decision Matrix**
|
142 |
+
|
143 |
+
### **Approve If:**
|
144 |
+
- β
No breaking changes detected
|
145 |
+
- β
Tests pass locally
|
146 |
+
- β
Docker builds successfully
|
147 |
+
- β
Security improvements included
|
148 |
+
- β
Performance maintained or improved
|
149 |
+
|
150 |
+
### **Request Changes If:**
|
151 |
+
- β Breaking changes found
|
152 |
+
- β Tests fail
|
153 |
+
- β Docker build fails
|
154 |
+
- β Security vulnerabilities introduced
|
155 |
+
- β Performance degradation
|
156 |
+
|
157 |
+
### **Comment Only If:**
|
158 |
+
- π¬ Minor concerns that don't block approval
|
159 |
+
- π¬ Suggestions for future improvements
|
160 |
+
- π¬ Questions about implementation
|
161 |
+
- π¬ Documentation requests
|
162 |
+
|
163 |
+
## π‘οΈ **Trading-Specific Review Criteria**
|
164 |
+
|
165 |
+
### **Risk Management:**
|
166 |
+
- [ ] No changes to risk calculation logic
|
167 |
+
- [ ] Position limits still enforced
|
168 |
+
- [ ] Drawdown protection maintained
|
169 |
+
- [ ] Compliance requirements met
|
170 |
+
|
171 |
+
### **Performance:**
|
172 |
+
- [ ] Algorithm execution time unchanged
|
173 |
+
- [ ] Memory usage reasonable
|
174 |
+
- [ ] CPU utilization acceptable
|
175 |
+
- [ ] API response times maintained
|
176 |
+
|
177 |
+
### **Security:**
|
178 |
+
- [ ] No new vulnerabilities introduced
|
179 |
+
- [ ] API keys still secure
|
180 |
+
- [ ] Authentication mechanisms intact
|
181 |
+
- [ ] Data encryption maintained
|
182 |
+
|
183 |
+
## π― **Efficient Review Strategy**
|
184 |
+
|
185 |
+
### **Batch Review Approach:**
|
186 |
+
|
187 |
+
#### **Phase 1: Critical Updates (30 minutes)**
|
188 |
+
1. **Python 3.13 Update** - Test thoroughly
|
189 |
+
2. **Docker Updates** - Verify builds
|
190 |
+
3. **Security Updates** - Validate improvements
|
191 |
+
|
192 |
+
#### **Phase 2: Standard Updates (15 minutes)**
|
193 |
+
1. **GitHub Actions** - Quick compatibility check
|
194 |
+
2. **Minor Dependencies** - Standard review
|
195 |
+
3. **Documentation Updates** - Verify accuracy
|
196 |
+
|
197 |
+
#### **Phase 3: Approval (5 minutes)**
|
198 |
+
1. **Approve safe updates**
|
199 |
+
2. **Request changes for issues**
|
200 |
+
3. **Merge approved PRs**
|
201 |
+
|
202 |
+
## π **Review Template**
|
203 |
+
|
204 |
+
### **For Each PR, Use This Template:**
|
205 |
+
|
206 |
+
```markdown
|
207 |
+
## PR Review: [PR Title]
|
208 |
+
|
209 |
+
### β
What I Reviewed:
|
210 |
+
- [ ] Code changes
|
211 |
+
- [ ] Dependency updates
|
212 |
+
- [ ] Breaking changes
|
213 |
+
- [ ] Security implications
|
214 |
+
- [ ] Performance impact
|
215 |
+
- [ ] Local testing
|
216 |
+
- [ ] Docker build
|
217 |
+
|
218 |
+
### π Findings:
|
219 |
+
- **Breaking Changes**: [Yes/No]
|
220 |
+
- **Security Issues**: [Yes/No]
|
221 |
+
- **Performance Impact**: [None/Minor/Major]
|
222 |
+
- **Test Results**: [Pass/Fail]
|
223 |
+
|
224 |
+
### π¬ Comments:
|
225 |
+
[Add any specific comments or suggestions]
|
226 |
+
|
227 |
+
### β
Decision:
|
228 |
+
- [ ] **Approve** - Safe to merge
|
229 |
+
- [ ] **Request Changes** - Issues found
|
230 |
+
- [ ] **Comment Only** - Minor concerns
|
231 |
+
```
|
232 |
+
|
233 |
+
## π **Quick Commands for Cursor**
|
234 |
+
|
235 |
+
### **Keyboard Shortcuts:**
|
236 |
+
```bash
|
237 |
+
Cmd+Shift+P # Command palette
|
238 |
+
Cmd+Shift+G # Source control
|
239 |
+
Cmd+Enter # Submit review
|
240 |
+
Cmd+Shift+Enter # Approve PR
|
241 |
+
Cmd+/ # Toggle comment
|
242 |
+
```
|
243 |
+
|
244 |
+
### **Useful Commands:**
|
245 |
+
```bash
|
246 |
+
GitHub: View Pull Requests
|
247 |
+
GitHub: Open Pull Request from URL
|
248 |
+
GitHub: Review Pull Request
|
249 |
+
GitHub: Add Comment to Pull Request
|
250 |
+
```
|
251 |
+
|
252 |
+
## β
**Success Metrics**
|
253 |
+
|
254 |
+
### **Review Goals:**
|
255 |
+
- **Time**: Complete all 12 PRs in < 1 hour
|
256 |
+
- **Quality**: 100% of critical issues caught
|
257 |
+
- **Safety**: No breaking changes merged
|
258 |
+
- **Efficiency**: Use AI assistance for 80% of reviews
|
259 |
+
|
260 |
+
### **Quality Checklist:**
|
261 |
+
- [ ] All PRs reviewed within 24 hours
|
262 |
+
- [ ] No critical issues missed
|
263 |
+
- [ ] All approved PRs pass CI/CD
|
264 |
+
- [ ] Documentation updated as needed
|
265 |
+
- [ ] Team notified of any issues
|
266 |
+
|
267 |
+
---
|
268 |
+
|
269 |
+
**Ready to start? Run `./review_dependabot_prs.sh` to begin the automated review workflow!**
|
HUGGINGFACE_PROTECTION.md
ADDED
@@ -0,0 +1,188 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# π€ Hugging Face Repository Protection Guide
|
2 |
+
|
3 |
+
## π Overview
|
4 |
+
|
5 |
+
Hugging Face repositories have different protection mechanisms than GitHub. This guide shows how to implement protection for your algorithmic trading repositories on Hugging Face.
|
6 |
+
|
7 |
+
## π‘οΈ Available Protection Methods
|
8 |
+
|
9 |
+
### **1. Repository Settings (Web Interface)**
|
10 |
+
|
11 |
+
#### **Access Control:**
|
12 |
+
1. Go to your repository: `https://huggingface.co/ParallelLLC/algorithmic_trading`
|
13 |
+
2. Click **"Settings"** tab
|
14 |
+
3. Configure these settings:
|
15 |
+
|
16 |
+
**Repository Visibility:**
|
17 |
+
- [x] **Private** (recommended for trading systems)
|
18 |
+
- [ ] Public (if you want to share)
|
19 |
+
|
20 |
+
**Collaboration:**
|
21 |
+
- [x] **Require approval for new collaborators**
|
22 |
+
- [x] **Restrict push access to maintainers only**
|
23 |
+
|
24 |
+
**Model Card:**
|
25 |
+
- [x] **Require model card for uploads**
|
26 |
+
- [x] **Validate model card format**
|
27 |
+
|
28 |
+
### **2. Git Hooks (Local Protection)**
|
29 |
+
|
30 |
+
#### **Pre-commit Hook:**
|
31 |
+
The pre-commit hook I created will:
|
32 |
+
- β
Warn about direct commits to main
|
33 |
+
- β
Run tests before commit
|
34 |
+
- β
Check code formatting
|
35 |
+
- β
Scan for secrets
|
36 |
+
- β
Prevent commits if checks fail
|
37 |
+
|
38 |
+
#### **Install the Hook:**
|
39 |
+
```bash
|
40 |
+
# The hook is already installed in .git/hooks/pre-commit
|
41 |
+
# It will run automatically on every commit
|
42 |
+
```
|
43 |
+
|
44 |
+
### **3. CI/CD Protection**
|
45 |
+
|
46 |
+
#### **GitHub Actions (Recommended):**
|
47 |
+
Since Hugging Face integrates with GitHub:
|
48 |
+
1. **Keep GitHub as primary** with full protection
|
49 |
+
2. **Sync to Hugging Face** after GitHub validation
|
50 |
+
3. **Use GitHub's branch protection** rules
|
51 |
+
|
52 |
+
#### **Workflow:**
|
53 |
+
```bash
|
54 |
+
# 1. Develop on GitHub (with protection)
|
55 |
+
git push origin feature/new-strategy
|
56 |
+
|
57 |
+
# 2. Create PR on GitHub
|
58 |
+
# 3. All checks pass
|
59 |
+
# 4. Merge to main
|
60 |
+
# 5. Sync to Hugging Face
|
61 |
+
git push hf main
|
62 |
+
git push esalguero_hf main
|
63 |
+
```
|
64 |
+
|
65 |
+
### **4. Manual Protection Practices**
|
66 |
+
|
67 |
+
#### **Development Workflow:**
|
68 |
+
```bash
|
69 |
+
# Always use feature branches
|
70 |
+
git checkout -b feature/new-strategy
|
71 |
+
# Make changes
|
72 |
+
git commit -m "feat: add new strategy"
|
73 |
+
git push origin feature/new-strategy
|
74 |
+
|
75 |
+
# Create PR on GitHub (not Hugging Face)
|
76 |
+
# Get reviews and approvals
|
77 |
+
# Merge on GitHub
|
78 |
+
# Then sync to Hugging Face
|
79 |
+
```
|
80 |
+
|
81 |
+
#### **Code Review Process:**
|
82 |
+
1. **Never commit directly to main**
|
83 |
+
2. **Always create feature branches**
|
84 |
+
3. **Use GitHub for PRs and reviews**
|
85 |
+
4. **Sync to Hugging Face after approval**
|
86 |
+
|
87 |
+
## π§ Implementation Steps
|
88 |
+
|
89 |
+
### **Step 1: Configure Repository Settings**
|
90 |
+
1. Go to: `https://huggingface.co/ParallelLLC/algorithmic_trading/settings`
|
91 |
+
2. Set repository to **Private**
|
92 |
+
3. Enable **Require approval for collaborators**
|
93 |
+
|
94 |
+
### **Step 2: Use GitHub as Primary**
|
95 |
+
1. **Develop on GitHub** with full protection
|
96 |
+
2. **Use GitHub's branch protection** rules
|
97 |
+
3. **Sync to Hugging Face** after validation
|
98 |
+
|
99 |
+
### **Step 3: Enable Pre-commit Hook**
|
100 |
+
```bash
|
101 |
+
# The hook is already installed and executable
|
102 |
+
# It will run automatically on commits
|
103 |
+
```
|
104 |
+
|
105 |
+
### **Step 4: Team Guidelines**
|
106 |
+
```markdown
|
107 |
+
## Development Guidelines for Hugging Face Repos
|
108 |
+
|
109 |
+
### β
Do:
|
110 |
+
- Use GitHub for development and PRs
|
111 |
+
- Create feature branches for all changes
|
112 |
+
- Get code review before merging
|
113 |
+
- Run tests locally before pushing
|
114 |
+
- Sync to Hugging Face after GitHub approval
|
115 |
+
|
116 |
+
### β Don't:
|
117 |
+
- Commit directly to main branch
|
118 |
+
- Push untested code
|
119 |
+
- Skip code review process
|
120 |
+
- Use Hugging Face for development workflow
|
121 |
+
```
|
122 |
+
|
123 |
+
## π¨ Emergency Procedures
|
124 |
+
|
125 |
+
### **If Direct Commit to Main is Needed:**
|
126 |
+
```bash
|
127 |
+
# 1. Create emergency branch
|
128 |
+
git checkout -b hotfix/emergency-fix
|
129 |
+
|
130 |
+
# 2. Make minimal fix
|
131 |
+
git commit -m "hotfix: emergency fix for critical issue"
|
132 |
+
|
133 |
+
# 3. Test thoroughly
|
134 |
+
python -m pytest tests/
|
135 |
+
python demo.py
|
136 |
+
|
137 |
+
# 4. Push to GitHub first
|
138 |
+
git push origin hotfix/emergency-fix
|
139 |
+
|
140 |
+
# 5. Create emergency PR
|
141 |
+
# 6. Get expedited review
|
142 |
+
# 7. Merge and sync to Hugging Face
|
143 |
+
```
|
144 |
+
|
145 |
+
## π Protection Summary
|
146 |
+
|
147 |
+
### **GitHub (Primary Development):**
|
148 |
+
- β
Full branch protection
|
149 |
+
- β
Required reviews
|
150 |
+
- β
CI/CD checks
|
151 |
+
- β
Code owner reviews
|
152 |
+
- β
Automated testing
|
153 |
+
|
154 |
+
### **Hugging Face (Distribution):**
|
155 |
+
- β
Private repository
|
156 |
+
- β
Pre-commit hooks
|
157 |
+
- β
Manual review process
|
158 |
+
- β
Sync after GitHub validation
|
159 |
+
|
160 |
+
## π― Best Practices
|
161 |
+
|
162 |
+
### **1. Use GitHub as Source of Truth**
|
163 |
+
- All development happens on GitHub
|
164 |
+
- Hugging Face is for distribution
|
165 |
+
- Sync after GitHub validation
|
166 |
+
|
167 |
+
### **2. Never Skip Protection**
|
168 |
+
- Always use feature branches
|
169 |
+
- Always get code review
|
170 |
+
- Always run tests
|
171 |
+
- Always validate on GitHub first
|
172 |
+
|
173 |
+
### **3. Monitor Both Repositories**
|
174 |
+
- Check GitHub for development status
|
175 |
+
- Check Hugging Face for distribution status
|
176 |
+
- Ensure both are in sync
|
177 |
+
|
178 |
+
## π Useful Links
|
179 |
+
|
180 |
+
- **GitHub Repository**: https://github.com/EAName/algorithmic_trading
|
181 |
+
- **Hugging Face ParallelLLC**: https://huggingface.co/ParallelLLC/algorithmic_trading
|
182 |
+
- **Hugging Face esalguero**: https://huggingface.co/esalguero/algorithmic_trading
|
183 |
+
- **GitHub Settings**: https://github.com/EAName/algorithmic_trading/settings/branches
|
184 |
+
- **Hugging Face Settings**: https://huggingface.co/ParallelLLC/algorithmic_trading/settings
|
185 |
+
|
186 |
+
---
|
187 |
+
|
188 |
+
**Note**: Hugging Face repositories are best used for model distribution and sharing, while GitHub provides the robust development and protection features needed for algorithmic trading systems.
|
review_dependabot_prs.sh
ADDED
@@ -0,0 +1,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
# Dependabot PR Review Workflow Script
|
4 |
+
# This script helps review all Dependabot PRs efficiently
|
5 |
+
|
6 |
+
echo "π€ Dependabot PR Review Workflow"
|
7 |
+
echo "=================================="
|
8 |
+
|
9 |
+
# Configuration
|
10 |
+
EANAME_REPO="EAName/algorithmic_trading"
|
11 |
+
PARALLEL_REPO="ParallelLLC/algorithmic_trading"
|
12 |
+
|
13 |
+
# Colors for output
|
14 |
+
RED='\033[0;31m'
|
15 |
+
GREEN='\033[0;32m'
|
16 |
+
YELLOW='\033[1;33m'
|
17 |
+
BLUE='\033[0;34m'
|
18 |
+
NC='\033[0m' # No Color
|
19 |
+
|
20 |
+
# Function to check PR status
|
21 |
+
check_pr_status() {
|
22 |
+
local repo=$1
|
23 |
+
local pr_number=$2
|
24 |
+
local pr_title=$3
|
25 |
+
|
26 |
+
echo -e "\n${BLUE}π Reviewing PR #$pr_number: $pr_title${NC}"
|
27 |
+
echo "Repository: $repo"
|
28 |
+
|
29 |
+
# Open PR in browser
|
30 |
+
echo -e "${YELLOW}π Opening PR in browser...${NC}"
|
31 |
+
open "https://github.com/$repo/pull/$pr_number"
|
32 |
+
|
33 |
+
# Wait for user to review
|
34 |
+
echo -e "${YELLOW}β³ Review the PR in your browser, then press Enter to continue...${NC}"
|
35 |
+
read -r
|
36 |
+
|
37 |
+
# Ask for decision
|
38 |
+
echo -e "${GREEN}β
Decision for PR #$pr_number:${NC}"
|
39 |
+
echo "1. Approve"
|
40 |
+
echo "2. Request changes"
|
41 |
+
echo "3. Comment only"
|
42 |
+
echo "4. Skip for now"
|
43 |
+
|
44 |
+
read -p "Enter your choice (1-4): " choice
|
45 |
+
|
46 |
+
case $choice in
|
47 |
+
1)
|
48 |
+
echo -e "${GREEN}β
Approved PR #$pr_number${NC}"
|
49 |
+
echo "$repo PR #$pr_number: APPROVED - $pr_title" >> review_log.txt
|
50 |
+
;;
|
51 |
+
2)
|
52 |
+
echo -e "${RED}β Requested changes for PR #$pr_number${NC}"
|
53 |
+
echo "$repo PR #$pr_number: CHANGES_REQUESTED - $pr_title" >> review_log.txt
|
54 |
+
;;
|
55 |
+
3)
|
56 |
+
echo -e "${YELLOW}π¬ Commented on PR #$pr_number${NC}"
|
57 |
+
echo "$repo PR #$pr_number: COMMENTED - $pr_title" >> review_log.txt
|
58 |
+
;;
|
59 |
+
4)
|
60 |
+
echo -e "${YELLOW}βοΈ Skipped PR #$pr_number${NC}"
|
61 |
+
echo "$repo PR #$pr_number: SKIPPED - $pr_title" >> review_log.txt
|
62 |
+
;;
|
63 |
+
*)
|
64 |
+
echo -e "${RED}β Invalid choice, skipping...${NC}"
|
65 |
+
echo "$repo PR #$pr_number: SKIPPED - $pr_title" >> review_log.txt
|
66 |
+
;;
|
67 |
+
esac
|
68 |
+
}
|
69 |
+
|
70 |
+
# Function to run local tests
|
71 |
+
run_local_tests() {
|
72 |
+
echo -e "\n${BLUE}π§ͺ Running local tests...${NC}"
|
73 |
+
|
74 |
+
# Check if we're in the right directory
|
75 |
+
if [ ! -f "requirements.txt" ]; then
|
76 |
+
echo -e "${RED}β Not in algorithmic_trading directory${NC}"
|
77 |
+
return 1
|
78 |
+
fi
|
79 |
+
|
80 |
+
# Run tests
|
81 |
+
echo "Running pytest..."
|
82 |
+
python -m pytest tests/ -v --tb=short
|
83 |
+
if [ $? -eq 0 ]; then
|
84 |
+
echo -e "${GREEN}β
Tests passed${NC}"
|
85 |
+
else
|
86 |
+
echo -e "${RED}β Tests failed${NC}"
|
87 |
+
return 1
|
88 |
+
fi
|
89 |
+
|
90 |
+
# Check code formatting
|
91 |
+
echo "Checking code formatting..."
|
92 |
+
python -m black --check .
|
93 |
+
if [ $? -eq 0 ]; then
|
94 |
+
echo -e "${GREEN}β
Code formatting OK${NC}"
|
95 |
+
else
|
96 |
+
echo -e "${YELLOW}β οΈ Code formatting issues found${NC}"
|
97 |
+
fi
|
98 |
+
|
99 |
+
# Check for security issues
|
100 |
+
echo "Checking for security issues..."
|
101 |
+
if command -v safety &> /dev/null; then
|
102 |
+
safety check
|
103 |
+
else
|
104 |
+
echo -e "${YELLOW}β οΈ Safety not installed, skipping security check${NC}"
|
105 |
+
fi
|
106 |
+
}
|
107 |
+
|
108 |
+
# Function to check Docker build
|
109 |
+
check_docker_build() {
|
110 |
+
echo -e "\n${BLUE}π³ Testing Docker build...${NC}"
|
111 |
+
|
112 |
+
# Build Docker image
|
113 |
+
docker build -t test-algorithmic-trading .
|
114 |
+
if [ $? -eq 0 ]; then
|
115 |
+
echo -e "${GREEN}β
Docker build successful${NC}"
|
116 |
+
|
117 |
+
# Test Docker image
|
118 |
+
docker run --rm test-algorithmic-trading python -c "print('Docker test passed')"
|
119 |
+
if [ $? -eq 0 ]; then
|
120 |
+
echo -e "${GREEN}β
Docker image test passed${NC}"
|
121 |
+
else
|
122 |
+
echo -e "${RED}β Docker image test failed${NC}"
|
123 |
+
fi
|
124 |
+
|
125 |
+
# Clean up
|
126 |
+
docker rmi test-algorithmic-trading
|
127 |
+
else
|
128 |
+
echo -e "${RED}β Docker build failed${NC}"
|
129 |
+
return 1
|
130 |
+
fi
|
131 |
+
}
|
132 |
+
|
133 |
+
# Main workflow
|
134 |
+
main() {
|
135 |
+
echo -e "${GREEN}π Starting Dependabot PR Review Workflow${NC}"
|
136 |
+
|
137 |
+
# Initialize review log
|
138 |
+
echo "# Dependabot PR Review Log - $(date)" > review_log.txt
|
139 |
+
echo "" >> review_log.txt
|
140 |
+
|
141 |
+
# Run local tests first
|
142 |
+
run_local_tests
|
143 |
+
|
144 |
+
# Check Docker build
|
145 |
+
check_docker_build
|
146 |
+
|
147 |
+
echo -e "\n${BLUE}π Reviewing EAName Repository PRs${NC}"
|
148 |
+
echo "=================================="
|
149 |
+
|
150 |
+
# EAName Repository PRs
|
151 |
+
check_pr_status "$EANAME_REPO" "6" "docker(deps): bump python from 3.11-slim to 3.13-slim"
|
152 |
+
check_pr_status "$EANAME_REPO" "5" "github-actions(deps): bump peter-evans/create-pull-request from 4 to 7"
|
153 |
+
check_pr_status "$EANAME_REPO" "4" "github-actions(deps): bump peaceiris/actions-gh-pages from 3 to 4"
|
154 |
+
check_pr_status "$EANAME_REPO" "3" "github-actions(deps): bump actions/upload-artifact from 3 to 4"
|
155 |
+
check_pr_status "$EANAME_REPO" "2" "github-actions(deps): bump docker/login-action from 2 to 3"
|
156 |
+
check_pr_status "$EANAME_REPO" "1" "github-actions(deps): bump github/codeql-action from 2 to 3"
|
157 |
+
|
158 |
+
echo -e "\n${BLUE}π Reviewing ParallelLLC Repository PRs${NC}"
|
159 |
+
echo "=================================="
|
160 |
+
|
161 |
+
# ParallelLLC Repository PRs
|
162 |
+
check_pr_status "$PARALLEL_REPO" "6" "docker(deps): bump python from 3.11-slim to 3.13-slim"
|
163 |
+
check_pr_status "$PARALLEL_REPO" "5" "github-actions(deps): bump actions/setup-python from 4 to 5"
|
164 |
+
check_pr_status "$PARALLEL_REPO" "4" "github-actions(deps): bump docker/login-action from 2 to 3"
|
165 |
+
check_pr_status "$PARALLEL_REPO" "3" "github-actions(deps): bump docker/metadata-action from 4 to 5"
|
166 |
+
check_pr_status "$PARALLEL_REPO" "2" "github-actions(deps): bump peter-evans/create-pull-request from 4 to 7"
|
167 |
+
check_pr_status "$PARALLEL_REPO" "1" "github-actions(deps): bump docker/build-push-action from 4 to 6"
|
168 |
+
|
169 |
+
# Summary
|
170 |
+
echo -e "\n${GREEN}β
Review workflow completed!${NC}"
|
171 |
+
echo -e "${BLUE}π Review log saved to: review_log.txt${NC}"
|
172 |
+
echo -e "\n${YELLOW}π Summary:${NC}"
|
173 |
+
cat review_log.txt
|
174 |
+
}
|
175 |
+
|
176 |
+
# Run the workflow
|
177 |
+
main
|
setup_branch_protection.sh
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
# Branch Protection Setup Script
|
4 |
+
# Run this script to automatically configure branch protection
|
5 |
+
|
6 |
+
echo "π‘οΈ Setting up branch protection for algorithmic trading repository..."
|
7 |
+
|
8 |
+
# Configuration
|
9 |
+
REPO="EAName/algorithmic_trading"
|
10 |
+
BRANCH="main"
|
11 |
+
REQUIRED_REVIEWS=2
|
12 |
+
REQUIRED_CHECKS='["ci-cd/quality-check","ci-cd/test","ci-cd/security","ci-cd/backtesting"]'
|
13 |
+
|
14 |
+
echo "π Configuration:"
|
15 |
+
echo " Repository: $REPO"
|
16 |
+
echo " Branch: $BRANCH"
|
17 |
+
echo " Required reviews: $REQUIRED_REVIEWS"
|
18 |
+
echo " Required checks: $REQUIRED_CHECKS"
|
19 |
+
|
20 |
+
echo ""
|
21 |
+
echo "β οΈ IMPORTANT: You need a GitHub Personal Access Token with 'repo' permissions"
|
22 |
+
echo " Get one from: https://github.com/settings/tokens"
|
23 |
+
echo ""
|
24 |
+
|
25 |
+
read -p "Enter your GitHub Personal Access Token: " GITHUB_TOKEN
|
26 |
+
|
27 |
+
if [ -z "$GITHUB_TOKEN" ]; then
|
28 |
+
echo "β No token provided. Exiting."
|
29 |
+
exit 1
|
30 |
+
fi
|
31 |
+
|
32 |
+
echo ""
|
33 |
+
echo "π§ Applying branch protection rules..."
|
34 |
+
|
35 |
+
# Apply branch protection
|
36 |
+
curl -X PUT \
|
37 |
+
-H "Authorization: token $GITHUB_TOKEN" \
|
38 |
+
-H "Accept: application/vnd.github.v3+json" \
|
39 |
+
"https://api.github.com/repos/$REPO/branches/$BRANCH/protection" \
|
40 |
+
-d "{
|
41 |
+
\"required_status_checks\": {
|
42 |
+
\"strict\": true,
|
43 |
+
\"contexts\": $REQUIRED_CHECKS
|
44 |
+
},
|
45 |
+
\"enforce_admins\": true,
|
46 |
+
\"required_pull_request_reviews\": {
|
47 |
+
\"required_approving_review_count\": $REQUIRED_REVIEWS,
|
48 |
+
\"dismiss_stale_reviews\": true,
|
49 |
+
\"require_code_owner_reviews\": true
|
50 |
+
},
|
51 |
+
\"restrictions\": null,
|
52 |
+
\"allow_force_pushes\": false,
|
53 |
+
\"allow_deletions\": false
|
54 |
+
}"
|
55 |
+
|
56 |
+
if [ $? -eq 0 ]; then
|
57 |
+
echo ""
|
58 |
+
echo "β
Branch protection successfully applied!"
|
59 |
+
echo ""
|
60 |
+
echo "π Applied rules:"
|
61 |
+
echo " - Require pull request before merging"
|
62 |
+
echo " - Require $REQUIRED_REVIEWS approvals"
|
63 |
+
echo " - Require code owner reviews"
|
64 |
+
echo " - Require status checks: $REQUIRED_CHECKS"
|
65 |
+
echo " - No force pushes allowed"
|
66 |
+
echo " - No deletions allowed"
|
67 |
+
echo ""
|
68 |
+
echo "π View settings: https://github.com/$REPO/settings/branches"
|
69 |
+
else
|
70 |
+
echo ""
|
71 |
+
echo "β Failed to apply branch protection. Check your token and permissions."
|
72 |
+
fi
|