audbcards 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. audbcards-0.1.0/.github/workflows/doc.yml +53 -0
  2. audbcards-0.1.0/.github/workflows/linter.yml +29 -0
  3. audbcards-0.1.0/.github/workflows/publish.yml +78 -0
  4. audbcards-0.1.0/.github/workflows/test.yml +46 -0
  5. audbcards-0.1.0/.gitignore +11 -0
  6. audbcards-0.1.0/.pre-commit-config.yaml +26 -0
  7. audbcards-0.1.0/CHANGELOG.rst +23 -0
  8. audbcards-0.1.0/CONTRIBUTING.rst +132 -0
  9. audbcards-0.1.0/LICENSE +25 -0
  10. audbcards-0.1.0/PKG-INFO +63 -0
  11. audbcards-0.1.0/README.rst +8 -0
  12. audbcards-0.1.0/audbcards/__init__.py +16 -0
  13. audbcards-0.1.0/audbcards/core/__init__.py +0 -0
  14. audbcards-0.1.0/audbcards/core/datacard.py +401 -0
  15. audbcards-0.1.0/audbcards/core/dataset.py +624 -0
  16. audbcards-0.1.0/audbcards/core/templates/datacard.j2 +5 -0
  17. audbcards-0.1.0/audbcards/core/templates/datacard_description.j2 +9 -0
  18. audbcards-0.1.0/audbcards/core/templates/datacard_example.j2 +10 -0
  19. audbcards-0.1.0/audbcards/core/templates/datacard_header.j2 +31 -0
  20. audbcards-0.1.0/audbcards/core/templates/datacard_schemes.j2 +12 -0
  21. audbcards-0.1.0/audbcards/core/templates/datacard_tables.j2 +13 -0
  22. audbcards-0.1.0/audbcards/core/templates/datasets.j2 +32 -0
  23. audbcards-0.1.0/audbcards/core/utils.py +125 -0
  24. audbcards-0.1.0/audbcards/sphinx/__init__.py +135 -0
  25. audbcards-0.1.0/audbcards.egg-info/PKG-INFO +63 -0
  26. audbcards-0.1.0/audbcards.egg-info/SOURCES.txt +48 -0
  27. audbcards-0.1.0/audbcards.egg-info/dependency_links.txt +1 -0
  28. audbcards-0.1.0/audbcards.egg-info/requires.txt +6 -0
  29. audbcards-0.1.0/audbcards.egg-info/top_level.txt +4 -0
  30. audbcards-0.1.0/docs/api-src/audbcards.rst +11 -0
  31. audbcards-0.1.0/docs/changelog.rst +1 -0
  32. audbcards-0.1.0/docs/conf.py +68 -0
  33. audbcards-0.1.0/docs/contributing.rst +3 -0
  34. audbcards-0.1.0/docs/images/file-duration-distribution.png +0 -0
  35. audbcards-0.1.0/docs/index.rst +33 -0
  36. audbcards-0.1.0/docs/install.rst +42 -0
  37. audbcards-0.1.0/docs/requirements.txt +6 -0
  38. audbcards-0.1.0/docs/sphinx-extension.rst +145 -0
  39. audbcards-0.1.0/pyproject.toml +200 -0
  40. audbcards-0.1.0/requirements.txt +1 -0
  41. audbcards-0.1.0/setup.cfg +4 -0
  42. audbcards-0.1.0/tests/conftest.py +237 -0
  43. audbcards-0.1.0/tests/requirements.txt +2 -0
  44. audbcards-0.1.0/tests/test_data/rendered_templates/bare_db.rst +20 -0
  45. audbcards-0.1.0/tests/test_data/rendered_templates/medium_db.rst +62 -0
  46. audbcards-0.1.0/tests/test_data/rendered_templates/minimal_db.rst +37 -0
  47. audbcards-0.1.0/tests/test_datacard.py +234 -0
  48. audbcards-0.1.0/tests/test_dataset.py +330 -0
  49. audbcards-0.1.0/tests/test_fixtures.py +22 -0
  50. audbcards-0.1.0/tests/test_utils.py +71 -0
