Skip to content

Commit 81d5415

Browse files
authored
Merge pull request #174 from jbohnslav/cleanup
Modernize deepethogram: Python 3.11, uv, unified Docker, Modal GPU tests
2 parents a77c77c + b4f3511 commit 81d5415

48 files changed

Lines changed: 5096 additions & 577 deletions

Some content is hidden

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

.dockerignore

Lines changed: 47 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,47 @@
1-
**/.git
2-
**/.gitignore
3-
**/.vscode
4-
**/coverage
5-
**/.env
6-
**/.aws
7-
**/.ssh
8-
Dockerfile
9-
docker-compose.yml
10-
**/.DS_Store
11-
**/venv
12-
**/env
13-
build/*
14-
dist/*
15-
docs/*
16-
docker/
1+
**
2+
3+
!README.md
4+
!MANIFEST.in
5+
!pyproject.toml
6+
!uv.lock
7+
!pytest.ini
8+
!setup_tests.py
9+
!deepethogram/
10+
!deepethogram/**
11+
!tests/
12+
!tests/**
13+
!docker/
14+
!docker/Dockerfile
15+
!docker/build_and_test.sh
16+
17+
.git/
18+
.github/
19+
.gitignore
20+
.venv/
21+
venv/
22+
env/
23+
.env
24+
.aws/
25+
.ssh/
26+
.vscode/
27+
.idea/
28+
.kd/
29+
.pytest_cache/
30+
.ruff_cache/
31+
.mypy_cache/
32+
.nox/
33+
.tox/
34+
__pycache__/
35+
*.py[cod]
36+
*.so
37+
.DS_Store
38+
coverage
39+
.coverage
40+
.coverage.*
41+
htmlcov/
42+
build/
43+
dist/
44+
docs/
45+
paper.pdf
46+
deepethogram.egg-info/
47+
tests/DATA/
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Claude Code Review
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, ready_for_review, reopened]
6+
# Optional: Only run on specific file changes
7+
# paths:
8+
# - "src/**/*.ts"
9+
# - "src/**/*.tsx"
10+
# - "src/**/*.js"
11+
# - "src/**/*.jsx"
12+
13+
jobs:
14+
claude-review:
15+
if: |
16+
github.event.pull_request.author_association == 'OWNER' ||
17+
github.event.pull_request.author_association == 'MEMBER' ||
18+
github.event.pull_request.author_association == 'COLLABORATOR'
19+
20+
runs-on: ubuntu-latest
21+
timeout-minutes: 30
22+
permissions:
23+
contents: read
24+
pull-requests: write
25+
issues: write
26+
id-token: write
27+
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@v6
31+
with:
32+
fetch-depth: 1
33+
34+
- name: Run Claude Code Review
35+
id: claude-review
36+
uses: anthropics/claude-code-action@v1
37+
with:
38+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
39+
plugin_marketplaces: 'https://github.com/anthropics/claude-code.git'
40+
plugins: 'code-review@claude-code-plugins'
41+
prompt: '/code-review:code-review --comment ${{ github.repository }}/pull/${{ github.event.pull_request.number }}'
42+
use_sticky_comment: true
43+
track_progress: true
44+
claude_args: '--allowedTools "Bash(gh pr:*),Bash(gh api:*),Bash(gh diff:*)"'

