Skip to content
Merged
28 changes: 25 additions & 3 deletions .github/workflows/noneeditable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ on:
branches: [ main ]

jobs:
build:

build-ubuntu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
Expand All @@ -40,3 +39,26 @@ jobs:
- name: Test with pytest
run: |
python -m pytest tests/test_cli.py # Cli test are here enough
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade cython
python -m pip install --upgrade setuptools
python -m pip install flake8
# https://github.com/pypa/pip/issues/12030#issuecomment-1546344047
python -m pip install wheel
pip install -r requirements.txt
python -m pip list
python -m pip install '.[test]'
- name: Test with pytest
run: |
python -m pytest tests/test_cli.py # Cli test are here enough
48 changes: 37 additions & 11 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,13 @@ on:
branches: [ main ]

jobs:
build:

test-ubuntu:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Remember to update "classifiers" in setup.py when changing Python version
python-version: [3.8, 3.9, '3.10', '3.11', '3.12']

python-version: [3.9, '3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -34,16 +32,44 @@ jobs:
python -m pip install flake8
# https://github.com/pypa/pip/issues/12030#issuecomment-1546344047
python -m pip install wheel
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install -r requirements.txt
python -m pip install pytest-cov codecov
python -m pip list
python -m pip install -e '.[all]'
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
python -m flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
python -m flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
python -m pytest
test-windows:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
# Remember to update "classifiers" in setup.py when changing Python version
python-version: ['3.12']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install Perl
uses: shogo82148/actions-setup-perl@v1
with:
perl-version: "5.38"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade cython
python -m pip install --upgrade setuptools
python -m pip install flake8
# https://github.com/pypa/pip/issues/12030#issuecomment-1546344047
python -m pip install wheel
pip install -r requirements.txt
python -m pip install pytest-cov codecov
python -m pip list
python -m pip install -e '.[all]'
- name: Test with pytest
run: |
# Ignore doctests on Windows. They are hard to guard w.r.t. file paths
python -m pytest tests
12 changes: 10 additions & 2 deletions meeteval/viz/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def load_per_reco_file(alignment, f):
# Make the save_path relative to the index.html file such that
# the links work when moving the folder
av.data['save_path'] = str(save_name)
av.data['absolute_path'] = save_path.absolute()
av.data['absolute_path'] = str(save_path.absolute())
avs.append(av.data)

dump_overview_table(avs, out / 'index.html')
Expand Down Expand Up @@ -224,7 +224,15 @@ def resolve_system_names(avs):
shutil.copy(av['absolute_path'], f_new)
av['absolute_path'] = f_new

av['save_path'] = os.path.relpath(av['absolute_path'], out.parent)
try:
av['save_path'] = str(os.path.relpath(av['absolute_path'], out.parent))
except ValueError:
# Fails on windows when the files are located on different mount
# points. Use the absolute path then. The relative path is meant for
# scenarios where the folders are copied or moved to another
# location. This breaks with absolute paths!
av['save_path'] = str(av['absolute_path'])
av['absolute_path'] = str(av['absolute_path'])

out = Path(out)
out.parent.mkdir(parents=True, exist_ok=True)
Expand Down
4 changes: 3 additions & 1 deletion meeteval/viz/overview_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,10 @@ def get_average_wer(data):
f',\n{indent}]'
)
html = (Path(__file__).parent / 'overview_table.html').read_text()

import re

# Escape backslashes for windows paths. re.escape escapes too much
html_data = html_data.replace('\\', '\\\\')
html, n = re.subn(f'// DATA START((.|\n)*)// DATA END', f'const data = {html_data};', html)
assert n == 1, (html, n)
return html
Expand Down
4 changes: 3 additions & 1 deletion meeteval/viz/visualize.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ def nested_round(obj):

if isinstance(path, io.IOBase):
simplejson.dump(obj, path, indent=indent,
sort_keys=sort_keys, **kwargs)
sort_keys=sort_keys,
for_json=True,
**kwargs)
elif isinstance(path, (str, Path)):
path = Path(path).expanduser()

Expand Down
34 changes: 21 additions & 13 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,46 +1,55 @@
import sys
from distutils.extension import Extension
import numpy

from setuptools import setup, find_packages

from Cython.Build import cythonize

is_windows = sys.platform.startswith('win')

if is_windows:
cythonize_args = dict(
extra_compile_args=['/std:c++20', '/O2'],
extra_link_args=['/std:c++20'],
)
else:
cythonize_args = dict(
extra_compile_args=['-std=c++11', '-O3'],
extra_link_args=['-std=c++11'],
)

ext_modules = cythonize(
[
Extension(
'meeteval.wer.matching.cy_orc_matching',
['meeteval/wer/matching/cy_orc_matching.pyx'],
extra_compile_args=['-std=c++11'],
extra_link_args=['-std=c++11'],
**cythonize_args,
),
Extension(
'meeteval.wer.matching.cy_mimo_matching',
['meeteval/wer/matching/cy_mimo_matching.pyx'],
extra_compile_args=['-std=c++11'],
extra_link_args=['-std=c++11'],
**cythonize_args,
),
Extension(
'meeteval.wer.matching.cy_levenshtein',
['meeteval/wer/matching/cy_levenshtein.pyx'],
extra_compile_args=['-std=c++11'],
extra_link_args=['-std=c++11'],
**cythonize_args,
),
Extension(
'meeteval.wer.matching.cy_time_constrained_orc_matching',
['meeteval/wer/matching/cy_time_constrained_orc_matching.pyx'],
extra_compile_args=['-std=c++11', '-O3'],
extra_link_args=['-std=c++11'],
**cythonize_args,
),
Extension(
'meeteval.wer.matching.cy_greedy_combination_matching',
['meeteval/wer/matching/cy_greedy_combination_matching.pyx'],
extra_compile_args=['-std=c++11', '-O3'],
extra_link_args=['-std=c++11'],
**cythonize_args,
),
Extension(
'meeteval.wer.matching.cy_time_constrained_mimo_matching',
['meeteval/wer/matching/cy_time_constrained_mimo_matching.pyx'],
extra_compile_args=['-std=c++11'],
extra_link_args=['-std=c++11'],
**cythonize_args,
),
]
)
Expand All @@ -53,7 +62,6 @@
'aiohttp',
'soundfile',
'tqdm', # Used in meeteval.viz.__main__.py
'yattag', # Used in meeteval.viz.__main__.py
'platformdirs', # Used in meeteval.viz.visualize.py
]
extras_require['test'] = [
Expand Down
Loading
Loading