Skip to content

Commit

Permalink
Add first plotting functions (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
hagenw committed Jun 18, 2021
1 parent 2918ef8 commit de8b433
Show file tree
Hide file tree
Showing 23 changed files with 716 additions and 2 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Publish

on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
# PyPI package
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
python -m twine upload dist/*
# Docuemntation
- name: Install doc dependencies
run: |
pip install -r requirements.txt
pip install -r docs/requirements.txt
- name: Build documentation
run: |
python -m sphinx docs/ docs/_build/ -b html
- name: Deploy documentation to Github pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_build

# Github release
- name: Read CHANGELOG
id: changelog
run: |
# Get bullet points from last CHANGELOG entry
CHANGELOG=$(git diff -U0 HEAD^ HEAD | grep '^[+][\* ]' | sed 's/\+//')
# Support for multiline, see
# https://github.com/actions/create-release/pull/11#issuecomment-640071918
CHANGELOG="${CHANGELOG//'%'/'%25'}"
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
echo "Got changelog: $CHANGELOG"
echo "::set-output name=body::$CHANGELOG"
- name: Create release on Github
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: ${{ steps.changelog.outputs.body }}
54 changes: 54 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Test

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-18.04, macOS-latest, windows-latest ]
python-version: [3.6]
include:
- os: ubuntu-latest
python-version: 3.7
- os: ubuntu-latest
python-version: 3.8

steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -V
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r docs/requirements.txt
pip install -r tests/requirements.txt
- name: Test with pytest
run: |
python -m pytest
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
if: matrix.os == 'ubuntu-18.04'

- name: Test building documentation
run: |
python -m sphinx docs/ docs/_build/ -b html -W
# python -m sphinx docs/ build/sphinx/html -b linkcheck
if: matrix.os == 'ubuntu-18.04'
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
__pycache__
*.egg-info/
.eggs/
build/
dist/
.idea/
venv/
.coverage*
__init__.pyc
coverage.xml
19 changes: 19 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Changelog
=========

All notable changes to this project will be documented in this file.

The format is based on `Keep a Changelog`_,
and this project adheres to `Semantic Versioning`_.


Version 0.1.0 (2020-XX-XX)
--------------------------

* Added: initial release


.. _Keep a Changelog:
https://keepachangelog.com/en/1.0.0/
.. _Semantic Versioning:
https://semver.org/spec/v2.0.0.html
101 changes: 101 additions & 0 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
Contributing
============

If you would like to add new functionality fell free to create a `merge
request`_ . If you find errors, omissions, inconsistencies or other things
that need improvement, please create an issue_.
Contributions are always welcome!

.. _issue:
https://gitlab.audeering.com/tools/audplot/issues/new?issue%5BD=
.. _merge request:
https://gitlab.audeering.com/tools/audplot/merge_requests/new

Development Installation
------------------------

Instead of pip-installing the latest release from PyPI, you should get the
newest development version from Gitlab_::

git clone git@srv-app-01.audeering.local:tools/audplot.git
cd audplot
# Use virtual environment
pip install -r requirements.txt

.. _Gitlab: https://gitlab.audeering.com/tools/audplot

This way, your installation always stays up-to-date, even if you pull new
changes from the Gitlab repository.

Building the Documentation
--------------------------

If you make changes to the documentation, you can re-create the HTML pages
using Sphinx_.
You can install it and a few other necessary packages with::

pip install -r requirements.txt
pip install -r docs/requirements.txt

To create the HTML pages, use::

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

The generated files will be available in the directory ``build/sphinx/html/``.

.. Note::

During the default building of the documentation
Jupyter notebooks are not executed to save time.

To execute the notebooks as well, copy and paste
the following into your terminal and press the enter key::

python -m sphinx -W docs/ \
-D nbsphinx_execute='always' \
-d build/sphinx/doctrees \
build/sphinx/html \
-b html

It is also possible to automatically check if all links are still valid::

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

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

Running the Tests
-----------------

You'll need pytest_ for that.
It can be installed with::

pip install -r tests/requirements.txt

To execute the tests, simply run::

python -m pytest

To run the tests on the Gitlab CI server,
contributors have to make sure
they have an existing ``artifactory-tokenizer`` repository
with the content described in the `Artifactory tokenizer example`_.

.. _pytest:
https://pytest.org/
.. _Artifactory tokenizer example:
http://devops.pp.audeering.com/focustalks/2019-focustalk-artifactory-security/#tokenizer-example

Creating a New Release
----------------------

New releases are made using the following steps:

#. Update ``CHANGELOG.rst``
#. Commit those changes as "Release X.Y.Z"
#. Create an (annotated) tag with ``git tag -a vX.Y.Z``
#. Make sure you have an ``artifactory-tokenizer`` with ``deployers`` group
permissions
#. Push the commit and the tag to Gitlab

.. _PyPI: https://artifactory.audeering.com/artifactory/api/pypi/pypi-local/simple/
.. _twine: https://twine.readthedocs.io/
1 change: 0 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ MIT License

Copyright (c) 2018-2021 audEERING GmbH and Contributors

Authors:
Johannes Wagner
Hagen Wierstorf

Expand Down
23 changes: 22 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,25 @@
audplot
=======

Common plotting routines.
|tests| |coverage| |docs| |python-versions| |license|

**audplot** includes plotting functions targeted at machine learning problems
like a confusion matrix.


.. badges images and links:
.. |tests| image:: https://github.com/audeering/audplot/workflows/Test/badge.svg
:target: https://github.com/audeering/audplot/actions?query=workflow%3ATest
:alt: Test status
.. |coverage| image:: https://codecov.io/gh/audeering/audplot/branch/master/graph/badge.svg?token=t5c5Ky64Ch
:target: https://codecov.io/gh/audeering/audplot/
:alt: code coverage
.. |docs| image:: https://img.shields.io/pypi/v/audplot?label=docs
:target: https://audeering.github.io/audplot/
:alt: audplot's documentation
.. |license| image:: https://img.shields.io/badge/license-MIT-green.svg
:target: https://github.com/audeering/audplot/blob/master/LICENSE
:alt: audplot's MIT license
.. |python-versions| image:: https://img.shields.io/pypi/pyversions/audplot.svg
:target: https://pypi.org/project/audplot/
:alt: audplot's supported Python versions
20 changes: 20 additions & 0 deletions audplot/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from audplot.core.api import (
confusion_matrix,
distribution,
scatter,
series,
)


# Disencourage from audfoo import *
__all__ = []


# Dynamically get the version of the installed module
try:
import pkg_resources
__version__ = pkg_resources.get_distribution(__name__).version
except Exception: # pragma: no cover
pkg_resources = None # pragma: no cover
finally:
del pkg_resources
Empty file added audplot/core/__init__.py
Empty file.
Loading

0 comments on commit de8b433

Please sign in to comment.