Skip to content

Commit

Permalink
Merge pull request #243 from CPJKU/develop
Browse files Browse the repository at this point in the history
Release 1.2.2
  • Loading branch information
huispaty authored May 10, 2023
2 parents fc3e42a + 59cbe3a commit 9834601
Show file tree
Hide file tree
Showing 50 changed files with 6,142 additions and 326 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Blacken code

on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Format code with black
run: |
pip install black
black --include="\.py,\.pyi" --exclude="env/*,tests/*" .
- name: Commit changes
uses: EndBug/add-and-commit@v4
with:
author_name: ${{ github.actor }}
author_email: ${{ github.actor }}@users.noreply.github.com
message: "Format code with black"
add: "."
branch: ${{ github.ref }}
- name: Notify errors
if: failure()
uses: dawidd6/action-send-mail@v2
with:
server_address: smtp.gmail.com
server_port: 465
username: ${{ secrets.EMAIL_USERNAME }}
password: ${{ secrets.EMAIL_PASSWORD }}
subject: "Format code with black"
body: "Format code with black failed"
to: ${{ secrets.EMAIL_TO }}
from: ${{ secrets.EMAIL_FROM }}
content_type: text/plain
17 changes: 17 additions & 0 deletions .github/workflows/pypi_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Publish to PyPI.org
on:
release:
types: [published]
jobs:
pypi:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- run: python3 -m pip install --upgrade build && python3 -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
23 changes: 23 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: "Close stale issues and PRs"

on:
schedule:
# Every day at 00:00
- cron: "0 0 * * *"
workflow_dispatch:

jobs:
stale:
runs-on: ubuntu-latest

steps:
- uses: actions/[email protected]
with:
stale-issue-message: 'This issue had no activity for **6 months**. It will be closed in **2 weeks** unless there is some new activity. Is this issue already resolved?'
stale-issue-label: 'stale'
exempt-issue-labels: 'bug,enhancement,good first issue'
stale-pr-message: 'This pull request had no activity for **6 months**. It will be closed in **2 weeks** unless there is some new activity.'
stale-pr-label: 'stale'
days-before-stale: 180
days-before-close: 14
operations-per-run: 200
25 changes: 25 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,31 @@
Release Notes
=============

Version 1.2.2 (Released on 2023-10-05)
--------------------------------------

New features
------------
* slicing performed parts
* roman numeral analysis
* harmony class for part and export
* staff with custom number of lines
* transposition by intervals


Bug fixes
---------
* file naming bug in load_musicxml()
* fixed bug in score part unfolding
* bugfix for fine, ritenuto parsing and unfolding
* bugfix for performance codec


Other changes
-------------
* Improved documentation
* Added contributing file


Version 1.2.1 (Released on 2023-02-09)
--------------------------------------
Expand Down
104 changes: 104 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Contributing

You can help the developers of **Partitura** by contributing, requesting features or reporting error.

## Opening an Issue

To open an issue navigate to the partitura github repository:

[Repository]: https://github.com/CPJKU/partitura/issues "Partitura Issues Link"

#### Click to **New Issue**

![](docs/source/images/issue_page.png)

#### Write your description

![](docs/source/images/writing_issue.png)

#### Choose the appropriate label

![](docs/source/images/issue_choosing_label.png)

##### How to choose your issue label:

- **Question** to ask us a question or **help wanted** if you need a solution to a particular partitura problem.
- **Bug** to report something not working correctly.
- **Enhancement** to request for a feature.

## How to contribute

A step by step guide :

1. To contribute is to open a relevant issue.
2. ***Fork*** the Partitura repo.
3. *Checkout* or *Pull* the latest stable develop branch.
4. *Checkout a new branch* from the develop with the name of your develop idea.
5. When finished coding, open a pull request to the develop branch of partitura.

### Open a relevant issue

Follow section how to open an issue.

### **Fork** the Repo

Fork partitura from
https://github.com/CPJKU/partitura

Once that you have already forked the repo, you can clone it:
```shell
git clone https://github.com/YourUsername/partitura.git
cd partitura
```

### Get latest Develop Branch

```shell
git fetch upstream
git checkout develop
git pull
```

### Create your Branch

```shel
git checkout -b mycrazyidea
```

Do your coding magic!!!

Remember to commit regularly with descriptive messages about your changes.

**!!! IMPORTANT NOTE !!!**

Write Unit tests to check the compatibility and assure the evolution of your features.

*Please follow instruction script found in the Tutorial repository.*

### Opening your Pull Request

##### Go to your forked Partitura repo and Click New Pull Request

Open a Pull request from your new branch into the original `https://github.com/CPJKU/partitura` **develop** branch.

Your pull request should then be visible on:

[Partitura Pull Requests]: https://github.com/CPJKU/partitura/pulls "Partitura Pull Requests"

![](docs/source/images/pull_requests.png)

##### Set the base to develop and the compare to your branch

![](docs/source/images/open_pull_request.png)

##### Then create your Pull Request and add a description.

When you create your PR then the partitura Unitests including the Unit Tests you wrote are ran.

If there is no conflict with the develop branch then you will see this on your screen :

![](docs/source/images/unitest_pass.png)

If indeed the tests pass then a person from the development team of Partitura will review your work and accept your Pull Request.

Your features will then be included to the next release of Partitura or a discussion will kick-start on your pull request thread.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ This will install the latest release of the package and will install all depende