@@ -0,0 +1,53 @@
1
+ name: Documentation
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ pull_request:
7
+ branches: [ main ]
8
+
9
+ jobs:
10
+ build:
11
+
12
+ runs-on: ${{ matrix.os }}
13
+ strategy:
14
+ matrix:
15
+ os: [ ubuntu-latest ]
16
+ python-version: [ '3.10' ]
17
+
18
+ steps:
19
+ - uses: actions/checkout@v3
20
+
21
+ - name: Cache .cache/audbcards
22
+ uses: actions/cache@v3
23
+ with:
24
+ path: ~/.cache/audbcards
25
+ key: audbcards-1
26
+
27
+ - name: Cache audb
28
+ uses: actions/cache@v3
29
+ with:
30
+ path: ~/audb
31
+ key: audb-1
32
+
33
+ - name: Set up Python ${{ matrix.python-version }}
34
+ uses: actions/setup-python@v4
35
+ with:
36
+ python-version: ${{ matrix.python-version }}
37
+
38
+ - name: Ubuntu - install libsndfile
39
+ run: |
40
+ sudo apt-get update
41
+ sudo apt-get install --no-install-recommends --yes libsndfile1
42
+
43
+ - name: Install package
44
+ run: |
45
+ python -m pip install --upgrade pip
46
+ pip install -r requirements.txt
47
+
48
+ # DOCS
49
+ - name: Install docs requirements
50
+ run: pip install -r docs/requirements.txt
51
+
52
+ - name: Test building user documentation
53
+ run: python -m sphinx docs/ build/html/ -b html -W
@@ -0,0 +1,29 @@
1
+ name: Linter
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ pull_request:
7
+ branches: [ main ]
8
+
9
+ jobs:
10
+ build:
11
+
12
+ runs-on: ubuntu-latest
13
+
14
+ steps:
15
+ - uses: actions/checkout@v3
16
+
17
+ - name: Set up Python 3.8
18
+ uses: actions/setup-python@v4
19
+ with:
20
+ python-version: '3.8'
21
+
22
+ - name: Install pre-commit hooks
23
+ run: |
24
+ pip install pre-commit
25
+ pre-commit install --install-hooks
26
+
27
+ - name: Code style check via pre-commit
28
+ run: |
29
+ pre-commit run --all-files
@@ -0,0 +1,78 @@
1
+ name: Publish
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
7
+
8
+ jobs:
9
+ deploy:
10
+ runs-on: ubuntu-latest
11
+ environment: release
12
+ permissions:
13
+ contents: write
14
+ id-token: write
15
+ concurrency:
16
+ group: ${{ github.workflow }}-${{ github.ref }}
17
+
18
+ steps:
19
+ - uses: actions/checkout@v3
20
+ with:
21
+ fetch-depth: 2
22
+
23
+ - name: Set up Python
24
+ uses: actions/setup-python@v4
25
+ with:
26
+ python-version: '3.10'
27
+
28
+ - name: Install dependencies
29
+ run: |
30
+ python -m pip install --upgrade pip
31
+ pip install build virtualenv
32
+
33
+ # PyPI package
34
+ - name: Build Python package
35
+ run: python -m build
36
+
37
+ - name: Publish Python package to PyPI
38
+ uses: pypa/gh-action-pypi-publish@release/v1
39
+
40
+ # Documentation
41
+ - name: Install doc dependencies
42
+ run: |
43
+ pip install -r requirements.txt
44
+ pip install -r docs/requirements.txt
45
+
46
+ - name: Build documentation
47
+ run: python -m sphinx docs/ build/html -b html
48
+
49
+ - name: Deploy documentation to Github pages
50
+ uses: peaceiris/actions-gh-pages@v3
51
+ with:
52
+ github_token: ${{ secrets.GITHUB_TOKEN }}
53
+ publish_dir: ./build/html
54
+
55
+ # Github release
56
+ - name: Read CHANGELOG
57
+ id: changelog
58
+ run: |
59
+ # Get bullet points from last CHANGELOG entry
60
+ CHANGELOG=$(git diff -U0 HEAD^ HEAD | grep '^[+][\* ]' | sed 's/\+//')
61
+ echo "Got changelog: $CHANGELOG"
62
+ # Support for multiline, see
63
+ # https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings
64
+ {
65
+ echo 'body<<EOF'
66
+ echo "$CHANGELOG"
67
+ echo EOF
68
+ } >> "$GITHUB_OUTPUT"
69
+
70
+ - name: Create release on Github
71
+ id: create_release
72
+ uses: softprops/action-gh-release@v1
73
+ env:
74
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75
+ with:
76
+ tag_name: ${{ github.ref }}
77
+ name: Release ${{ github.ref_name }}
78
+ body: ${{ steps.changelog.outputs.body }}
@@ -0,0 +1,46 @@
1
+ name: Test
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ pull_request:
7
+ branches: [ main ]
8
+
9
+ jobs:
10
+ build:
11
+
12
+ runs-on: ${{ matrix.os }}
13
+ strategy:
14
+ matrix:
15
+ os: [ ubuntu-latest, macOS-latest, windows-latest ]
16
+ python-version: [ '3.10' ]
17
+ include:
18
+ - os: ubuntu-latest
19
+ python-version: '3.9'
20
+ tasks: tests
21
+
22
+ steps:
23
+ - uses: actions/checkout@v3
24
+
25
+ - name: Set up Python ${{ matrix.python-version }}
26
+ uses: actions/setup-python@v4
27
+ with:
28
+ python-version: ${{ matrix.python-version }}
29
+
30
+ - name: Ubuntu - install libsndfile
31
+ run: |
32
+ sudo apt-get update
33
+ sudo apt-get install --no-install-recommends --yes libsndfile1
34
+ if: matrix.os == 'ubuntu-latest'
35
+
36
+ - name: Install package
37
+ run: |
38
+ python -m pip install --upgrade pip
39
+ pip install -r requirements.txt
40
+
41
+ # TESTS
42
+ - name: Install tests requirements
43
+ run: pip install -r tests/requirements.txt
44
+
45
+ - name: Test with pytest
46
+ run: python -m pytest
@@ -0,0 +1,11 @@
1
+ __pycache__
2
+ *.egg-info/
3
+ .eggs/
4
+ build/
5
+ dist/
6
+ .idea/
7
+ venv/
8
+ .coverage*
9
+ __init__.pyc
10
+ coverage.xml
11
+ docs/api/
@@ -0,0 +1,26 @@
1
+ # Configuration of checks run by pre-commit
2
+ #
3
+ # The tests are executed in the CI pipeline,
4
+ # see CONTRIBUTING.rst for further instructions.
5
+ # You can also run the checks directly at the terminal, e.g.
6
+ #
7
+ # $ pre-commit install
8
+ # $ pre-commit run --all-files
9
+ #
10
+ #
11
+ default_language_version:
12
+ python: python3.10
13
+
14
+ repos:
15
+ - repo: https://github.com/astral-sh/ruff-pre-commit
16
+ rev: v0.1.8
17
+ hooks:
18
+ - id: ruff
19
+ args: [ --fix ]
20
+ - id: ruff-format
21
+ - repo: https://github.com/codespell-project/codespell
22
+ rev: v2.2.4
23
+ hooks:
24
+ - id: codespell
25
+ additional_dependencies:
26
+ - tomli
@@ -0,0 +1,23 @@
1
+ Changelog
2
+ =========
3
+
4
+ All notable changes to this project will be documented in this file.
5
+
6
+ The format is based on `Keep a Changelog`_,
7
+ and this project adheres to `Semantic Versioning`_.
8
+
9
+
10
+ Version 0.1.0 (2024-03-27)
11
+ --------------------------
12
+
13
+ * Added: initial release,
14
+ including the classes
15
+ ``audbcards.Datacard``
16
+ and ``audbcards.Dataset``,
17
+ and the ``audbcards.sphinx`` extension
18
+
19
+
20
+ .. _Keep a Changelog:
21
+ https://keepachangelog.com/en/1.0.0/
22
+ .. _Semantic Versioning:
23
+ https://semver.org/spec/v2.0.0.html
@@ -0,0 +1,132 @@
1
+ Contributing
2
+ ============
3
+
4
+ Everyone is invited to contribute to this project.
5
+ Feel free to create a `pull request`_ .
6
+ If you find errors,
7
+ omissions,
8
+ inconsistencies,
9
+ or other things
10
+ that need improvement,
11
+ please create an issue_.
12
+
13
+ .. _issue: https://github.com/audeering/audbcards/issues/new/
14
+ .. _pull request: https://github.com/audeering/audbcards/compare/
15
+
16
+
17
+ Development Installation
18
+ ------------------------
19
+
20
+ Instead of pip-installing the latest release from PyPI_,
21
+ you should get the newest development version from Github_::
22
+
23
+ git clone https://github.com/audeering/audbcards/
24
+ cd audbcards
25
+ # Create virtual environment for this project
26
+ # e.g.
27
+ # virtualenv --python="python3" $HOME/.envs/audbcards
28
+ # source $HOME/.envs/audbcards/bin/activate
29
+ pip install -r requirements.txt
30
+
31
+
32
+ This way,
33
+ your installation always stays up-to-date,
34
+ even if you pull new changes from the Github repository.
35
+
36
+ .. _PyPI: https://pypi.org/project/audbcards/
37
+ .. _Github: https://github.com/audeering/audbcards/
38
+
39
+
40
+ Coding Convention
41
+ -----------------
42
+
43
+ We follow the PEP8_ convention for Python code
44
+ and use ruff_ as a linter and code formatter.
45
+ In addition,
46
+ we check for common spelling errors with codespell_.
47
+ Both tools and possible exceptions
48
+ are defined in :file:`pyproject.toml`.
49
+
50
+ The checks are executed in the CI using `pre-commit`_.
51
+ You can enable those checks locally by executing::
52
+
53
+ pip install pre-commit # consider system wide installation
54
+ pre-commit install
55
+ pre-commit run --all-files
56
+
57
+ Afterwards ruff_ and codespell_ are executed
58
+ every time you create a commit.
59
+
60
+ You can also install ruff_ and codespell_
61
+ and call it directly::
62
+
63
+ pip install ruff codespell # consider system wide installation
64
+ ruff check --fix . # lint all Python files, and fix any fixable errors
65
+ ruff format . # format code of all Python files
66
+ codespell
67
+
68
+ It can be restricted to specific folders::
69
+
70
+ ruff check audbcards/ tests/
71
+ codespell audbcards/ tests/
72
+
73
+
74
+ .. _codespell: https://github.com/codespell-project/codespell/
75
+ .. _PEP8: http://www.python.org/dev/peps/pep-0008/
76
+ .. _pre-commit: https://pre-commit.com
77
+ .. _ruff: https://beta.ruff.rs
78
+
79
+
80
+ Building the Documentation
81
+ --------------------------
82
+
83
+ If you make changes to the documentation,
84
+ you can re-create the HTML pages using Sphinx_.
85
+ You can install it and a few other necessary packages with::
86
+
87
+ pip install -r docs/requirements.txt
88
+
89
+ To create the HTML pages, use::
90
+
91
+ python -m sphinx docs/ build/sphinx/html -b html
92
+
93
+ To ensure that anonymous access is used
94
+ when communicating with Artifactory,
95
+ you can call instead::
96
+
97
+ ARTIFACTORY_USERNAME=anonymous ARTIFACTORY_API_KEY="" python -m sphinx docs/ build/sphinx/html -b html
98
+
99
+ The generated files will be available
100
+ in the directory :file:`build/sphinx/html/`.
101
+
102
+ It is also possible to automatically check if all links are still valid::
103
+
104
+ python -m sphinx docs/ build/sphinx/html -b linkcheck
105
+
106
+ .. _Sphinx: http://sphinx-doc.org
107
+
108
+
109
+ Running the Tests
110
+ -----------------
111
+
112
+ You'll need pytest_ for that.
113
+ It can be installed with::
114
+
115
+ pip install -r tests/requirements.txt
116
+
117
+ To execute the tests, simply run::
118
+
119
+ python -m pytest
120
+
121
+ .. _pytest: https://pytest.org
122
+
123
+
124
+ Creating a New Release
125
+ ----------------------
126
+
127
+ New releases are made using the following steps:
128
+
129
+ #. Update ``CHANGELOG.rst``
130
+ #. Commit those changes as "Release X.Y.Z"
131
+ #. Create an (annotated) tag with ``git tag -a X.Y.Z``
132
+ #. Push the commit and the tag to Github
@@ -0,0 +1,25 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023- audEERING GmbH and Contributors
4
+
5
+ Authors:
6
+ Hagen Wierstorf
7
+ Christian Geng
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
@@ -0,0 +1,63 @@
1
+ Metadata-Version: 2.1
2
+ Name: audbcards
3
+ Version: 0.1.0
4
+ Summary: Create data cards for audb databases
5
+ Author: BahaEddine Abrougui
6
+ Author-email: Hagen Wierstorf <hwierstorf@audeering.com>, Christian Geng <cgeng@audeering.com>
7
+ License: MIT License
8
+
9
+ Copyright (c) 2023- audEERING GmbH and Contributors
10
+
11
+ Authors:
12
+ Hagen Wierstorf
13
+ Christian Geng
14
+
15
+ Permission is hereby granted, free of charge, to any person obtaining a copy
16
+ of this software and associated documentation files (the "Software"), to deal
17
+ in the Software without restriction, including without limitation the rights
18
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
19
+ copies of the Software, and to permit persons to whom the Software is
20
+ furnished to do so, subject to the following conditions:
21
+
22
+ The above copyright notice and this permission notice shall be included in all
23
+ copies or substantial portions of the Software.
24
+
25
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31
+ SOFTWARE.
32
+
33
+ Project-URL: repository, https://github.com/audeering/audbcards/
34
+ Project-URL: documentation, https://audeering.github.io/audbcards/
35
+ Keywords: audio,data,annotation,mlops,machine learning,documentation
36
+ Classifier: Development Status :: 4 - Beta
37
+ Classifier: Intended Audience :: Science/Research
38
+ Classifier: Intended Audience :: Developers
39
+ Classifier: License :: OSI Approved :: MIT License
40
+ Classifier: Operating System :: OS Independent
41
+ Classifier: Programming Language :: Python
42
+ Classifier: Programming Language :: Python :: 3
43
+ Classifier: Programming Language :: Python :: 3.9
44
+ Classifier: Programming Language :: Python :: 3.10
45
+ Classifier: Topic :: Scientific/Engineering
46
+ Requires-Python: >=3.9
47
+ Description-Content-Type: text/x-rst
48
+ License-File: LICENSE
49
+ Requires-Dist: audb>=1.6.0
50
+ Requires-Dist: audbackend>=1.0.1
51
+ Requires-Dist: audplot>=1.4.6
52
+ Requires-Dist: jinja2
53
+ Requires-Dist: pandas>=2.1.0
54
+ Requires-Dist: toml
55
+
56
+ =========
57
+ audbcards
58
+ =========
59
+
60
+ **audbcards** creates data cards for audio datasets
61
+ handled by audb_.
62
+
63
+ .. _audb: https://audeering.github.io/audb/
@@ -0,0 +1,8 @@
1
+ =========
2
+ audbcards
3
+ =========
4
+
5
+ **audbcards** creates data cards for audio datasets
6
+ handled by audb_.
7
+
8
+ .. _audb: https://audeering.github.io/audb/
@@ -0,0 +1,16 @@
1
+ from audbcards.core.datacard import Datacard
2
+ from audbcards.core.dataset import Dataset
3
+
4
+
5
+ __all__ = []
6
+
7
+
8
+ # Dynamically get the version of the installed module
9
+ try:
10
+ import importlib.metadata
11
+
12
+ __version__ = importlib.metadata.version(__name__)
13
+ except Exception: # pragma: no cover
14
+ importlib = None # pragma: no cover
15
+ finally:
16
+ del importlib
File without changes