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
50 changes: 50 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Publish to PyPI

on:
push:
tags:
- "v*"

jobs:
build:
name: Build distribution
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.x"

- name: Install build
run: pip install build

- name: Build wheel and sdist
run: python -m build

- name: Upload dist artifacts
uses: actions/upload-artifact@v7
with:
name: dist
path: dist/

publish:
name: Publish to PyPI
needs: build
runs-on: ubuntu-latest

environment: pypi
permissions:
id-token: write # required for Trusted Publishing

steps:
- name: Download dist artifacts
uses: actions/download-artifact@v8
with:
name: dist
path: dist/

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
6 changes: 2 additions & 4 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v4
Expand All @@ -35,8 +35,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install -e ".[dev]"
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
Expand All @@ -45,7 +44,6 @@ jobs:
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest, generate coverage report
run: |
pip install pytest pytest-cov
pytest --cov=./ --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
36 changes: 33 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Just intonation classes
[![Actions Status](https://github.com/endolith/just_intonation/workflows/Python%20package/badge.svg)](https://github.com/endolith/just_intonation/actions) [![codecov](https://codecov.io/gh/endolith/just_intonation/branch/master/graph/badge.svg?token=QQDWWPXA22)](https://codecov.io/gh/endolith/just_intonation)
[![Actions Status](https://github.com/endolith/just_intonation/actions/workflows/python-package.yml/badge.svg)](https://github.com/endolith/just_intonation/actions/workflows/python-package.yml) [![codecov](https://codecov.io/gh/endolith/just_intonation/branch/master/graph/badge.svg?token=QQDWWPXA22)](https://codecov.io/gh/endolith/just_intonation)

This module provides pure Python classes for experimenting with [Just intonation](https://en.wikipedia.org/wiki/Just_intonation) (music made from frequency ratio relationships rather than equal divisions of the octave):

Expand Down Expand Up @@ -59,9 +59,39 @@ Pitch(660)

## Installation

One possibility is to install with pip from GitHub:
From PyPI (when published):

pip install git+https://github.com/endolith/just_intonation.git
```bash
pip install just_intonation
```

From the repository root (editable install for development):

```bash
pip install -e .
```

With **tests, coverage, and flake8** (as used in CI):

```bash
pip install -e ".[dev]"
```

From GitHub without cloning:

```bash
pip install "just_intonation @ git+https://github.com/endolith/just_intonation.git"
```

The optional `midi` extra installs dependencies for `midi_play.py` (pygame, numpy):

```bash
pip install "just_intonation[midi] @ git+https://github.com/endolith/just_intonation.git"
```

Dependencies are declared in **`pyproject.toml`** (PEP 621). The project is
built with **[Hatchling](https://hatch.pypa.io/latest/)**. **Python 3.10+** is
required (aligned with current Hatchling and CI).

## Examples

Expand Down
46 changes: 46 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "just_intonation"
version = "0.1"
description = "Classes for Just intonation music theory experiments"
readme = "README.md"
requires-python = ">=3.10"
authors = [{ name = "endolith", email = "endolith@gmail.com" }]
dependencies = []
urls = { Homepage = "https://github.com/endolith/just_intonation" }

[project.optional-dependencies]
test = [
"pytest>=8",
"pytest-cov>=5",
]
dev = [
"pytest>=8",
"pytest-cov>=5",
"flake8>=7",
]
midi = [
"numpy>=2",
"pygame>=2.0",
]

[tool.hatch.build.targets.wheel]
only-include = ["just_intonation.py"]

[tool.hatch.build.targets.sdist]
include = [
"/just_intonation.py",
"/pyproject.toml",
"/README.md",
"/test_just_intonation.py",
"/midi_play.py",
"/.coveragerc",
"/.github/workflows/python-package.yml",
"/.github/workflows/publish.yml",
]

[tool.pytest.ini_options]
addopts = "--doctest-modules --ignore-glob=midi_play.py --cov --cov-report=html --tb=short"
6 changes: 0 additions & 6 deletions pytest.ini

This file was deleted.

3 changes: 0 additions & 3 deletions requirements.txt

This file was deleted.

10 changes: 0 additions & 10 deletions setup.py

This file was deleted.

Loading