Skip to content

Commit e1b4fbf

Browse files
committed
Update copilot instructions with CI/CD fixes and type safety improvements
- Document CI/CD pipeline operational status (Nov 7, 2025) - Add detailed CI fixes: linting, formatting, mypy configuration - Document type safety best practices (NDArray, polars casts, type ignores) - Update technical implementation details for all modules - Add comprehensive type checking guidelines - Update last modified date and project status
1 parent 1f37af5 commit e1b4fbf

File tree

1 file changed

+52
-16
lines changed

1 file changed

+52
-16
lines changed

.github/copilot-instructions.md

Lines changed: 52 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ You are assisting in a **Python/Poetry** repository called **"thanksgiving-alpha
1515

1616
---
1717

18-
## 📊 Current State (as of November 6, 2025)
18+
## 📊 Current State (as of November 7, 2025)
1919

2020
### ✅ Completed Features
2121

@@ -38,9 +38,9 @@ You are assisting in a **Python/Poetry** repository called **"thanksgiving-alpha
3838
3. **Testing & Quality**
3939
- **28 passing unit tests** (pytest)
4040
- Test coverage: holidays, calendar, stats, ranking, statistical tests
41-
- Typed with mypy (strict mode)
41+
- Typed with mypy (strict mode) with proper numpy NDArray annotations
4242
- Linted with ruff and black
43-
- All CI checks passing
43+
- **All CI checks passing** ✅ (as of Nov 7, 2025)
4444

4545
4. **CLI & Configuration**
4646
- Command: `python -m tgalpha.cli <config> --top=N --statistics --show-coverage`
@@ -50,12 +50,12 @@ You are assisting in a **Python/Poetry** repository called **"thanksgiving-alpha
5050

5151
5. **Documentation**
5252
- README.md (comprehensive usage guide)
53-
- EXECUTIVE_SUMMARY.md (cross-index stakeholder overview with sampling methodology) - **UPDATED**
54-
- ANALYSIS_SP500_25YEARS.md (S&P 500: 5,756 observations, 244 stocks, with sampling rationale) - **UPDATED**
55-
- ANALYSIS_NASDAQ100_25YEARS.md (NASDAQ-100: 1,818 observations, 80 stocks) - **UPDATED**
56-
- ANALYSIS_25YEARS.md (DJIA: 719 observations, 30 stocks) - **UPDATED**
57-
- STATISTICAL_RESULTS_SUMMARY.md (comprehensive statistical testing documentation) - **NEW**
58-
- REFERENCES.md (10 academic citations with DOIs) - **NEW**
53+
- EXECUTIVE_SUMMARY.md (cross-index stakeholder overview with sampling methodology)
54+
- ANALYSIS_SP500_25YEARS.md (S&P 500: 5,756 observations, 244 stocks, with sampling rationale)
55+
- ANALYSIS_NASDAQ100_25YEARS.md (NASDAQ-100: 1,818 observations, 80 stocks)
56+
- ANALYSIS_25YEARS.md (DJIA: 719 observations, 30 stocks)
57+
- STATISTICAL_RESULTS_SUMMARY.md (comprehensive statistical testing documentation)
58+
- REFERENCES.md (10 academic citations with DOIs)
5959
- CITATION.cff (academic citation support)
6060
- .github/FUNDING.yml (donation/sponsorship links)
6161

@@ -67,6 +67,22 @@ You are assisting in a **Python/Poetry** repository called **"thanksgiving-alpha
6767
- MIT License
6868
- All analyses complete with statistical rigor
6969

70+
7. **CI/CD Pipeline****FULLY OPERATIONAL**
71+
- GitHub Actions workflow (.github/workflows/ci.yml)
72+
- Runs on every push and pull request
73+
- Python 3.12 environment (matches local development)
74+
- Four-stage validation:
75+
1. Ruff linting (code quality checks)
76+
2. Black formatting (code style consistency)
77+
3. Mypy type checking (strict mode with proper type annotations)
78+
4. Pytest test suite (28 tests)
79+
- **Recent fixes (Nov 7, 2025):**
80+
- Fixed 12 unused import linting errors
81+
- Updated Python version from 3.11 → 3.12
82+
- Configured mypy to handle third-party library stubs (pandas, scipy, statsmodels, yfinance, yaml)
83+
- Added proper numpy NDArray type annotations (replaced `np.ndarray` with `NDArray[Any]`)
84+
- All type checking errors resolved
85+
7086
---
7187

