Skip to content

Commit a77c77c

Browse files
authored
Merge pull request #167 from jbohnslav/jbohnslav/202408_fix
Code Quality Improvements and Development Infrastructure Updates
2 parents a2565bb + dc8b09c commit a77c77c

File tree

119 files changed

+6123
-5809
lines changed

Some content is hidden

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

119 files changed

+6123
-5809
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ docker-compose.yml
1313
build/*
1414
dist/*
1515
docs/*
16-
docker/
16+
docker/

.github/workflows/gpu.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Temporarily disabled - requires GitHub Teams plan for GPU runners
2+
# name: GPU Tests
3+
#
4+
# on:
5+
# push:
6+
# branches: [ master ]
7+
# pull_request:
8+
# branches: [ master ]
9+
#
10+
# jobs:
11+
# gpu-test:
12+
# runs-on: ubuntu-20.04
13+
#
14+
# steps:
15+
# - uses: actions/checkout@v3
16+
#
17+
# - name: Set up Python 3.7
18+
# uses: actions/setup-python@v4
19+
# with:
20+
# python-version: '3.7'
21+
#
22+
# - name: Install FFMPEG
23+
# run: |
24+
# sudo apt-get update
25+
# sudo apt-get install -y ffmpeg
26+
#
27+
# - name: Install PySide2
28+
# run: |
29+
# python -m pip install --upgrade pip
30+
# pip install "pyside2==5.13.2"
31+
#
32+
# - name: Install PyTorch with CUDA
33+
# run: |
34+
# pip install torch==1.11.0+cu115 torchvision==0.12.0+cu115 -f https://download.pytorch.org/whl/torch_stable.html
35+
#
36+
# - name: Install package and test dependencies
37+
# run: |
38+
# python -m pip install --upgrade "pip<24.0"
39+
# pip install -r requirements.txt
40+
# pip install pytest pytest-cov
41+
# python setup.py develop
42+
#
43+
# - name: Setup test data
44+
# run: |
45+
# python setup_tests.py
46+
#
47+
# - name: GPU Tests
48+
# run: |
49+
# pytest -v -m "gpu" tests/
50+
# env:
51+
# CUDA_VISIBLE_DEVICES: 0

.github/workflows/main.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: CPU Tests
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
test:
11+
name: Test on ${{ matrix.os }}
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
os: [ubuntu-20.04, windows-latest, macos-13]
17+
18+
steps:
19+
- uses: actions/checkout@v3
20+
21+
- name: Set up Python 3.7
22+
uses: actions/setup-python@v4
23+
with:
24+
python-version: '3.7'
25+
26+
- name: Install FFMPEG (Ubuntu)
27+
if: matrix.os == 'ubuntu-20.04'
28+
run: |
29+
sudo apt-get update
30+
sudo apt-get install -y ffmpeg
31+
32+
- name: Install FFMPEG (Windows)
33+
if: matrix.os == 'windows-latest'
34+
run: |
35+
choco install ffmpeg
36+
37+
- name: Install FFMPEG (macOS)
38+
if: matrix.os == 'macos-13'
39+
run: |
40+
brew install ffmpeg
41+
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
57+
58+
- name: Setup test data
59+
run: |
60+
python setup_tests.py
61+
62+
- name: Run CPU tests
63+
run: |
64+
pytest -v -m "not gpu" tests/

.github/workflows/pre-commit.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Pre-commit
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
pre-commit:
11+
runs-on: ubuntu-20.04
12+
steps:
13+
- uses: actions/checkout@v3
14+
15+
- name: Set up Python 3.7
16+
uses: actions/setup-python@v4
17+
with:
18+
python-version: '3.7'
19+
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install pre-commit ruff
24+
25+
- name: Run pre-commit
26+
run: |
27+
pre-commit install
28+
pre-commit run --all-files

.github/workflows/release.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: Publish Python 🐍 distribution 📦 to PyPI
2+
3+
on:
4+
push:
5+
# Only run this workflow when a tag with the pattern 'v*' is pushed
6+
tags:
7+
- 'v*'
8+
9+
jobs:
10+
# Step 1: Build the Python package
11+
build:
12+
name: Build distribution 📦
13+
runs-on: ubuntu-20.04
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
persist-credentials: false
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: '3.7'
23+
24+
- name: Install build dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install build pytest
28+
pip install -e .
29+
30+
- name: Run tests
31+
run: pytest tests/
32+
33+
- name: Build package
34+
run: python -m build
35+
36+
- name: Store the distribution packages
37+
uses: actions/upload-artifact@v4
38+
with:
39+
name: python-package-distributions
40+
path: dist/
41+
42+
# Step 2: Publish the distribution to PyPI
43+
publish-to-pypi:
44+
name: Publish to PyPI
45+
needs: build
46+
runs-on: ubuntu-latest
47+
48+
steps:
49+
- name: Download distribution packages
50+
uses: actions/download-artifact@v4
51+
with:
52+
name: python-package-distributions
53+
path: dist/
54+
55+
- name: Publish to PyPI
56+
uses: pypa/[email protected]
57+
with:
58+
# If using a secret-based token:
59+
username: '__token__'
60+
password: ${{ secrets.PYPI_API_TOKEN }}
61+
62+
# Step 3: Sign the distribution and create a GitHub release
63+
github-release:
64+
name: Sign the distribution 📦 with Sigstore and upload to GitHub Release
65+
needs: publish-to-pypi
66+
runs-on: ubuntu-latest
67+
permissions:
68+
contents: write # Required to create GitHub Releases
69+
id-token: write # Required for sigstore
70+
71+
steps:
72+
- name: Download distribution packages
73+
uses: actions/download-artifact@v4
74+
with:
75+
name: python-package-distributions
76+
path: dist/
77+
78+
- name: Sign the dists with Sigstore
79+
uses: sigstore/[email protected]
80+
with:
81+
inputs: >-
82+
./dist/*.tar.gz
83+
./dist/*.whl
84+
85+
- name: Create GitHub Release
86+
env:
87+
GITHUB_TOKEN: ${{ github.token }}
88+
run: |
89+
# $GITHUB_REF_NAME is the tag name, e.g. 'v1.0.0'
90+
gh release create "$GITHUB_REF_NAME" \
91+
--repo "$GITHUB_REPOSITORY" \
92+
--title "Release $GITHUB_REF_NAME" \
93+
--notes "See CHANGELOG for details."
94+
95+
- name: Upload artifact signatures to GitHub Release
96+
env:
97+
GITHUB_TOKEN: ${{ github.token }}
98+
run: |
99+
gh release upload "$GITHUB_REF_NAME" dist/** \
100+
--repo "$GITHUB_REPOSITORY"

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,4 +152,4 @@ venv.bak/
152152
dmypy.json
153153

154154
# Pyre type checker
155-
.pyre/
155+
.pyre/

.pre-commit-config.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v3.4.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-yaml
8+
- id: check-added-large-files
9+
- id: check-ast
10+
- id: check-json
11+
- id: check-merge-conflict
12+
- id: detect-private-key
13+
14+
- repo: https://github.com/astral-sh/ruff-pre-commit
15+
rev: v0.9.1
16+
hooks:
17+
- id: ruff
18+
args: [--fix]
19+
- id: ruff-format

.style.yapf

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

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@jbohnslav

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
include README.md
22
include deepethogram/gui/icons/*.png
3-
recursive-include deepethogram/conf *
3+
recursive-include deepethogram/conf *

0 commit comments

Comments
 (0)