From 823597a4753b0f6a5b420b79f92d2bac91c99bfb Mon Sep 17 00:00:00 2001 From: Michael McAuliffe Date: Tue, 27 Aug 2024 15:45:34 -0700 Subject: [PATCH] Update build scripts --- conch/__init__.py | 5 --- docs/source/conf.py | 2 +- environment.yml | 1 + pyproject.toml | 85 +++++++++++++++++++++++++++++++++++++++++++++ setup.cfg | 74 +++++++++++++++++++++++++++++++++++++-- setup.py | 70 ++----------------------------------- 6 files changed, 160 insertions(+), 77 deletions(-) create mode 100644 pyproject.toml diff --git a/conch/__init__.py b/conch/__init__.py index 0a80bea..49f18a0 100644 --- a/conch/__init__.py +++ b/conch/__init__.py @@ -1,8 +1,3 @@ -__ver_major__ = 0 -__ver_minor__ = 3 -__ver_patch__ = 2 -__ver_tuple__ = (__ver_major__, __ver_minor__, __ver_patch__) -__version__ = "%d.%d.%d" % __ver_tuple__ from .main import analyze_segments, acoustic_similarity_directories, acoustic_similarity_mapping, \ acoustic_similarity_directory, analyze_long_file diff --git a/docs/source/conf.py b/docs/source/conf.py index 2995518..3813088 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -97,7 +97,7 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = 'alabaster' +html_theme = 'pydata-sphinx-theme' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the diff --git a/environment.yml b/environment.yml index 8b9f2cd..a0b9b4c 100644 --- a/environment.yml +++ b/environment.yml @@ -9,6 +9,7 @@ dependencies: - praatio - pytest - reaper + - setuptools_scm - pip: - build - twine diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..df19966 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,85 @@ +[build-system] +requires = [ + "setuptools>=45", "wheel", "setuptools_scm>=6.2" +] +build-backend = "setuptools.build_meta" + +[tool.setuptools_scm] +write_to = "conch/_version.py" + +[tool.black] +line-length = 99 + +[tool.isort] +line_length = 99 +profile = "black" +known_first_party = [ + "conch" +] + +[tool.interrogate] +ignore-init-method = true +ignore-init-module = false +ignore-magic = false +ignore-semiprivate = false +ignore-private = false +ignore-module = false +ignore-property-decorators = false +fail-under = 95 +exclude = [ + "tests", + "build", + "dist", + "setup.py", + "docs" +] +verbose = 100 +omit-covered-files = false +quiet = false +generate-badge = "docs/source/_static" +badge-format = "svg" +whitelist-regex = [] +ignore-regex = [] +color = true + + +[tool.check-manifest] +ignore = [ + ".deepsource.toml", + ".readthedocs.yaml", +] + +[tool.coverage.run] +source = ["conch"] +concurrency = ["multiprocessing"] +branch = true +parallel = true +omit = [ + ".tox/*" +] + + +[tool.coverage.report] +show_missing = true +exclude_lines = [ + "pragma: no cover", + "if __name__ == .__main__.:", + "raise AssertionError", + "raise NotImplementedError", + "pass", + "if sys.platform", + "except ImportError:", + "except KeyboardInterrupt:", + "except Exception as e:", + "except Exception:", + "if call_back", + "if is_set", + "if TYPE_CHECKING:", + "def history_save_handler() -> None:", + "class ExitHooks(object):", + "def main() -> None:", + "if os.path.exists", + "@abstractmethod", + 'if "MFA_ERROR"', +] +fail_under = 50 diff --git a/setup.cfg b/setup.cfg index fe62be2..b046bfc 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,73 @@ [metadata] -description-file = README.md +name = Conch-sounds +description = Analyze acoustic similarity in Python +long_description = file: README.md +long_description_content_type = text/markdown +url = https://github.com/mmcauliffe/Conch-sounds +author = Michael McAuliffe +author_email = michael.e.mcauliffe@gmail.com +maintainer = Michael McAuliffe +maintainer_email = michael.e.mcauliffe@gmail.com +license = MIT +license_file = LICENSE +license_files = LICENSE +classifiers = Development Status :: 3 - Alpha + Programming Language :: Python + Programming Language :: Python :: 3 + Operating System :: OS Independent + Topic :: Scientific/Engineering + Topic :: Text Processing :: Linguistic +keywords = phonetics + acoustics + acoustic similarity -[bdist_wheel] -universal = 1 +[options] +packages = find: +install_requires = + numpy + librosa + pysoundfile + scipy + praatio + pyraat +python_requires = >=3.8 +include_package_data = True + +[options.packages.find] +exclude = tests + +[options.extras_require] +dev = + coverage + coveralls + interrogate + pytest + pytest-mypy + setuptools-scm + tomli + tox + tox-conda +docs = + interrogate + numpydoc + pydata-sphinx-theme + sphinx + sphinx-design +testing = + coverage + coveralls + pytest + +[options.package_data] +conch.analysis.pitch = + *.praat +conch.analysis.formants = + *.praat +conch.analysis.intensity = + *.praat +conch.analysis.mfcc = + *.praat + +[tool:pytest] +testpaths = tests +norecursedirs = data diff --git a/setup.py b/setup.py index e6c1bbd..87d1c20 100644 --- a/setup.py +++ b/setup.py @@ -1,70 +1,4 @@ -import sys -import os +import setuptools_scm # noqa from setuptools import setup -from setuptools.command.test import test as TestCommand -import conch - - -def readme(): - with open('README.md') as f: - return f.read() - - -class PyTest(TestCommand): - def finalize_options(self): - TestCommand.finalize_options(self) - self.test_args = ['--strict', '--verbose', '-x', '--tb=long', 'tests'] - if os.environ.get('TRAVIS', False): - self.test_args.insert(0, '--runslow') - self.test_suite = True - - def run_tests(self): - if __name__ == '__main__': # Fix for multiprocessing infinite recursion on Windows - import pytest - errcode = pytest.main(self.test_args) - sys.exit(errcode) - - -if __name__ == '__main__': - setup(name='conch-sounds', - version=conch.__version__, - description='Analyze acoustic similarity in Python', - classifiers=[ - 'Development Status :: 3 - Alpha', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3', - 'Operating System :: OS Independent', - 'Topic :: Scientific/Engineering', - 'Topic :: Text Processing :: Linguistic', - ], - keywords='phonetics, acoustics similarity', - url='https://github.com/mmcauliffe/Conch', - download_url='https://github.com/mmcauliffe/Conch/tarball/{}'.format( - conch.__version__), - author='Michael McAuliffe', - author_email='michael.e.mcauliffe@gmail.com', - packages=['conch', - 'conch.analysis', - 'conch.analysis.amplitude_envelopes', - 'conch.analysis.formants', - 'conch.analysis.intensity', - 'conch.analysis.mfcc', - 'conch.analysis.pitch', - 'conch.distance'], - package_data={'conch.analysis.pitch': ['*.praat'], - 'conch.analysis.formants': ['*.praat'], - 'conch.analysis.intensity': ['*.praat'], - 'conch.analysis.mfcc': ['*.praat']}, - install_requires=[ - 'numpy', - 'scipy', - 'praatio', - 'librosa', - 'pyraat' - ], - cmdclass={'test': PyTest}, - extras_require={ - 'testing': ['pytest'], - } - ) +setup()