Skip to content

Commit 9b39e5d

Browse files
committed
Migrate to uv - add trusted publishing - add dev requirements
1 parent f598f25 commit 9b39e5d

6 files changed

Lines changed: 815 additions & 66 deletions

File tree

.github/workflows/pythonpackage.yml

Lines changed: 56 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on: [push, pull_request]
44

55
jobs:
66
build:
7-
87
runs-on: ${{ matrix.os }}
98
strategy:
109
fail-fast: false
@@ -13,66 +12,65 @@ jobs:
1312
os: [ubuntu-latest, macos-latest, windows-latest]
1413
python-version: [3.9, "3.10", "3.11", "3.12", "3.13", "3.14"]
1514
steps:
16-
- uses: actions/checkout@v3
17-
- name: Checkout submodules
18-
shell: bash
19-
run: |
20-
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
21-
git submodule sync --recursive
22-
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
23-
- name: Set up Python ${{ matrix.python-version }}
24-
uses: actions/setup-python@v4
15+
- uses: actions/checkout@v5
2516
with:
26-
python-version: ${{ matrix.python-version }}
27-
- name: Install dependencies
28-
run: |
29-
python -m pip install --upgrade pip
30-
pip install -U setuptools setuptools_scm wheel build twine
31-
pip install -r requirements.txt
32-
- name: Build package
33-
run: |
34-
python -m pip install -e .
35-
- name: Test with pytest
36-
run: |
37-
pytest
38-
- name: Test the universal wheels
39-
if: matrix.os == 'ubuntu-latest'
40-
run: |
41-
# do not build binary wheels on linux
42-
python -m build --sdist
43-
twine check dist/*
44-
- name: Test the binary wheels
45-
if: matrix.os != 'ubuntu-latest'
17+
submodules: recursive
18+
# - name: Checkout submodules
19+
# shell: bash
20+
# run: |
21+
# auth_header="$(git config --local --get http.https://github.com/.extraheader)"
22+
# git submodule sync --recursive
23+
# git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
24+
- name: Install uv
25+
uses: astral-sh/setup-uv@v7
26+
- name: Sync dependencies with uv
4627
run: |
47-
python -m build
48-
twine check dist/*
49-
- name: Publish sdist to pypi
50-
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') && matrix.os == 'ubuntu-latest'
51-
env:
52-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
53-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
28+
uv sync --locked --all-groups --python ${{ matrix.python-version }}
29+
- name: Build sdist
30+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.14'
5431
run: |
55-
twine upload --skip-existing dist/*
56-
- name: Publish bdist to pypi
57-
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') && matrix.os != 'ubuntu-latest'
58-
env:
59-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
60-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
32+
uv build --sdist
33+
- name: Upload sdist
34+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.14'
35+
uses: actions/upload-artifact@v5
36+
with:
37+
name: dist-python-samplerate-ledfx
38+
path: dist/*.tar.gz
39+
if-no-files-found: error
40+
- name: Build wheel for ${{ matrix.os }} Python ${{ matrix.python-version }}
6141
run: |
62-
twine upload --skip-existing dist/*
63-
- name: Publish sdist to pypi-test
64-
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/test-') && matrix.os == 'ubuntu-latest'
65-
env:
66-
TWINE_USERNAME: ${{ secrets.PYPITEST_USERNAME }}
67-
TWINE_PASSWORD: ${{ secrets.PYPITEST_PASSWORD }}
68-
TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/
42+
uv build --wheel
43+
- name: Test with pytest
6944
run: |
70-
twine upload --skip-existing dist/*
71-
- name: Publish bdist to pypi-test
72-
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/test-') && matrix.os != 'ubuntu-latest'
73-
env:
74-
TWINE_USERNAME: ${{ secrets.PYPITEST_USERNAME }}
75-
TWINE_PASSWORD: ${{ secrets.PYPITEST_PASSWORD }}
76-
TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/
45+
uv run pytest
46+
47+
- name: Upload wheel
48+
uses: actions/upload-artifact@v5
49+
with:
50+
name: dist-python-samplerate-ledfx-${{ matrix.os }}-py${{ matrix.python-version }}
51+
path: dist/*.whl
52+
if-no-files-found: error
53+
54+
publish:
55+
needs: build
56+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
57+
runs-on: ubuntu-latest
58+
environment:
59+
name: pypi
60+
url: https://pypi.org/p/python-samplerate-ledfx/
61+
permissions:
62+
id-token: write # Required for trusted publishing
63+
steps:
64+
- name: Install uv
65+
uses: astral-sh/setup-uv@v7
66+
- name: Download all artifacts
67+
uses: actions/download-artifact@v5
68+
with:
69+
path: dist
70+
pattern: dist-*
71+
merge-multiple: true
72+
- name: Display structure of downloaded files
73+
run: ls -R dist
74+
- name: Publish to PyPI
7775
run: |
78-
twine upload --skip-existing dist/*
76+
uv publish --trusted-publishing always

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ __pycache__/
77
*.egg-info
88
dist/
99
build/
10+
.venv/
1011

1112
docs/_build
1213

MANIFEST.in

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
include README.rst
22
include LICENSE.rst
3-
include versioneer.py
43
include src/*.cpp
54
include CMakeLists.txt
65
include external/CMakeLists.txt
7-
include requirements.txt
6+
include uv.lock
87
include examples/*.py

pyproject.toml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ requires = ["setuptools>=61", "setuptools_scm[toml]>=6.2", "cmake"]
33
build-backend = "setuptools.build_meta"
44

55
[project]
6-
name="samplerate"
7-
dynamic = ["version", "readme"]
6+
name="samplerate-ledfx"
7+
version = "0.2.3"
8+
dynamic = ["readme"]
89
description="Monolithic python wrapper for libsamplerate based on pybind11 and NumPy"
910
authors=[
1011
{"name" = "Robin Scheibler", "email" ="fakufaku@gmail.com"},
1112
{"name" = "Tino Wagner", "email" ="ich@tinowagner.com"}
1213
]
13-
requires-python = ">=3.7"
14+
requires-python = ">=3.8"
1415
classifiers=[
1516
"Development Status :: 3 - Alpha",
1617
"Environment :: Console",
@@ -23,7 +24,18 @@ classifiers=[
2324
]
2425
keywords=["samplerate", "converter", "signal processing", "audio"]
2526
license = "MIT"
26-
dependencies = ["numpy"]
27+
dependencies = [
28+
"numpy>=1.7.0",
29+
30+
]
31+
32+
[dependency-groups]
33+
dev = [
34+
"pytest",
35+
"pytest-asyncio",
36+
"uvloop>=0.16.0; sys_platform != \"win32\"",
37+
"winloop>=0.3.1; sys_platform == \"win32\" and python_version >= \"3.9\"",
38+
]
2739

2840
[tool.setuptools.dynamic]
2941
readme = {file = ["README.rst"]}

requirements.txt

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

0 commit comments

Comments
 (0)