Skip to content

Commit 67fd51f

Browse files
authored
Merge pull request #1 from Geson-anko/feature/add-type-hints-2
Add type hints to all public methods, functions and classes.
2 parents 1aee0c3 + 43874c3 commit 67fd51f

4 files changed

Lines changed: 328 additions & 75 deletions

File tree

.github/workflows/python-package.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,23 @@ jobs:
5454
run: pip install --editable . --verbose
5555
- name: Run tests
5656
run: python -m pytest
57+
58+
type-check:
59+
runs-on: ubuntu-latest
60+
steps:
61+
- uses: actions/checkout@v4
62+
with:
63+
submodules: true
64+
- uses: actions/setup-python@v5
65+
with:
66+
python-version: "3.9"
67+
- name: Install requirements
68+
run: pip install numpy pytest pyright
69+
- name: "Workaround: Generate _soundfile.py explicitly"
70+
run: |
71+
pip install cffi>=1.0
72+
python soundfile_build.py
73+
- name: Install editable package
74+
run: pip install --editable . --verbose
75+
- name: Run type check
76+
run: python -m pyright soundfile.py

pyrightconfig.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"pythonVersion": "3.9",
3+
"exclude": [
4+
"**/node_modules",
5+
"**/__pycache__",
6+
"**/.venv",
7+
"tests/"
8+
]
9+
}

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def get_tag(self):
9696
zip_safe=zip_safe,
9797
license='BSD 3-Clause License',
9898
setup_requires=["cffi>=1.0"],
99-
install_requires=['cffi>=1.0', 'numpy'],
99+
install_requires=['cffi>=1.0', 'numpy', 'typing-extensions'],
100100
cffi_modules=["soundfile_build.py:ffibuilder"],
101101
extras_require={'numpy': []}, # This option is no longer relevant, but the empty entry must be left in to avoid breaking old build scripts.
102102
platforms='any',

0 commit comments

Comments
 (0)