Skip to content

Commit be41796

Browse files
Initial commit, baseline spectrogram extraction implementation
0 parents  commit be41796

Some content is hidden

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

62 files changed

+4518
-0
lines changed

.codecov.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
codecov:
2+
require_ci_to_pass: yes
3+
4+
ignore:
5+
- "app.py"
6+
- "batbot/batbot.py"
7+
8+
coverage:
9+
status:
10+
project:
11+
default:
12+
threshold: 1%
13+
patch:
14+
default:
15+
target: 50%
16+
range: "50...90"
17+
round: down
18+
precision: 1
19+
20+
parsers:
21+
gcov:
22+
branch_detection:
23+
conditional: yes
24+
loop: yes
25+
method: no
26+
macro: no
27+
28+
comment:
29+
layout: "reach,diff,flags,files,footer"
30+
behavior: default
31+
require_changes: no

.dockerignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
docs/
2+
tests/
3+
4+
.DS_Store
5+
6+
*.egg-info/
7+
8+
.coverage
9+
coverage/
10+
11+
gradio_cached_examples/
12+
__pycache__/
13+
docs/build/

.flake8

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[flake8]
2+
max-line-length = 88
3+
extend-ignore = E203,E501

.gitattributes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
examples/example3.wav filter=lfs diff=lfs merge=lfs -text
2+
examples/example4.wav filter=lfs diff=lfs merge=lfs -text
3+
examples/example1.wav filter=lfs diff=lfs merge=lfs -text
4+
examples/example2.wav filter=lfs diff=lfs merge=lfs -text
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
schedule:
9+
- cron: '0 0 * * 1'
10+
11+
jobs:
12+
analyze:
13+
name: Analyze
14+
runs-on: ubuntu-latest
15+
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
language: [ 'python' ]
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v2
23+
24+
# Initializes the CodeQL tools for scanning.
25+
- name: Initialize CodeQL
26+
uses: github/codeql-action/init@v1
27+
with:
28+
languages: ${{ matrix.language }}
29+
30+
- name: Autobuild
31+
uses: github/codeql-action/autobuild@v1
32+
33+
- name: Perform CodeQL Analysis
34+
uses: github/codeql-action/analyze@v1
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Docker
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
10+
tags:
11+
- v*
12+
schedule:
13+
- cron: '0 16 * * *' # Every day at 16:00 UTC (~09:00 PT)
14+
15+
jobs:
16+
# Push container image to GitHub Packages and Docker Hub.
17+
# See also https://docs.docker.com/docker-hub/builds/
18+
deploy:
19+
name: Docker image build
20+
runs-on: ubuntu-latest
21+
22+
env:
23+
DOCKER_BUILDKIT: 1
24+
DOCKER_CLI_EXPERIMENTAL: enabled
25+
26+
steps:
27+
- name: Checkout code
28+
uses: nschloe/[email protected]
29+
with:
30+
exclude: "batbot/*/models/pytorch/"
31+
32+
- uses: docker/setup-qemu-action@v1
33+
name: Set up QEMU
34+
id: qemu
35+
with:
36+
image: tonistiigi/binfmt:latest
37+
platforms: all
38+
39+
- uses: docker/setup-buildx-action@v1
40+
name: Set up Docker Buildx
41+
id: buildx
42+
43+
- name: Available platforms
44+
run: echo ${{ steps.buildx.outputs.platforms }}
45+
46+
# Log into container registries
47+
- name: Login to DockerHub
48+
uses: docker/login-action@v1
49+
with:
50+
username: batbot
51+
password: ${{ secrets.BATBOT_DOCKER_HUB_TOKEN }}
52+
53+
# Push tagged image (version tag + latest) to registries
54+
- name: Tagged Docker Hub
55+
if: ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') }}
56+
run: |
57+
VERSION=$(echo ${GITHUB_REF} | sed 's#.*/v##')
58+
echo "IMAGE_TAG=${VERSION}" >> $GITHUB_ENV
59+
60+
# Push bleeding-edge image (main tag) to registries
61+
- name: Bleeding Edge Docker Hub
62+
if: github.ref == 'refs/heads/main'
63+
run: |
64+
echo "IMAGE_TAG=main" >> $GITHUB_ENV
65+
66+
# Push nightly image (nightly tag) to registries
67+
- name: Nightly Docker Hub
68+
if: github.event_name == 'schedule'
69+
run: |
70+
echo "IMAGE_TAG=nightly" >> $GITHUB_ENV
71+
72+
# Build images
73+
- name: Build Batbot
74+
run: |
75+
docker buildx build \
76+
-t kitware/batbot:${{ env.IMAGE_TAG }} \
77+
--platform linux/amd64 \
78+
--push \
79+
.
80+
81+
# Also push latest image
82+
- name: Build Batbot
83+
if: ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') }}
84+
run: |
85+
docker buildx build \
86+
-t kitware/batbot:latest \
87+
--platform linux/amd64 \
88+
--push \
89+
.
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: Wheel
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
10+
build_wheels:
11+
name: Build on ${{ matrix.os }}
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
os: [ubuntu-latest, macos-latest]
17+
python-version: [3.8]
18+
19+
steps:
20+
- name: Checkout code
21+
uses: nschloe/[email protected]
22+
with:
23+
exclude: "batbot/*/models/pytorch/"
24+
25+
- uses: actions/setup-python@v2
26+
name: Install Python
27+
with:
28+
python-version: ${{ matrix.python-version }}
29+
30+
- name: Build wheel
31+
run: |
32+
pip install --upgrade pip
33+
pip install build
34+
python -m build --wheel --outdir dist/ .
35+
36+
- uses: actions/upload-artifact@v2
37+
with:
38+
path: ./dist/*.whl
39+
40+
build_sdist:
41+
name: Build source distribution
42+
runs-on: ubuntu-latest
43+
steps:
44+
- name: Checkout code
45+
uses: nschloe/[email protected]
46+
with:
47+
exclude: "batbot/*/models/pytorch/"
48+
49+
- uses: actions/setup-python@v2
50+
name: Install Python
51+
with:
52+
python-version: '3.8'
53+
54+
- name: Build sdist
55+
run: |
56+
pip install --upgrade pip
57+
pip install build
58+
python -m build --sdist --outdir dist/ .
59+
60+
- uses: actions/upload-artifact@v2
61+
with:
62+
path: ./dist/*.tar.gz
63+
64+
test_wheel:
65+
needs: [build_wheels, build_sdist]
66+
runs-on: ubuntu-latest
67+
env:
68+
CLASSIFIER_BATCH_SIZE: 16
69+
70+
# test wheel
71+
if: github.event_name == 'push'
72+
steps:
73+
- uses: actions/setup-python@v2
74+
name: Install Python
75+
with:
76+
python-version: '3.8'
77+
78+
- uses: actions/download-artifact@v2
79+
with:
80+
name: artifact
81+
path: dist
82+
83+
- name: Install wheel
84+
run: |
85+
pip install --upgrade pip
86+
pip install wheel
87+
pip install dist/*.whl
88+
89+
- name: Test module
90+
run: |
91+
python -c "import batbot; batbot.fetch(); batbot.example();"
92+
93+
- name: Test CLI
94+
run: |
95+
batbot fetch
96+
batbot example
97+
98+
upload_pypi:
99+
needs: [test_wheel]
100+
runs-on: ubuntu-latest
101+
# upload to PyPI on every tag starting with 'v'
102+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
103+
steps:
104+
- uses: actions/download-artifact@v2
105+
with:
106+
name: artifact
107+
path: dist
108+
109+
- uses: pypa/gh-action-pypi-publish@release/v1
110+
with:
111+
user: __token__
112+
password: ${{ secrets.PYPI_PASSWORD }}
113+
# To test: repository_url: https://test.pypi.org/legacy/

.github/workflows/testing.yaml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# This workflow will install Python dependencies, run tests and lint with a single version of Python
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3+
4+
name: Testing
5+
6+
on: push
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
# Use the same Python version used the Dockerfile
15+
python-version: [3.9]
16+
17+
env:
18+
OS: ubuntu-latest
19+
PYTHON: ${{ matrix.python-version }}
20+
CLASSIFIER_BATCH_SIZE: 16
21+
22+
steps:
23+
# Checkout and env setup
24+
- name: Checkout code
25+
uses: nschloe/[email protected]
26+
with:
27+
exclude: "batbot/*/models/pytorch/"
28+
29+
- name: Set up Python ${{ matrix.python-version }}
30+
uses: actions/setup-python@v2
31+
with:
32+
python-version: ${{ matrix.python-version }}
33+
34+
- name: Install dependencies
35+
run: |
36+
python -m pip install --upgrade pip
37+
pip install -r requirements.txt
38+
pip install -r requirements.optional.txt
39+
40+
- name: Lint with flake8
41+
run: |
42+
# stop the build if there are Python syntax errors or undefined names
43+
flake8 . --count --show-source --statistics
44+
# exit-zero treats all errors as warnings.
45+
flake8 . --count --exit-zero --max-complexity=10 --statistics
46+
47+
- name: Run tests
48+
run: |
49+
set -ex
50+
pytest --cov=./ --cov-append --random-order-seed=1
51+
52+
- name: Run coverage
53+
run: |
54+
coverage xml
55+
56+
- name: Upload coverage to Codecov
57+
uses: codecov/[email protected]
58+
with:
59+
token: ${{ secrets.CODECOV_TOKEN }}
60+
files: ./coverage/coverage.xml
61+
env_vars: OS,PYTHON
62+
fail_ci_if_error: true

.gitignore

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
.DS_Store
2+
output.*.jpg
3+
*.log*
4+
5+
*.egg-info/
6+
7+
.coverage*
8+
coverage/
9+
batbot.debug.*/
10+
11+
gradio_cached_examples/
12+
__pycache__/
13+
docs/build/
14+
15+
docs/_build/
16+
17+
example*.jpg
18+
example*.json

0 commit comments

Comments
 (0)