Skip to content

Commit 208562b

Browse files
authored
Modernize package setup (#152)
Synchronise most of the package setup with what we've got in [beets](https://github.com/beetbox/beets)
2 parents 577f8e2 + 6da1611 commit 208562b

File tree

9 files changed

+547
-60
lines changed

9 files changed

+547
-60
lines changed

.github/workflows/main.yml

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,27 @@ name: Python Tests
22

33
on: [push]
44

5-
jobs:
6-
build:
75

6+
jobs:
7+
test:
8+
name: Run tests
89
runs-on: ubuntu-latest
910
strategy:
1011
matrix:
11-
python: ["3.8", "3.9", "3.10", "3.11"]
12-
12+
python: ["3.9", "3.10", "3.11"]
1313
steps:
14-
- uses: actions/checkout@v2
15-
- name: Setup Python
16-
uses: actions/setup-python@v2
14+
- uses: actions/checkout@v4
15+
- name: Install Python tools
16+
uses: BrandonLWhite/[email protected]
17+
- name: Setup Python with poetry caching
18+
# poetry cache requires poetry to already be installed, weirdly
19+
uses: actions/setup-python@v5
1720
with:
18-
python-version: ${{ matrix.python }}
21+
python-version: ${{ matrix.python-version }}
22+
cache: poetry
1923
- name: Install ffmpeg
2024
run: sudo apt install -y --no-install-recommends ffmpeg
21-
- name: Install tox and any other packages
22-
run: pip install tox
23-
- name: Run tox
24-
# Run tox using the version of Python in `PATH`
25-
run: tox -e py
25+
- name: Test
26+
run: |-
27+
poetry install --extras=test
28+
poe test
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Make a release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version of the new release, just as a number with no prepended "v"'
8+
required: true
9+
10+
env:
11+
PYTHON_VERSION: 3.9
12+
NEW_VERSION: ${{ inputs.version }}
13+
NEW_TAG: v${{ inputs.version }}
14+
15+
jobs:
16+
increment-version:
17+
name: Bump version, commit and create tag
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
- name: Install Python tools
22+
uses: BrandonLWhite/[email protected]
23+
- uses: actions/setup-python@v5
24+
with:
25+
python-version: ${{ env.PYTHON_VERSION }}
26+
cache: poetry
27+
28+
- name: Bump project version
29+
run: poetry version "${{ env.NEW_VERSION }}"
30+
31+
- uses: EndBug/add-and-commit@v9
32+
id: commit_and_tag
33+
name: Commit the changes and create tag
34+
with:
35+
message: "Increment version to ${{ env.NEW_VERSION }}"
36+
tag: "${{ env.NEW_TAG }} --force"
37+
38+
build:
39+
name: Build the distribution package
40+
runs-on: ubuntu-latest
41+
needs: increment-version
42+
steps:
43+
- uses: actions/checkout@v4
44+
with:
45+
ref: ${{ env.NEW_TAG }}
46+
47+
- name: Install Python tools
48+
uses: BrandonLWhite/[email protected]
49+
- uses: actions/setup-python@v5
50+
with:
51+
python-version: ${{ env.PYTHON_VERSION }}
52+
cache: poetry
53+
54+
- name: Build a binary wheel and a source tarball
55+
run: poetry build
56+
57+
- name: Store the package
58+
uses: actions/upload-artifact@v4
59+
with:
60+
name: python-package-distributions
61+
path: dist/
62+
63+
publish-to-pypi:
64+
name: Publish distribution 📦 to PyPI
65+
runs-on: ubuntu-latest
66+
needs: build
67+
environment:
68+
name: pypi
69+
url: https://test.pypi.org/p/audioread
70+
permissions:
71+
id-token: write
72+
steps:
73+
- name: Download all the dists
74+
uses: actions/download-artifact@v4
75+
with:
76+
name: python-package-distributions
77+
path: dist/
78+
- name: Publish distribution 📦 to PyPI
79+
uses: pypa/gh-action-pypi-publish@release/v1
80+
with:
81+
repository-url: https://test.pypi.org/legacy/

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ A second optional parameter to ``audio_open`` specifies which backends to try
5555
``available_backends`` function to get a list backends that are usable on the
5656
current system.
5757

58-
Audioread supports Python 3 (3.8+).
58+
Audioread supports Python 3 (3.9+).
5959

6060
Example
6161
-------

audioread/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
from . import ffdec
1818
from .exceptions import DecodeError, NoBackendError
19-
from .version import version as __version__ # noqa
2019
from .base import AudioFile # noqa
2120

2221

audioread/version.py

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)