Skip to content

Commit

Permalink
Switch project to use pyproject.toml (#92)
Browse files Browse the repository at this point in the history
* Switch project to use pyproject.toml

* Fix spelling error in changelog
  • Loading branch information
hagenw authored Sep 26, 2023
1 parent dfc83d6 commit 3c80f38
Show file tree
Hide file tree
Showing 26 changed files with 378 additions and 193 deletions.
10 changes: 10 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[flake8]
exclude =
.eggs,
build,
extend-ignore =
# math, https://github.com/PyCQA/pycodestyle/issues/513
W503,
per-file-ignores =
# ignore unused imports
__init__.py: F401
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Flake8
name: Linter

on:
push:
Expand Down
16 changes: 13 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,18 @@
# $ pre-commit install
# $ pre-commit run --all-files
#
#
default_language_version:
python: python3.8

repos:
- repo: https://github.com/pycqa/flake8
rev: '5.0.4'
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.276
hooks:
- id: ruff
- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
hooks:
- id: flake8
- id: codespell
additional_dependencies:
- tomli
2 changes: 1 addition & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Version 2.4.0 (2022-01-10)
Version 2.3.0 (2021-12-16)
--------------------------

* Changed: udpate to ``audobject >0.6.1``
* Changed: update to ``audobject >0.6.1``


Version 2.2.0 (2021-07-23)
Expand Down
30 changes: 18 additions & 12 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ you should get the newest development version from Github_::

git clone https://github.com/audeering/opensmile-python/
cd opensmile-python
# Create virutal environment for this project
# Create virtual environment for this project
# e.g.
# virtualenv --python="python3" $HOME/.envs/opensmile-python
# source $HOME/.envs/opensmile-python/bin/activate
Expand All @@ -37,9 +37,11 @@ Coding Convention
-----------------

We follow the PEP8_ convention for Python code
and check for correct syntax with flake8_.
Exceptions are defined under the ``[flake8]`` section
in :file:`setup.cfg`.
and check for correct syntax with ruff_.
In addition,
we check for common spelling errors with codespell_.
Both tools and possible exceptions
are defined in :file:`pyproject.toml`.

The checks are executed in the CI using `pre-commit`_.
You can enable those checks locally by executing::
Expand All @@ -48,22 +50,26 @@ You can enable those checks locally by executing::
pre-commit install
pre-commit run --all-files

Afterwards flake8_ is executed
Afterwards ruff_ and codespell_ are executed
every time you create a commit.

You can also install flake8_
You can also install ruff_ and codespell_
and call it directly::

pip install flake8 # consider system wide installation
flake8
pip install ruff codespell # consider system wide installation
ruff check .
codespell

It can be restricted to specific folders::

flake8 audfoo/ tests/
ruff check opensmile/ tests/
codespell opensmile/ tests/


.. _codespell: https://github.com/codespell-project/codespell/
.. _PEP8: http://www.python.org/dev/peps/pep-0008/
.. _flake8: https://flake8.pycqa.org/en/latest/index.html
.. _pre-commit: https://pre-commit.com
.. _ruff: https://beta.ruff.rs


Building the Documentation
Expand All @@ -86,7 +92,7 @@ It is also possible to automatically check if all links are still valid::

python -m sphinx docs/ build/sphinx/html -b linkcheck

.. _Sphinx: http://sphinx-doc.org/
.. _Sphinx: http://sphinx-doc.org


Running the Tests
Expand All @@ -101,7 +107,7 @@ To execute the tests, simply run::

python -m pytest

.. _pytest: https://pytest.org/
.. _pytest: https://pytest.org


Creating a New Release
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ In return for the above rights, you agree:
captures the intent of the original language.


Commerical license options
Commercial license options
==========================

For commercial and other licensing options, please contact us at audEERING
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,14 @@ Please cite openSMILE in your publications by citing the following paper:
.. |tests| image:: https://github.com/audeering/opensmile-python/workflows/Test/badge.svg
:target: https://github.com/audeering/opensmile-python/actions?query=workflow%3ATest
:alt: Test status
.. |coverage| image:: https://codecov.io/gh/audeering/opensmile-python/branch/master/graph/badge.svg?token=PUA9P2UJW1
.. |coverage| image:: https://codecov.io/gh/audeering/opensmile-python/branch/main/graph/badge.svg?token=PUA9P2UJW1
:target: https://codecov.io/gh/audeering/opensmile-python
:alt: code coverage
.. |docs| image:: https://img.shields.io/pypi/v/opensmile?label=docs
   :target: https://audeering.github.io/opensmile-python/
   :alt: opensmile's documentation
.. |license| image:: https://img.shields.io/badge/license-audEERING-red.svg
   :target: https://github.com/audeering/opensmile-python/blob/master/LICENSE
   :target: https://github.com/audeering/opensmile-python/blob/main/LICENSE
   :alt: opensmile's audEERING license
.. |python-versions| image:: https://img.shields.io/pypi/pyversions/opensmile.svg
:target: https://pypi.org/project/opensmile/
Expand Down
10 changes: 5 additions & 5 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import configparser
from datetime import date
import os
import shutil

import toml

import audeer


config = configparser.ConfigParser()
config.read(os.path.join('..', 'setup.cfg'))
config = toml.load(audeer.path('..', 'pyproject.toml'))


# Project -----------------------------------------------------------------

author = config['metadata']['author']
project = config['project']['name']
author = ', '.join(author['name'] for author in config['project']['authors'])
copyright = f'2020-{date.today().year} audEERING GmbH'
project = config['metadata']['name']
version = audeer.git_repo_version()
title = 'Documentation'

Expand Down
2 changes: 0 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.. documentation master file
.. include:: ../README.rst

.. toctree::
Expand Down
1 change: 1 addition & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ sphinx
sphinx-audeering-theme >=1.2.1
sphinx-autodoc-typehints
sphinx-copybutton
toml
10 changes: 3 additions & 7 deletions opensmile/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
from opensmile.core.config import config
from opensmile.core.define import (
FeatureSet,
FeatureLevel,
)
from opensmile.core.smile import (
Smile,
)
from opensmile.core.define import FeatureLevel
from opensmile.core.define import FeatureSet
from opensmile.core.smile import Smile


__all__ = []
Expand Down
2 changes: 1 addition & 1 deletion opensmile/core/config/compare/ComParE_2016.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
///////// updated version of ComParE 2013 set, numerical fixes //////////////////
///////// //////////////////
///////// (c) 2014-2016 by audEERING, //////////////////
///////// All rights reserverd. See file COPYING for details. //////////////////
///////// All rights reserved. See file COPYING for details. //////////////////
///////////////////////////////////////////////////////////////////////////////////////

[componentInstances:cComponentManager]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
///////// > openSMILE configuration file for ComParE < //////////////////
///////// //////////////////
///////// (c) audEERING GmbH, //////////////////
///////// All rights reserverd. //////////////////
///////// All rights reserved. //////////////////
///////////////////////////////////////////////////////////////////////////////////////

[componentInstances:cComponentManager]
Expand Down
4 changes: 2 additions & 2 deletions opensmile/core/config/shared/standard_data_output.conf.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
///////// > openSMILE configuration file for data output < //////////////////
///////// //////////////////
///////// (c) 2014-2016 audEERING, //////////////////
///////// All rights reserverd. See file COPYING for details //////////////////
///////// All rights reserved. See file COPYING for details //////////////////
///////////////////////////////////////////////////////////////////////////////////////


Expand All @@ -12,7 +12,7 @@
for the batch extraction GUI, and supports LLD and Functionals (summaries)
saving.

It requires the main extrator configuration file to provide the following
It requires the main extractor configuration file to provide the following
data memory levels: lld, lld_de, and func
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
///////// > openSMILE configuration file for data output < //////////////////
///////// //////////////////
///////// (c) 2014-2016 audEERING, //////////////////
///////// All rights reserverd. See file COPYING for details //////////////////
///////// All rights reserved. See file COPYING for details //////////////////
///////////////////////////////////////////////////////////////////////////////////////


Expand All @@ -12,7 +12,7 @@
for the batch extraction GUI, and supports LLD and Functionals (summaries)
saving.
It requires the main extrator configuration file to provide the following
It requires the main extractor configuration file to provide the following
data memory levels: lld and func
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
///////// > openSMILE configuration file for wave input < //////////////////
///////// //////////////////
///////// (c) audEERING GmbH, //////////////////
///////// All rights reserverd. //////////////////
///////// All rights reserved. //////////////////
///////////////////////////////////////////////////////////////////////////////////////

[componentInstances:cComponentManager]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
///////// > openSMILE configuration file for wave input < //////////////////
///////// //////////////////
///////// (c) audEERING GmbH, //////////////////
///////// All rights reserverd. //////////////////
///////// All rights reserved. //////////////////
///////////////////////////////////////////////////////////////////////////////////////

[componentInstances:cComponentManager]
Expand All @@ -12,4 +12,4 @@ instance[extsink].type=cExternalSink

[extsink:cExternalSink]
reader.dmLevel = \cm[sinkLevel{func}:sink level]
blocksize = \cm[blockSize{1}:block size]
blocksize = \cm[blockSize{1}:block size]
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
///////// > openSMILE configuration file for wave input < //////////////////
///////// //////////////////
///////// (c) audEERING GmbH, //////////////////
///////// All rights reserverd. //////////////////
///////// All rights reserved. //////////////////
///////////////////////////////////////////////////////////////////////////////////////

[componentInstances:cComponentManager]
Expand Down
2 changes: 1 addition & 1 deletion opensmile/core/config/shared/standard_wave_input.conf.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
///////// > openSMILE configuration file for wave input < //////////////////
///////// //////////////////
///////// (c) audEERING GmbH, //////////////////
///////// All rights reserverd. //////////////////
///////// All rights reserved. //////////////////
///////////////////////////////////////////////////////////////////////////////////////

[componentInstances:cComponentManager]
Expand Down
4 changes: 2 additions & 2 deletions opensmile/core/define.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


class FeatureSet(enum.Enum):
r""" Enumeration of standard feature sets.
r"""Enumeration of standard feature sets.
The following feature sets are available:
Expand Down Expand Up @@ -63,7 +63,7 @@ def encode_type(self):


class FeatureLevel(enum.Enum):
r""" Enumeration of standard feature levels.
r"""Enumeration of standard feature levels.
* :attr:`LowLevelDescriptors` - low-level descriptors (LLD) calculated
over a sliding window
Expand Down
Loading

0 comments on commit 3c80f38

Please sign in to comment.