Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
frankenjoe committed Dec 2, 2020
1 parent 73cf657 commit 3f7b269
Show file tree
Hide file tree
Showing 52 changed files with 1,146 additions and 2 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
__pycache__
*.egg-info/
.eggs/
build/
dist/
.idea/
venv/
.coverage*
101 changes: 101 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
stages:
- test
- doc
- token
- pypi

.pytest:
before_script:
- apt-get update
- apt-get install -y curl jq pandoc libsndfile1
- python -V
script:
- pip install -r requirements.txt
- pip install -r tests/requirements.txt
- python -m pytest

test-3.6:
extends: .pytest
stage: test
image: docker.audeering.com/python:3.6

test-3.7:
extends: .pytest
stage: test
image: docker.audeering.com/python:3.7

#test-windows-general: https://gitlab.audeering.com/devops/gitlab-runners/-/issues/67
# # Based on Python 3.8 by default
# stage: test
# tags:
# - windows
# script:
# - pip install -r requirements.txt
# - pip install -r tests/requirements.txt
# - python -m pytest

docs:
extends: .pytest
stage: test
image: docker.audeering.com/python:3.6
script:
- pip install -r requirements.txt
- pip install -r docs/requirements.txt
- python -m sphinx -W docs/ build/html -b html
- python -m sphinx -W docs/ build/linkcheck -b linkcheck
artifacts:
paths:
- build/

pages:
stage: doc
image: docker.audeering.com/alpine
variables:
GIT_STRATEGY: none # disable git fetch
script:
- cp -r build/html public
dependencies:
- docs
artifacts:
paths:
- public
only:
refs:
- tags

generate-token:
stage: token
image: docker.audeering.com/alpine
before_script:
- apk --no-cache add git curl bash
script:
- git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@${CI_SERVER_HOST}/${GITLAB_USER_LOGIN}/artifactory-tokenizer.git
- cd artifactory-tokenizer
- bash get_token.sh "deployers" > ../token.json
artifacts:
paths:
- token.json
expire_in: 10 mins
only:
refs:
- tags

pypi:
stage: pypi
image: docker.audeering.com/python:3.6
variables:
TWINE_REPOSITORY_URL: https://artifactory.audeering.com/artifactory/api/pypi/pypi
before_script:
- apt-get update
- apt-get install -y jq
- export TWINE_USERNAME=${GITLAB_USER_LOGIN}
- export TWINE_PASSWORD=$(cat token.json | jq -r '.access_token')
- pip install twine
script:
- python setup.py sdist bdist_wheel
- python -m twine upload --repository local dist/*
dependencies:
- generate-token
only:
refs:
- tags
16 changes: 16 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
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-11-xx)
--------------------------

* Added: Initial release

.. _Keep a Changelog: https://keepachangelog.com/en/1.0.0/
.. _Semantic Versioning: https://semver.org/spec/v2.0.0.html
79 changes: 79 additions & 0 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
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/pyaudresample/issues/new?issue%5BD=
.. _merge request:
https://gitlab.audeering.com/tools/pyaudresample/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/pyaudresample.git
cd pyaudresample
# Use virtual environment
pip install -r requirements.txt

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

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/``.

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

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

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`_ project
#. Push the commit and the tag to Gitlab

.. _artifactory-tokenizer:
https://gitlab.audeering.com/devops/artifactory/tree/master/token
2 changes: 0 additions & 2 deletions README.md

This file was deleted.

13 changes: 13 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
===========
audresample
===========

Python wrapper for `audresamplelib`_
that provides functions to
resample and remix a signal.

.. _audresamplelib:
https://gitlab.audeering.com/tools/audresamplelib

For documentation see:
http://tools.pp.audeering.com/pyaudresample/
20 changes: 20 additions & 0 deletions audresample/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from audresample.core import define
from audresample.core.api import (
am_fm_synth,
remix,
resample,
)
from audresample.core.config import config


__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
Loading

0 comments on commit 3f7b269

Please sign in to comment.