Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
74fecec
migrating package format
bmcfee Jun 17, 2025
259dc09
migrating package format
bmcfee Jun 17, 2025
b8863ce
getting stuff ready
bmcfee Jun 17, 2025
74b785f
fixing parse errors
bmcfee Jun 17, 2025
60dd80c
fixing parse errors
bmcfee Jun 17, 2025
fd80e1e
fixing version errors
bmcfee Jun 17, 2025
dce621f
adding lint workflow
bmcfee Jun 17, 2025
c049d82
small modernizations
bmcfee Jun 17, 2025
e50b219
fixed false alarm in bandit on tests
bmcfee Jun 17, 2025
0a7420a
fiddling the matrix
bmcfee Jun 17, 2025
39d7ffa
black formatting
bmcfee Jun 17, 2025
d60110c
Some inplace velin fixing
bmcfee Jun 17, 2025
244f64b
velinizing
bmcfee Jun 17, 2025
a45a783
velinizing
bmcfee Jun 17, 2025
0b0c683
docstring cleanups
bmcfee Jun 17, 2025
3e20fb1
blacking
bmcfee Jun 17, 2025
4696526
fixing parse error
bmcfee Jun 17, 2025
9eee4bf
Adding coverage back in
bmcfee Jun 17, 2025
9566e6f
fixing the grid
bmcfee Jun 17, 2025
7fa8d31
updating readme
bmcfee Jun 17, 2025
7c2b98b
updating readme badges
bmcfee Jun 17, 2025
8a10a26
adding conda environments
bmcfee Jun 18, 2025
01892e8
copypasta
bmcfee Jun 18, 2025
a459bde
fixing shell business on weird platforms
bmcfee Jun 18, 2025
2216d74
workflowing
bmcfee Jun 18, 2025
9418dcd
workflowing
bmcfee Jun 18, 2025
fd81c4f
coverage in env spec?
bmcfee Jun 18, 2025
a7059a8
forcing coverage filename i guess
bmcfee Jun 18, 2025
9f71372
hackingon pytest config options
bmcfee Jun 18, 2025
abdc56e
fixing temp file construction for windows
bmcfee Jun 18, 2025
9b9a42c
reworking build matrix
bmcfee Jun 18, 2025
6566fe1
reworking build matrix
bmcfee Jun 18, 2025
8e3950c
trying to fix the minimal build
bmcfee Jun 18, 2025
f63dfae
nudging min numpy for python version compatibility
bmcfee Jun 18, 2025
c1b5c51
ignore coverage files
bmcfee Jun 18, 2025
7a3a882
converging on a consistent min env
bmcfee Jun 18, 2025
8a0a00c
min env is a pain
bmcfee Jun 18, 2025
d7278ac
min env is a pain
bmcfee Jun 18, 2025
64cfb26
min env is a pain
bmcfee Jun 18, 2025
c59780d
min env is a pain
bmcfee Jun 18, 2025
a602aca
adding release action
bmcfee Jun 18, 2025
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
4 changes: 4 additions & 0 deletions .codespell_ignore_list
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
punctuations
Bellow
Coo
Patter
4 changes: 0 additions & 4 deletions .coveragerc

This file was deleted.

18 changes: 18 additions & 0 deletions .github/environment-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: test
channels:
- conda-forge
- defaults
dependencies:
- pip
- numpy >=1.20.0
- jsonschema >=4.0.1
- pandas >=1.2.0
- mir_eval >=0.8.2
- matplotlib-base>=3.4.1
- sortedcontainers >=2.1.0
- six
- decorator
- pytest
- coverage
- pytest-cov
- pytest-mpl
21 changes: 21 additions & 0 deletions .github/environment-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: lint
channels:
- conda-forge
- defaults
dependencies:
# required
- pip
- bandit
- codespell
- flake8
- pytest
- pydocstyle

# Dependencies for velin
- numpydoc>=1.1.0
- sphinx>=5.1.0
- pygments
- black

