Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .coveragerc

This file was deleted.

161 changes: 118 additions & 43 deletions .github/workflows/pya-ci.yaml
Original file line number Diff line number Diff line change
@@ -1,51 +1,126 @@
name: Pya
name: test-and-publish

on:
push:
branches:
- master
- develop
pull_request:
branches:
- master
- develop
# Avoid using all the resources/limits available by checking only
# relevant branches and tags. Other branches can be checked via PRs.
branches: [main]
tags: ['v[0-9]*', '[0-9]+.[0-9]+*'] # Match tags that resemble a version
pull_request: # Run in every PR
workflow_dispatch: # Allow manually triggering the workflow
schedule:
# Run roughly every 15 days at 00:00 UTC
# (useful to check if updates on dependencies break the package)
- cron: '0 0 1,16 * *'

permissions:
contents: read

concurrency:
group: >-
${{ github.workflow }}-${{ github.ref_type }}-
${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

jobs:
unit-test:
runs-on: ${{ matrix.os }}
timeout-minutes: 120
prepare:
runs-on: ubuntu-latest
outputs:
wheel-distribution: ${{ steps.wheel-distribution.outputs.path }}
steps:
- uses: actions/checkout@v5
with: {fetch-depth: 0} # deep clone for hatch-scm
- uses: astral-sh/[email protected]
- name: Run static analysis and format checkers
run: uv run pre-commit run --all-files --show-diff-on-failure
- name: Build package distribution files
run: uv run tox -e clean,build
- name: Record the path of wheel distribution
id: wheel-distribution
run: echo "path=$(ls dist/*.whl)" >> $GITHUB_OUTPUT
- name: Store the distribution files for use in other stages
# `tests` and `publish` will use the same pre-built distributions,
# so we make sure to release the exact same package that was tested
uses: actions/upload-artifact@v4
with:
name: python-distribution-files
path: dist/
retention-days: 1

test:
needs: prepare
strategy:
matrix:
os: ["ubuntu-latest", "macos-latest"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python:
- "3.11"
- "3.12"
- "3.13"
- "3.14"
platform:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v5
- uses: astral-sh/[email protected]
with:
python-version: ${{ matrix.python }}
- name: Install portaudio Ubuntu
if: matrix.platform == 'ubuntu-latest'
shell: bash -l {0}
run: sudo apt-get install portaudio19-dev
- name: Install portaudio MacOS
if: matrix.platform == 'macos-latest'
shell: bash -l {0}
run: brew install portaudio
- name: Retrieve pre-built distribution files
uses: actions/download-artifact@v4
with: {name: python-distribution-files, path: dist/}
- name: Run tests
run: >-
uv run tox --installpkg '${{ needs.prepare.outputs.wheel-distribution }}'
-- -rFEx --durations 10 --color yes # pytest args
- name: Upload partial coverage report
uses: coverallsapp/github-action@master
with:
path-to-lcov: coverage.lcov
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: ${{ matrix.platform }} - py${{ matrix.python }}
parallel: true

finalize:
needs: test
runs-on: ubuntu-latest
steps:
- name: Finalize coverage report
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
- name: debug
run: echo "ref=${{ github.ref }} event=${{ github.event_name }}"



publish:
needs: finalize
if: ${{ (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && contains(github.ref, 'refs/tags/') }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- name: Install portaudio Ubuntu
if: matrix.os == 'ubuntu-latest'
shell: bash -l {0}
run: sudo apt-get install portaudio19-dev
- name: Install portaudio MacOS
if: matrix.os == 'macos-latest'
shell: bash -l {0}
run: brew install portaudio
- uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
activate-environment: test-env
environment-file: ci/test-environment.yml
python-version: ${{ matrix.python-version }}
auto-activate-base: false
- name: Set up depen
shell: bash -l {0}
run: |
conda init bash
conda config --add channels defaults
conda activate test-env
conda install ffmpeg coverage python-coveralls --file=requirements_remote.txt --file=requirements_test.txt
# pyaudio is not yet available on conda
pip install -r requirements.txt
- name: Run tests
shell: bash -l {0}
run: |
conda activate test-env
pytest --cov pya/
- uses: actions/checkout@v5
- uses: astral-sh/[email protected]
- name: Retrieve pre-built distribution files
uses: actions/download-artifact@v4
with: {name: python-distribution-files, path: dist/}
- name: Publish Package
env:
# TODO: Set your PYPI_TOKEN as a secret using GitHub UI
# - https://pypi.org/help/#apitoken
# - https://docs.github.com/en/actions/security-guides/encrypted-secrets
UV_PUBLISH_URL: https://upload.pypi.org/legacy/
UV_PUBLISH_USERNAME: __token__
UV_PUBLISH_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: uv run tox -e publish
37 changes: 37 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
exclude: '^docs/conf.py|^uv\.lock$'

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-added-large-files
exclude: uv.lock
- id: check-ast
- id: check-json
- id: check-merge-conflict
- id: check-xml
- id: check-yaml
- id: end-of-file-fixer
exclude: "uv.lock"
- id: mixed-line-ending
exclude: "uv.lock"
args: ['--fix=auto'] # replace 'auto' with 'lf' to enforce Linux/Mac line endings or 'crlf' for Windows

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.0 # check latest
hooks:
- id: ruff # replaces isort + flake8
args: [--fix] # auto-fix where possible
- id: ruff-format # replaces black

- repo: https://github.com/kynan/nbstripout
rev: 0.8.1
hooks:
- id: nbstripout
args: [--extra-keys=metadata.kernelspec metadata.language_info]


- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.6.0 # check latest
hooks:
- id: uv-lock # updates uv.lock when pyproject.toml changes
8 changes: 7 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 0.6.0
* changed project management and build system to use `uv`. Most of the configuration is now gathered in the `pyproject.toml`.
* added pre-commit hooks and executed a lot of internal "form" refactoring to modern ruff standards (imports, documentation)
* updated the github CI/CD pipelines to execute matrix testing for Ubuntu, MacOS and Windows



## 0.5.2 (Nov 2023)
* #82, `pyaudio` is now optional: If you plan to use `PyAudioBackend`, install `pya` with `pip install pya[pyaudio]`.
* Fix audio device bug
Expand Down Expand Up @@ -86,4 +93,3 @@
## 0.2 (August 2019)

* First official PyPI release

30 changes: 0 additions & 30 deletions MANIFEST.in

This file was deleted.

22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
[![PyPI](https://img.shields.io/pypi/v/pya.svg)](https://pypi.org/project/pya)
[![License](https://img.shields.io/github/license/interactive-sonification/pya.svg)](LICENSE)
[![License](https://img.shields.io/github/license/interactive-sonification/pya.svg)](../LICENSE)

# pya

|Branch|`master`|`develop`|
<!-- - [ ] add CI/CD build status badges back in
- [ ] add test coverage badge -->

|Branch|`main`|`develop`|
|------:|--------:|---------:|
|[CI-Linux/MacOS](https://github.com/interactive-sonification/pya/actions/workflows/pya-ci.yaml) | [![Build Status Master](https://github.com/interactive-sonification/pya/actions/workflows/pya-ci.yaml/badge.svg?branch=master)](https://github.com/interactive-sonification/pya/actions/workflows/pya-ci.yaml?query=branch%3Amaster) | [![Build Status Develop](https://github.com/interactive-sonification/pya/actions/workflows/pya-ci.yaml/badge.svg?branch=develop)](https://github.com/interactive-sonification/pya/actions/workflows/pya-ci.yaml?query=branch%3Adevelop) |
|[CI-Windows](https://ci.appveyor.com/project/aleneum/pya-b7gkx/)| ![Build status AppVeyor](https://ci.appveyor.com/api/projects/status/vn61qeri0uyxeedv/branch/master?svg=true) | ![Build status AppVeyor](https://ci.appveyor.com/api/projects/status/vn61qeri0uyxeedv/branch/develop?svg=true) |
|Changes|[![GitHub commits](https://img.shields.io/github/commits-since/interactive-sonification/pya/v0.5.0/master.svg)](https://github.com/interactive-sonification/pya/compare/v0.5.0...master) | [![GitHub commits](https://img.shields.io/github/commits-since/interactive-sonification/pya/v0.5.0/develop.svg)](https://github.com/interactive-sonification/pya/compare/v0.5.0...develop) |
|Binder|[![Master Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/interactive-sonification/pya/master?filepath=examples%2Fpya-examples.ipynb) | [![Develop Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/interactive-sonification/pya/develop?filepath=examples%2Fpya-examples.ipynb) |

Expand Down Expand Up @@ -40,9 +41,14 @@ At this time pya is more suitable for offline rendering than realtime.

## Authors and Contributors

* [Thomas](https://github.com/thomas-hermann) (author, maintainer)
* [Jiajun](https://github.com/wiccy46) (co-author, maintainer)
* [Alexander](https://github.com/aleneum) (maintainer)
* [Thomas Hermann](https://github.com/thomas-hermann) (author, maintainer)
* [Jiajun Yang](https://github.com/wiccy46) (co-author, maintainer)
* [Alexander Neumann](https://github.com/aleneum) (maintainer)
<!-- TODO add github for Luka and Jannis -->
* [Luka Born]() (Contributor)
* [Jannis Müller]() (Contributor)
* [Fabian Hommel]() (Maintainer)

* Contributors will be acknowledged here, contributions are welcome.

## Installation
Expand Down Expand Up @@ -269,4 +275,4 @@ ch.setLevel(logging.INFO)
formatter = logging.Formatter('%(name)s - %(levelname)s - %(message)s')
ch.setFormatter(formatter)
logger.addHandler(ch)
```
```
30 changes: 0 additions & 30 deletions appveyor.yml

This file was deleted.

Loading
Loading