7288
## 🔧 Technical Implementation Details
@@ -77,6 +93,7 @@ You are assisting in a **Python/Poetry** repository called **"thanksgiving-alpha
7793
- NYSECalendar class with 10 holidays
7894
- `shift_business_days()` function handles non-trading days
7995
- Black Friday is NOT a holiday (half-day session counted as trading day)
96+
- **Type Safety:** Added `# type: ignore[misc]` for pandas USFederalHolidayCalendar inheritance
8097

8198
2. **Data Provider** (`src/tgalpha/data_providers/yahoo.py`)
8299
- **Critical:** Use `auto_adjust=True` to avoid MultiIndex column issues
@@ -88,13 +105,25 @@ You are assisting in a **Python/Poetry** repository called **"thanksgiving-alpha
88105
- `compute_return()`: Year-tracked returns with null checks
89106
- Simple returns (not log returns)
90107

91-
4. **Ranking System** (`src/tgalpha/ranking.py`)
108+
4. **Statistical Tests** (`src/tgalpha/stats_tests.py`)
109+
- **Type Safety:** Uses `NDArray[Any]` from `numpy.typing` for all array parameters
110+
- Bootstrap confidence intervals with explicit float casts
111+
- Wilcoxon signed-rank test and t-test implementations
112+
- Benjamini-Hochberg FDR correction for multiple testing
113+
- Effect size (Cohen's d) and Sharpe ratio calculations
114+
115+
5. **Ranking System** (`src/tgalpha/ranking.py`)
92116
- Aggregates: n, median_return, avg_return, win_rate, std
93117
- Sorts by: [median_return, win_rate, avg_return]
94118
- Filters: min_trades parameter (default 10)
95119

96-
5. **Python Environment**
97-
- Python 3.12.6 with Poetry
120+
6. **Coverage Analysis** (`src/tgalpha/coverage.py`)
121+
- **Type Safety:** Explicit int/float casts for polars DataFrame values
122+
- Added `# type: ignore[arg-type]` for polars aggregation methods
123+
- Computes year-by-year data completeness
124+
125+
7. **Python Environment**
126+
- Python 3.12.6 with Poetry (3.12.12 on CI)
98127
- Key dependencies: polars 1.35.1, pandas 2.3.3, typer 0.7.0, yfinance 0.2.66
99128
- Virtual environment at `.venv/`
100129

@@ -210,9 +239,16 @@ Read the markdown reports to understand findings:
210239
- Yahoo Finance auto_adjust=True required for proper column handling
211240
- Black Friday is half-day (1:00 PM ET close) but counted as trading day
212241

242+
**Type Checking Best Practices:**
243+
- Use `NDArray[Any]` from `numpy.typing` instead of `np.ndarray` for function signatures
244+
- Add explicit int/float casts for polars DataFrame aggregations (.mean(), .median(), .min(), .max())
245+
- Use `# type: ignore[misc]` for pandas class inheritance (USFederalHolidayCalendar)
246+
- Use `# type: ignore[arg-type]` for polars aggregation methods when mypy is too strict
247+
- Configure mypy in pyproject.toml to ignore missing stubs for third-party libraries
248+
213249
**Test Coverage:**
214250
- Run `pytest tests/ -v` to verify all 28 tests pass
215-
- Coverage includes: holidays (6), calendar (9), stats (8), ranking (6)
251+
- Coverage includes: holidays (6), calendar (9), stats (8), ranking (6), statistical tests (5)
216252

217253
---
218254

@@ -376,7 +412,7 @@ git show <commit-hash>
376412
5. **Ask user for context** - What do they want to work on next?
377413

378414
**Common continuation points:**
379-
- Adding new universes (S&P 500, Russell 2000)
415+
- Adding new universes (Russell 2000, sector ETFs)
380416
- Extending analysis windows (different day combinations)
381417
- Adding visualization/dashboards
382418
- Implementing backtesting strategies
@@ -386,8 +422,8 @@ git show <commit-hash>
386422

387423
---
388424

389-
**Last Updated:** November 6, 2025
390-
**Project Status:** Production Ready (v1.0.0) - All three indices complete with statistical testing
425+
**Last Updated:** November 7, 2025
426+
**Project Status:** Production Ready (v1.0.0) - All three indices complete with statistical testing + CI/CD fully operational
391427
**Repository:** https://github.com/lieblm/thanksgiving-alpha
392428
**Author:** Martin Liebl (lieblm@gmail.com)
393429

0 commit comments

Comments
 (0)