- pip:
- velin
18 changes: 18 additions & 0 deletions .github/environment-minimal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: test
channels:
- conda-forge
- defaults
dependencies:
- pip
- numpy ==1.20.0
- jsonschema ==4.0.1
- pandas ==1.2.0
- mir_eval ==0.8.2
- matplotlib-base ==3.4.1
- sortedcontainers ==2.1.0
- six
- decorator
- pytest
- coverage
- pytest-cov
- pytest-mpl
94 changes: 80 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: JSON Annotated Music Specification for Reproducible MIR Research
name: CI Testing

on:
push:
Expand All @@ -8,25 +8,91 @@ on:
branches:
- master

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: True

jobs:
install:
runs-on: ubuntu-latest
test:
name: "Python ${{ matrix.python-version }} on ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
timeout-minutes: 5
include:
- os: ubuntu-latest
python-version: "3.9"
channel-priority: "strict"
envfile: ".github/environment-ci.yml"

- os: ubuntu-latest
python-version: "3.10"
channel-priority: "strict"
envfile: ".github/environment-ci.yml"

- os: ubuntu-latest
python-version: "3.11"
channel-priority: "strict"
envfile: ".github/environment-ci.yml"

- os: ubuntu-latest
python-version: "3.12"
channel-priority: "strict"
envfile: ".github/environment-ci.yml"

- os: ubuntu-latest
python-version: "3.13"
channel-priority: "strict"
envfile: ".github/environment-ci.yml"

- python-version: "3.13"
os: macos-latest
channel-priority: "strict"
envfile: ".github/environment-ci.yml"

- python-version: "3.13"
os: windows-latest
envfile: ".github/environment-ci.yml"

- os: ubuntu-latest
python-version: "3.9"
envfile: ".github/environment-minimal.yml"
channel-priority: "flexible"
name: "Minimal dependencies"

steps:
- uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- name: Create conda environment
uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python-version }}
auto-activate-base: false
channel-priority: ${{ matrix.channel-priority }}
environment-file: ${{ matrix.envfile }}
# Disabling bz2 to get more recent dependencies.
# NOTE: this breaks cache support, so CI will be slower.
use-only-tar-bz2: False # IMPORTANT: This needs to be set for caching to work properly!
- name: Install jams
run: pip install -e .[display,tests]
- name: Run tests
shell: bash -l {0}
run: python -m pip install --upgrade-strategy=only-if-needed -e .[display,tests]
- name: Log installed packages for debugging
shell: bash -l {0}
run: |
pytest -v --cov-report term-missing --cov jams
python -c "import sys; print(sys.version)"
conda info -a
conda list

- name: Run tests
shell: bash -l {0}
run: pytest

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: true
verbose: true
71 changes: 71 additions & 0 deletions .github/workflows/lint_python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: lint_python
on: [pull_request, push]
jobs:
lint_python:
name: "Lint and code analysis"
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
include:
- os: ubuntu-latest
python-version: "3.11"
channel-priority: "flexible"
envfile: ".github/environment-lint.yml"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Cache conda
uses: actions/cache@v4
env:
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-${{ matrix.python-version }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles( matrix.envfile ) }}
- name: Install conda environmnent
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: false
python-version: ${{ matrix.python-version }}
add-pip-as-python-dependency: true
auto-activate-base: false
activate-environment: lint
# mamba-version: "*"
channel-priority: ${{ matrix.channel-priority }}
environment-file: ${{ matrix.envfile }}
use-only-tar-bz2: false

- name: Conda info
shell: bash -l {0}
run: |
conda info -a
conda list

- name: Spell check package
shell: bash -l {0}
run: codespell --ignore-words .codespell_ignore_list jams

- name: Security check
shell: bash -l {0}
run: bandit --recursive --skip B101,B110 .

- name: Style check package
shell: bash -l {0}
run: python -m flake8 jams

- name: Format check package
shell: bash -l {0}
run: python -m black --check jams

- name: Format check tests
shell: bash -l {0}
run: python -m black --check tests

- name: Docstring check
shell: bash -l {0}
run: python -m velin --check jams

- name: Docstring style check
shell: bash -l {0}
run: python -m pydocstyle jams
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Publish Python 🐍 distributions 📦 to PyPI

on:
release:
types: [created]


jobs:
pypi-publish:
name: Upload release to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/jams
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12

- name: Install pypa/build
run: >-
python -m
pip install
build
--user

- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.

- name: Publish package distributions to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ pip-log.txt

# Unit test / coverage reports
.coverage
coverage.xml
.tox

#Translations
Expand Down
42 changes: 0 additions & 42 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,48 +41,6 @@ review. This will send an email to the committers.
(If any of the above seems like magic to you, then look up the
[Git documentation](http://git-scm.com/documentation) on the web.)

It is recommended to check that your contribution complies with the
following rules before submitting a pull request:

- All public methods should have informative docstrings with sample
usage presented.

You can also check for common programming errors with the following
tools:

- Code with good unittest coverage (at least 80%), check with:

$ pip install nose coverage
$ nosetests --with-coverage --cover-package=jams -w jams/tests/

- No pyflakes warnings, check with:

$ pip install pyflakes
$ pyflakes path/to/module.py

- No PEP8 warnings, check with:

$ pip install pep8
$ pep8 path/to/module.py

- AutoPEP8 can help you fix some of the easy redundant errors:

$ pip install autopep8
$ autopep8 path/to/pep8.py


Documentation
-------------

You can edit the documentation using any text editor and then generate
the HTML output by typing ``make html`` from the docs/ directory.
The resulting HTML files will be placed in _build/html/ and are viewable
in a web browser. See the README file in the doc/ directory for more information.

For building the documentation, you will need
[sphinx](http://sphinx.pocoo.org/),
[matplotlib](http://matplotlib.sourceforge.net/), and [scikit-learn](http://scikit-learn.org/).


Note
----
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ jams
====
[![PyPI](https://img.shields.io/pypi/v/jams.svg)](https://pypi.python.org/pypi/jams)
[![License](https://img.shields.io/pypi/l/jams.svg)](https://github.com/marl/jams/blob/master/LICENSE.md)
[![Build Status](https://travis-ci.org/marl/jams.svg?branch=master)](https://travis-ci.org/marl/jams)
[![Coverage Status](https://coveralls.io/repos/marl/jams/badge.svg?branch=master)](https://coveralls.io/r/marl/jams?branch=master)
[![Tests](https://github.com/marl/jams/actions/workflows/ci.yml/badge.svg)](https://github.com/marl/jams/actions/workflows/ci.yml)
[![codecov](https://codecov.io/gh/marl/jams/graph/badge.svg?token=dRCLnaNTTO)](https://codecov.io/gh/marl/jams)
[![Dependency Status](https://dependencyci.com/github/marl/jams/badge)](https://dependencyci.com/github/marl/jams)

A JSON Annotated Music Specification for Reproducible MIR Research.
Expand All @@ -20,7 +20,7 @@ We provide:
* The ability to store multiple annotations per file
* Schema definitions for a wide range of annotation types (beats, chords, segments, tags, etc.)
* Error detection and validation for annotations
* A translation layer to interface with [mir eval](https://craffel.github.io/mir_eval)
* A translation layer to interface with [mir eval](https://mir-eval.readthedocs.io/latest/)
for evaluating annotations

Why
Expand Down
15 changes: 11 additions & 4 deletions jams/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,21 @@
if sys.version_info < (3, 10):
from pkg_resources import resource_filename

for _ in util.find_with_extension(resource_filename(__name__, schema.NS_SCHEMA_DIR), 'json'):
for _ in util.find_with_extension(
resource_filename(__name__, schema.NS_SCHEMA_DIR), "json"
):
schema.add_namespace(_)

else:
for ns in chain(*map(lambda p: p.rglob('*.json'), resources.files('jams.schemata.namespaces').iterdir())):
for ns in chain(
*map(
lambda p: p.rglob("*.json"),
resources.files("jams.schemata.namespaces").iterdir(),
)
):
schema.add_namespace(ns)

# Populate local namespaces
if 'JAMS_SCHEMA_DIR' in os.environ:
for ns in util.find_with_extension(os.environ['JAMS_SCHEMA_DIR'], 'json'):
if "JAMS_SCHEMA_DIR" in os.environ:
for ns in util.find_with_extension(os.environ["JAMS_SCHEMA_DIR"], "json"):
schema.add_namespace(ns)
Loading
Loading