.github/workflows/claude.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Claude Code
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
pull_request_review_comment:
7+
types: [created]
8+
issues:
9+
types: [opened, assigned]
10+
pull_request_review:
11+
types: [submitted]
12+
13+
jobs:
14+
claude:
15+
if: |
16+
github.event.sender.type == 'User' &&
17+
(
18+
(github.event_name == 'issue_comment' &&
19+
contains(github.event.comment.body, '@claude') &&
20+
(github.event.comment.author_association == 'OWNER' ||
21+
github.event.comment.author_association == 'MEMBER' ||
22+
github.event.comment.author_association == 'COLLABORATOR')) ||
23+
(github.event_name == 'pull_request_review_comment' &&
24+
contains(github.event.comment.body, '@claude') &&
25+
(github.event.comment.author_association == 'OWNER' ||
26+
github.event.comment.author_association == 'MEMBER' ||
27+
github.event.comment.author_association == 'COLLABORATOR')) ||
28+
(github.event_name == 'pull_request_review' &&
29+
contains(github.event.review.body, '@claude') &&
30+
(github.event.review.author_association == 'OWNER' ||
31+
github.event.review.author_association == 'MEMBER' ||
32+
github.event.review.author_association == 'COLLABORATOR')) ||
33+
(github.event_name == 'issues' &&
34+
(contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')) &&
35+
(github.event.issue.author_association == 'OWNER' ||
36+
github.event.issue.author_association == 'MEMBER' ||
37+
github.event.issue.author_association == 'COLLABORATOR'))
38+
)
39+
runs-on: ubuntu-latest
40+
timeout-minutes: 30
41+
permissions:
42+
contents: read
43+
pull-requests: write
44+
issues: write
45+
id-token: write
46+
actions: read # Required for Claude to read CI results on PRs
47+
steps:
48+
- name: Checkout repository
49+
uses: actions/checkout@v6
50+
with:
51+
fetch-depth: 1
52+
53+
- name: Run Claude Code
54+
id: claude
55+
uses: anthropics/claude-code-action@v1
56+
with:
57+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
58+
59+
# This is an optional setting that allows Claude to read CI results on PRs
60+
additional_permissions: |
61+
actions: read
62+
63+
# Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
64+
# prompt: 'Update the pull request description to include a summary of changes.'
65+
66+
claude_args: '--allowedTools "Bash(gh pr:*),Bash(gh api:*),Bash(gh diff:*)"'

.github/workflows/gpu-tests.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: GPU Tests
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
gpu-tests:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v6
12+
13+
- name: Install uv
14+
uses: astral-sh/setup-uv@v8.0.0
15+
with:
16+
enable-cache: true
17+
18+
- name: Set up Python 3.11
19+
uses: actions/setup-python@v6
20+
with:
21+
python-version: "3.11"
22+
23+
- name: Run GPU tests on Modal
24+
env:
25+
# Required repository secrets:
26+
# MODAL_TOKEN_ID
27+
# MODAL_TOKEN_SECRET
28+
MODAL_TOKEN_ID: ${{ secrets.MODAL_TOKEN_ID }}
29+
MODAL_TOKEN_SECRET: ${{ secrets.MODAL_TOKEN_SECRET }}
30+
DEG_MODAL_GPU: T4
31+
run: uvx --from modal modal run modal_gpu_test.py --write-junit pytest-gpu.xml
32+
33+
- name: Upload pytest XML
34+
if: always()
35+
uses: actions/upload-artifact@v6
36+
with:
37+
name: pytest-gpu-xml
38+
path: pytest-gpu.xml
39+
if-no-files-found: ignore
40+
41+
- name: Summarize pytest results
42+
if: always()
43+
run: |
44+
python - <<'PY'
45+
import os
46+
import xml.etree.ElementTree as ET
47+
from pathlib import Path
48+
49+
summary_path = Path(os.environ["GITHUB_STEP_SUMMARY"])
50+
xml_path = Path("pytest-gpu.xml")
51+
52+
if not xml_path.exists():
53+
summary_path.write_text("GPU pytest report was not produced.\n")
54+
raise SystemExit(0)
55+
56+
root = ET.parse(xml_path).getroot()
57+
testsuite = root if root.tag == "testsuite" else root.find("testsuite")
58+
if testsuite is None:
59+
summary_path.write_text("Unable to parse GPU pytest report.\n")
60+
raise SystemExit(0)
61+
62+
tests = int(testsuite.attrib.get("tests", 0))
63+
failures = int(testsuite.attrib.get("failures", 0))
64+
errors = int(testsuite.attrib.get("errors", 0))
65+
skipped = int(testsuite.attrib.get("skipped", 0))
66+
passed = tests - failures - errors - skipped
67+
68+
summary_path.write_text(
69+
"\n".join(
70+
[
71+
"## GPU Pytest Results",
72+
"",
73+
"| Metric | Count |",
74+
"| --- | ---: |",
75+
f"| Passed | {passed} |",
76+
f"| Failed | {failures} |",
77+
f"| Errors | {errors} |",
78+
f"| Skipped | {skipped} |",
79+
f"| Total | {tests} |",
80+
"",
81+
"Full JUnit XML is attached as the `pytest-gpu-xml` workflow artifact.",
82+
"",
83+
]
84+
)
85+
)
86+
PY

.github/workflows/gpu.yml

Lines changed: 0 additions & 51 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,52 +13,44 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
os: [ubuntu-20.04, windows-latest, macos-13]
16+
os: [ubuntu-latest, windows-latest, macos-latest]
1717

1818
steps:
19-
- uses: actions/checkout@v3
19+
- uses: actions/checkout@v6
2020

21-
- name: Set up Python 3.7
22-
uses: actions/setup-python@v4
21+
- name: Install uv
22+
uses: astral-sh/setup-uv@v8.0.0
2323
with:
24-
python-version: '3.7'
24+
enable-cache: true
2525

26-
- name: Install FFMPEG (Ubuntu)
27-
if: matrix.os == 'ubuntu-20.04'
26+
- name: Set up Python 3.11
27+
uses: actions/setup-python@v6
28+
with:
29+
python-version: '3.11'
30+
31+
- name: Install system dependencies (Ubuntu)
32+
if: matrix.os == 'ubuntu-latest'
2833
run: |
2934
sudo apt-get update
30-
sudo apt-get install -y ffmpeg
35+
sudo apt-get install -y ffmpeg libegl1 libopengl0 libgl1
3136
3237
- name: Install FFMPEG (Windows)
3338
if: matrix.os == 'windows-latest'
3439
run: |
35-
choco install ffmpeg
40+
choco install ffmpeg -y
3641
3742
- name: Install FFMPEG (macOS)
38-
if: matrix.os == 'macos-13'
43+
if: matrix.os == 'macos-latest'
3944
run: |
4045
brew install ffmpeg
4146
42-
- name: Install PySide2
43-
run: |
44-
python -m pip install --upgrade pip
45-
pip install "pyside2==5.13.2"
46-
47-
- name: Install PyTorch CPU
48-
run: |
49-
pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
50-
51-
- name: Install package and test dependencies
52-
run: |
53-
python -m pip install --upgrade "pip<24.0"
54-
pip install -r requirements.txt
55-
pip install pytest pytest-cov
56-
python setup.py develop
47+
- name: Install dependencies
48+
run: uv sync --locked --dev
5749

5850
- name: Setup test data
59-
run: |
60-
python setup_tests.py
51+
run: uv run python setup_tests.py
6152

6253
- name: Run CPU tests
63-
run: |
64-
pytest -v -m "not gpu" tests/
54+
env:
55+
QT_QPA_PLATFORM: offscreen
56+
run: uv run pytest -v -m "not gpu" tests/

0 commit comments

Comments
 (0)