Skip to content

Commit

Permalink
Merge branch 'main' into async-play.
Browse files Browse the repository at this point in the history
  • Loading branch information
sadrasabouri committed Jul 11, 2023
2 parents 2a3c6b3 + 3d3ec51 commit f30a670
Show file tree
Hide file tree
Showing 17 changed files with 246 additions and 19 deletions.
9 changes: 9 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[run]
branch = True
omit =
*/nava/__main__.py
*/nava/__init__.py
[report]
# Regexes for lines to exclude from consideration
exclude_lines =
pragma: no cover
64 changes: 64 additions & 0 deletions .github/workflows/linux_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Linux

on: [push, pull_request]

env:
TEST_PYTHON_VERSION: 3.9

jobs:
build:

runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
python-version: [3.6, 3.7, 3.8, 3.9, 3.10.0, 3.11.0]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Installation
run: |
sudo python -m pip install --upgrade pip
sudo pip install -r requirements.txt
sudo python setup.py install
- name: First test
run: |
sudo nava
- name: Install ALSA
run: |
sudo apt-get update
sudo apt-get install alsa-utils
sudo apt-get install alsa-tools
sudo apt-get install alsa-firmware-loaders
sudo apt-get install alsa-oss
sudo apt-get install -y software-properties-common
sudo apt-get install linux-modules-extra-$(uname -r)
sudo modprobe snd-dummy
- name: Test requirements Installation
run: |
sudo python others/requirements-splitter.py
sudo pip install --upgrade --upgrade-strategy=only-if-needed -r test-requirements.txt
- name: Test with pytest
run: |
sudo python -m pytest --cov=nava --cov-report=term
- name: Other tests
run: |
sudo python -m vulture nava/ others/ setup.py --min-confidence 65 --exclude=__init__.py --sort-by-size
sudo python -m bandit -r nava -s B404,B603,B605,B607
sudo python -m pydocstyle -v --match-dir=nava
if: matrix.python-version == env.TEST_PYTHON_VERSION
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: false
if: matrix.python-version == env.TEST_PYTHON_VERSION
- name: Version check
run: |
python others/version_check.py
if: matrix.python-version == env.TEST_PYTHON_VERSION
16 changes: 9 additions & 7 deletions .github/workflows/test.yml → .github/workflows/macOS_test.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: CI
name: macOS

on: [push, pull_request]

env:
TEST_PYTHON_VERSION: 3.9
TEST_OS: 'ubuntu-20.04'

jobs:
build:

runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, windows-latest, macOS-latest]
os: [macOS-12, macOS-11]
python-version: [3.6, 3.7, 3.8, 3.9, 3.10.0, 3.11.0]
steps:
- uses: actions/checkout@v2
Expand All @@ -35,14 +34,17 @@ jobs:
run: |
python others/requirements-splitter.py
pip install --upgrade --upgrade-strategy=only-if-needed -r test-requirements.txt
if: matrix.python-version == env.TEST_PYTHON_VERSION
- name: Test with pytest
run: |
python -m pytest --cov=nava --cov-report=term
- name: Other tests
run: |
python -m vulture nava/ others/ setup.py --min-confidence 65 --exclude=__init__.py --sort-by-size
python -m bandit -r nava -s B404,B603,B605,B607
python -m pydocstyle -v --match-dir=nava
if: matrix.python-version == env.TEST_PYTHON_VERSION
- name: Version check
run: |
python others/version_check.py
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: false
if: matrix.python-version == env.TEST_PYTHON_VERSION
18 changes: 18 additions & 0 deletions .github/workflows/publish_conda.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: publish_conda

on:
push:
# Sequence of patterns matched against refs/tags
tags:
- '*' # Push events to matching v*, i.e. v1.0, v20.15.10

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: publish-to-conda
uses: sepandhaghighi/conda-package-publish-action@v1.2
with:
subDir: 'others'
AnacondaToken: ${{ secrets.ANACONDA_TOKEN }}
63 changes: 63 additions & 0 deletions .github/workflows/windows_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Windows

on: [push, pull_request]

