Skip to content

Commit cfb38b2

Browse files
Merge pull request #4 from jeremymanning/main
Major refactoring: CLI system, comprehensive testing, and Windows compatibility
2 parents 6de29c1 + c96813d commit cfb38b2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+704607
-29
lines changed

.github/workflows/tests.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main ]
8+
workflow_dispatch:
9+
10+
jobs:
11+
test:
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
os: [ubuntu-latest, macos-latest, windows-latest]
17+
python-version: ["3.10"]
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Set up Python ${{ matrix.python-version }}
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
27+
- name: Cache dependencies
28+
uses: actions/cache@v4
29+
with:
30+
path: |
31+
~/.cache/pip
32+
~/miniconda3/envs
33+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt', '**/setup.py') }}
34+
restore-keys: |
35+
${{ runner.os }}-pip-
36+
37+
- name: Install dependencies
38+
run: |
39+
python -m pip install --upgrade pip
40+
pip install pytest pytest-cov
41+
pip install "numpy<2" scipy transformers matplotlib seaborn pandas tqdm
42+
pip install cleantext plotly scikit-learn
43+
pip install torch --index-url https://download.pytorch.org/whl/cpu
44+
pip install -e .
45+
46+
- name: Create test data
47+
run: |
48+
cd tests
49+
python create_test_data.py
50+
cd ..
51+
52+
- name: Run visualization tests
53+
run: |
54+
pytest tests/test_visualization.py -v --tb=short
55+
56+
- name: Run CLI tests
57+
run: |
58+
pytest tests/test_cli.py -v --tb=short
59+
60+
- name: Run model training tests
61+
run: |
62+
pytest tests/test_model_training.py -v --tb=short
63+
64+
- name: Test figure generation (single)
65+
run: |
66+
python generate_figures.py --figure 1a --data tests/data/test_model_results.pkl --output tests/output_single
67+
68+
- name: Test figure generation (all)
69+
run: |
70+
python generate_figures.py --data tests/data/test_model_results.pkl --output tests/output_all
71+
timeout-minutes: 5
72+
73+
- name: Upload test artifacts
74+
if: failure()
75+
uses: actions/upload-artifact@v4
76+
with:
77+
name: test-results-${{ matrix.os }}-${{ matrix.python-version }}
78+
path: |
79+
tests/output_*
80+
tests/data/*.csv
81+
82+
- name: Check generated files
83+
run: python tests/check_outputs.py

.gitignore

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,19 @@
88
*.out
99
*.synctex.gz
1010
__pycache__/
11-
CLAUDE.md
11+
CLAUDE.md
12+
13+
# Python
14+
*.pyc
15+
*.pyo
16+
*.egg-info/
17+
.pytest_cache/
18+
htmlcov/
19+
.coverage
20+
*.cover
21+
22+
# Test outputs
23+
tests/output_*/
24+
tests/data/*.csv
25+
tests/data/*.pkl
26+
!tests/data/test_model_results.pkl

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Contextual Dynamics Laboratory
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)