Quickstart
==========
A detailed tutorial with some hands-on MIR applications is available [here](https://cpjku.github.io/partitura_tutorial/index.html).

The following code loads the contents of an example MusicXML file included in
the package:
Expand Down
16 changes: 8 additions & 8 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
# built documents.
#
# The short X.Y version.
version = "1.1.1" # pkg_resources.get_distribution("partitura").version
version = "1.2.2" # pkg_resources.get_distribution("partitura").version
# The full version, including alpha/beta/rc tags.
release = "1.1.1"
release = "1.2.2"

# # The full version, including alpha/beta/rc tags
# release = pkg_resources.get_distribution("partitura").version
Expand Down Expand Up @@ -67,7 +67,7 @@
"sphinx.ext.viewcode",
# 'sphinxcontrib.napoleon',
"sphinx.ext.napoleon",
'nbsphinx',
"nbsphinx",
# 'sphinxcontrib.bibtex', # for bibliographic references
# 'sphinxcontrib.rsvgconverter', # for SVG->PDF conversion in LaTeX output
# 'sphinx_gallery.load_style', # load CSS for gallery (needs SG >= 0.6)
Expand All @@ -78,11 +78,11 @@

# These projects are also used for the sphinx_codeautolink extension:
intersphinx_mapping = {
'IPython': ('https://ipython.readthedocs.io/en/stable/', None),
'matplotlib': ('https://matplotlib.org/', None),
'numpy': ('https://docs.scipy.org/doc/numpy/', None),
'pandas': ('https://pandas.pydata.org/docs/', None),
'python': ('https://docs.python.org/3/', None),
"IPython": ("https://ipython.readthedocs.io/en/stable/", None),
"matplotlib": ("https://matplotlib.org/", None),
"numpy": ("https://docs.scipy.org/doc/numpy/", None),
"pandas": ("https://pandas.pydata.org/docs/", None),
"python": ("https://docs.python.org/3/", None),
}

# see http://stackoverflow.com/q/12206334/562769
Expand Down
Binary file added docs/source/images/issue_choosing_label.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/images/issue_page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/images/open_pull_request.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/images/pull_requests.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/images/unitest_pass.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/images/writing_issue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions partitura/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@

#: An example MusicXML file for didactic purposes
EXAMPLE_MUSICXML = pkg_resources.resource_filename(
"partitura", "assets/score_example.musicxml")
"partitura", "assets/score_example.musicxml"
)

EXAMPLE_MIDI = pkg_resources.resource_filename("partitura", "assets/score_example.mid")
EXAMPLE_MEI = pkg_resources.resource_filename("partitura", "assets/score_example.mei")
Expand All @@ -57,5 +58,5 @@
"load_nakamuracorresp",
"load_parangonada_csv",
"save_parangonada_csv",
"render"
"render",
]
2 changes: 1 addition & 1 deletion partitura/directions.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def unabbreviate(s):
"rubato",
]
DEC_TEMPO_ADJ = [
r"/(ritenuto|ritenente|riten\.?)/",
r"/(ritenuto|(ritenente|riten)\.?)/",
r"/(ritardando|(ritard|rit)\.?)/",
r"/(rallentando|(rallent|rall)\.?)/",
]
Expand Down
1 change: 1 addition & 0 deletions partitura/io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from .importmei import load_mei
from .importkern import load_kern
from .importparangonada import load_parangonada_csv
from .exportparangonada import save_parangonada_csv

from partitura.utils.misc import (
deprecated_alias,
Expand Down
4 changes: 1 addition & 3 deletions partitura/io/exportmatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,7 @@ def matchfile_from_alignment(

beat = int((onset_divs - msd) // dpq)

moffset_divs = Fraction(
int(onset_divs - msd - beat * dpq), (dpq * 4)
)
moffset_divs = Fraction(int(onset_divs - msd - beat * dpq), (dpq * 4))

if debug:
duration_beats = offset_beats - onset_beats
Expand Down
8 changes: 4 additions & 4 deletions partitura/io/exportmidi.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def save_performance_midi(
for c in performed_part.controls:
track = c.get("track", 0)
ch = c.get("channel", 1)
t = int(np.round(10 ** 6 * ppq * c["time"] / mpq))
t = int(np.round(10**6 * ppq * c["time"] / mpq))
track_events[track][t].append(
Message(
"control_change",
Expand All @@ -152,8 +152,8 @@ def save_performance_midi(
for n in performed_part.notes:
track = n.get("track", 0)
ch = n.get("channel", 1)
t_on = int(np.round(10 ** 6 * ppq * n["note_on"] / mpq))
t_off = int(np.round(10 ** 6 * ppq * n["note_off"] / mpq))
t_on = int(np.round(10**6 * ppq * n["note_on"] / mpq))
t_off = int(np.round(10**6 * ppq * n["note_off"] / mpq))
vel = n.get("velocity", default_velocity)
track_events[track][t_on].append(
Message("note_on", note=n["midi_pitch"], velocity=vel, channel=ch)
Expand All @@ -165,7 +165,7 @@ def save_performance_midi(
for p in performed_part.programs:
track = p.get("track", 0)
ch = p.get("channel", 1)
t = int(np.round(10 ** 6 * ppq * p["time"] / mpq))
t = int(np.round(10**6 * ppq * p["time"] / mpq))
track_events[track][t].append(
Message("program_change", program=int(p["program"]), channel=ch)
)
Expand Down
Loading

0 comments on commit 9834601

Please sign in to comment.