env:
TEST_PYTHON_VERSION: 3.9

jobs:
build:

runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-2022, windows-2019]
python-version: [3.6, 3.7, 3.8, 3.9, 3.10.0, 3.11.0]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Installation
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
python setup.py install
- name: First test
run: |
nava
- name: Install Scream
shell: powershell
run: |
Start-Service audio*
Invoke-WebRequest https://github.com/duncanthrax/scream/releases/download/3.6/Scream3.6.zip -OutFile C:\Scream3.6.zip
Extract-7Zip -Path C:\Scream3.6.zip -DestinationPath C:\Scream
$cert = (Get-AuthenticodeSignature C:\Scream\Install\driver\Scream.sys).SignerCertificate
$store = [System.Security.Cryptography.X509Certificates.X509Store]::new("TrustedPublisher", "LocalMachine")
$store.Open("ReadWrite")
$store.Add($cert)
$store.Close()
cd C:\Scream\Install\driver
C:\Scream\Install\helpers\devcon install Scream.inf *Scream
- name: Test requirements Installation
run: |
python others/requirements-splitter.py
pip install --upgrade --upgrade-strategy=only-if-needed -r test-requirements.txt
- name: Test with pytest
run: |
python -m pytest --cov=nava --cov-report=term
- name: Other tests
run: |
python -m vulture nava/ others/ setup.py --min-confidence 65 --exclude=__init__.py --sort-by-size
python -m bandit -r nava -s B404,B603,B605,B607
python -m pydocstyle -v --match-dir=nava
if: matrix.python-version == env.TEST_PYTHON_VERSION
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: false
if: matrix.python-version == env.TEST_PYTHON_VERSION
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [0.2] - 2023-07-10
### Added
- Logo
- Anaconda package
### Changed
- `quote` decorator bug fixed
- `path_check` decorator bug fixed
- Test system modified
- `README.md` modified
## [0.1] - 2023-06-10
### Added
- `README.md`
Expand All @@ -21,5 +25,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- `play` function


[Unreleased]: https://github.com/openscilab/nava/compare/v0.1...dev
[Unreleased]: https://github.com/openscilab/nava/compare/v0.2...dev
[0.2]: https://github.com/openscilab/nava/compare/v0.1...v0.2
[0.1]: https://github.com/openscilab/nava/compare/bd789cc...v0.1
29 changes: 24 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
<a href="https://badge.fury.io/py/nava">
<img src="https://badge.fury.io/py/nava.svg" alt="PyPI version" height="18">
</a>
<a href="https://codecov.io/gh/openscilab/nava">
<img src="https://codecov.io/gh/openscilab/nava/branch/main/graph/badge.svg" alt="Codecov">
</a>
<a href="https://discord.gg/MCbPKCFBs3">
<img src="https://img.shields.io/discord/1064533716615049236.svg" alt="Discord Channel">
</a>
Expand Down Expand Up @@ -59,9 +62,19 @@ Nava is a Python library that allows users to play sound in Python without any d
<td align="center">dev</td>
</tr>
<tr>
<td align="center">CI</td>
<td align="center"><img src="https://github.com/openscilab/nava/workflows/CI/badge.svg?branch=main"></td>
<td align="center"><img src="https://github.com/openscilab/nava/workflows/CI/badge.svg?branch=dev"></td>
<td align="center">Linux CI</td>
<td align="center"><img src="https://github.com/openscilab/nava/workflows/Linux/badge.svg?branch=main"></td>
<td align="center"><img src="https://github.com/openscilab/nava/workflows/Linux/badge.svg?branch=dev"></td>
</tr>
<tr>
<td align="center">Windows CI</td>
<td align="center"><img src="https://github.com/openscilab/nava/workflows/Windows/badge.svg?branch=main"></td>
<td align="center"><img src="https://github.com/openscilab/nava/workflows/Windows/badge.svg?branch=dev"></td>
</tr>
<tr>
<td align="center">macOS CI</td>
<td align="center"><img src="https://github.com/openscilab/nava/workflows/macOS/badge.svg?branch=main"></td>
<td align="center"><img src="https://github.com/openscilab/nava/workflows/macOS/badge.svg?branch=dev"></td>
</tr>
</table>

