Skip to content

Commit

Permalink
Merge pull request #111 from spotify/drubinstein/pyproject.toml
Browse files Browse the repository at this point in the history
Move to pyproject.toml and drop python3.7 support
  • Loading branch information
drubinstein authored Feb 7, 2024
2 parents a019e48 + 7dab1ca commit 1c1f862
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 73 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ jobs:
- "3.10"
- "3.9"
- "3.8"
- "3.7"
steps:
- name: Setup python for test ${{ matrix.py }}
uses: actions/setup-python@v3
Expand All @@ -35,6 +34,8 @@ jobs:
- name: Install soundlibs Windows
run: choco install libsndfile
if: matrix.os == 'Windows'
- name: Upgrade pip
run: python -m pip install -U pip
- name: Install tox
run: python -m pip install tox
# We will only check this on the minimum python version
Expand Down
8 changes: 4 additions & 4 deletions basic_pitch/layers/nnaudio.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,15 @@ def create_cqt_kernels(

if (fmax is not None) and (n_bins is None):
n_bins = np.ceil(bins_per_octave * np.log2(fmax / fmin)) # Calculate the number of bins
freqs = fmin * 2.0 ** (np.r_[0:n_bins] / np.float(bins_per_octave))
freqs = fmin * 2.0 ** (np.r_[0:n_bins] / float(bins_per_octave))

elif (fmax is None) and (n_bins is not None):
freqs = fmin * 2.0 ** (np.r_[0:n_bins] / np.float(bins_per_octave))
freqs = fmin * 2.0 ** (np.r_[0:n_bins] / float(bins_per_octave))

else:
warnings.warn("If fmax is given, n_bins will be ignored", SyntaxWarning)
n_bins = np.ceil(bins_per_octave * np.log2(fmax / fmin)) # Calculate the number of bins
freqs = fmin * 2.0 ** (np.r_[0:n_bins] / np.float(bins_per_octave))
freqs = fmin * 2.0 ** (np.r_[0:n_bins] / float(bins_per_octave))

if np.max(freqs) > fs / 2 and topbin_check is True:
raise ValueError(
Expand Down Expand Up @@ -563,7 +563,7 @@ def build(self, input_shape: tf.TensorShape) -> None:
# The freqs returned by create_cqt_kernels cannot be used
# Since that returns only the top octave bins
# We need the information for all freq bin
freqs = self.fmin * 2.0 ** (np.r_[0 : self.n_bins] / np.float(self.bins_per_octave))
freqs = self.fmin * 2.0 ** (np.r_[0 : self.n_bins] / float(self.bins_per_octave))
self.frequencies = freqs

self.lengths = np.ceil(Q * self.sample_rate / freqs)
Expand Down
68 changes: 68 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
[project]
name = "basic-pitch"
version = "0.3.0"
description = "Basic Pitch, a lightweight yet powerful audio-to-MIDI converter with pitch bend detection."
keywords = []
classifiers = [
"Development Status :: 5 - Production/Stable",
"Natural Language :: English",
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Programming Language :: Python",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: Implementation :: CPython",
]
dependencies = [
"librosa>=0.8.0",
"mir_eval>=0.6",
"numpy>=1.18",
"pretty_midi>=0.2.9",
"resampy>=0.2.2",
"scipy>=1.4.1",
"typing_extensions",
"tensorflow>=2.4.1; platform_system != 'Darwin'",
"tensorflow-macos>=2.4.1; platform_system == 'Darwin'",
]

[metadata]
author = "Spotify"
author_email = "[email protected]"
maintainer = "Spotify"
maintainer_email = "[email protected]"
url = "https://github.com/spotify/basic-pitch"
long_description = "Basic Pitch, a lightweight yet powerful audio-to-MIDI converter with pitch bend detection. See https://github.com/spotify/basic-pitch for more details."
license = "Apache 2.0"

[tool.setuptools.packages.find]
where = ["."]
exclude = ["tests"]
namespaces = false

[project.scripts]
basic-pitch = "basic_pitch.predict:main"

[project.optional-dependencies]
test = [
"coverage>=5.0.2",
"pytest>=6.1.1",
"pytest-mock",
]
docs = ["mkdocs>=1.0.4"]
dev = [
"basic_pitch[test,docs]",
"mypy",
"tox",
]

[tool.distutils.bdist_wheel]
universal = true

[build-system]
requires = [
"setuptools",
"wheel",
]
67 changes: 0 additions & 67 deletions setup.cfg

This file was deleted.

6 changes: 5 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
[tox]
envlist = py37,py38,py39,py310,manifest,check-formatting,lint,mypy
envlist = py38,py39,py310,py311,manifest,check-formatting,lint,mypy
skipsdist = True
usedevelop = True
requires =
setuptools>=60
wheel
pip>=24

[testenv]
deps = -e .[dev]
Expand Down

0 comments on commit 1c1f862

Please sign in to comment.