Expand All @@ -70,12 +83,18 @@ Nava is a Python library that allows users to play sound in Python without any d
### PyPI

- Check [Python Packaging User Guide](https://packaging.python.org/installing/)
- Run `pip install nava==0.1` (Need root access)
- Run `pip install nava==0.2`

### Source code
- Download [Version 0.1](https://github.com/openscilab/nava/archive/v0.1.zip) or [Latest Source](https://github.com/openscilab/nava/archive/dev.zip)
- Download [Version 0.2](https://github.com/openscilab/nava/archive/v0.2.zip) or [Latest Source](https://github.com/openscilab/nava/archive/dev.zip)
- Run `pip install .`

### Conda

- Check [Conda Managing Package](https://conda.io/)
- Update Conda using `conda update conda`
- Run `conda install -c openscilab nava`

## Usage

### Basic
Expand Down
17 changes: 17 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
codecov:
require_ci_to_pass: yes
notify:
after_n_builds: 3
wait_for_ci: yes

coverage:
precision: 2
round: up
range: "70...100"
status:
patch:
default:
enabled: no
project:
default:
threshold: 1%
2 changes: 1 addition & 1 deletion nava/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,5 +174,5 @@ async def play(sound_path, is_async=True):
else:
task = asyncio.create_task(__play_linux(sound_path, is_async))
await task
except Exception:
except Exception: # pragma: no cover
raise NavaBaseError(SOUND_FILE_PLAY_ERROR)
2 changes: 1 addition & 1 deletion nava/params.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""Nava parameters."""

NAVA_VERSION = "0.1"
NAVA_VERSION = "0.2"

OVERVIEW = """
A Python library for playing sound everywhere natively and securely.
Expand Down
2 changes: 1 addition & 1 deletion others/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% set name = "nava" %}
{% set version = "0.1" %}
{% set version = "0.2" %}

package:
name: {{ name|lower }}
Expand Down
Binary file added others/test.wav
Binary file not shown.
2 changes: 1 addition & 1 deletion others/version_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import sys
import codecs
Failed = 0
NAVA_VERSION = "0.1"
NAVA_VERSION = "0.2"


SETUP_ITEMS = [
Expand Down
4 changes: 4 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# content of pytest.ini
[pytest]
addopts = --doctest-modules --ignore=others
doctest_optionflags= NORMALIZE_WHITESPACE IGNORE_EXCEPTION_DETAIL
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ def read_description():
setup(
name='nava',
packages=['nava'],
version='0.1',
version='0.2',
description='A Python library for playing sound everywhere natively and securely. ',
long_description=read_description(),
long_description_content_type='text/markdown',
author='OpenSciLab Development Team',
author_email='info@openscilab.com',
url='https://github.com/openscilab/nava',
download_url='https://github.com/openscilab/nava/tarball/v0.1',
download_url='https://github.com/openscilab/nava/tarball/v0.2',
keywords="sound wav music mp3 player audio",
project_urls={
'Webpage': 'https://openscilab.com/',
Expand Down
12 changes: 12 additions & 0 deletions test/error_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# -*- coding: utf-8 -*-
"""
>>> from nava import play
>>> play("test.wav")
Traceback (most recent call last):
...
nava.errors.NavaBaseError: Given sound file doesn't exist.
>>> play(1)
Traceback (most recent call last):
...
nava.errors.NavaBaseError: Sound file's path should be a string.
"""
14 changes: 14 additions & 0 deletions test/function_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# -*- coding: utf-8 -*-
"""
>>> import os
>>> from nava import play
>>> play(os.path.join("others", "test.wav"))
>>> from nava.functions import nava_help
>>> nava_help()
<BLANKLINE>
A Python library for playing sound everywhere natively and securely.
<BLANKLINE>
<BLANKLINE>
Repo : https://github.com/openscilab/nava
Webpage : https://openscilab.com/
"""

0 comments on commit f30a670

Please sign in to comment.