diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 21ff429..8fe7159 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -15,11 +15,11 @@ jobs: strategy: matrix: runs-on: [ ubuntu-latest, windows-latest, macos-latest ] - python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ] + python-version: [ '3.10', '3.11', '3.12', '3.13', '3.14' ] runs-on: ${{ matrix.runs-on }} steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 + - uses: actions/checkout@v6 + - uses: actions/setup-python@v6 with: python-version: ${{ matrix.python-version }} - uses: dtolnay/rust-toolchain@stable @@ -44,19 +44,16 @@ jobs: if: "startsWith(github.ref, 'refs/tags/')" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: '3.12' + - uses: actions/checkout@v6 - uses: dtolnay/rust-toolchain@stable - name: Build package uses: PyO3/maturin-action@v1 with: command: sdist - - name: Upload wheels - uses: actions/upload-artifact@v4 + - name: Upload sdist + uses: actions/upload-artifact@v7 with: - name: wheels-${{ matrix.runs-on }} + name: sdist path: target/wheels pack-linux: @@ -65,24 +62,23 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ] target: [ x86_64, i686 ] steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 + - uses: actions/checkout@v6 + - uses: actions/setup-python@v6 with: - python-version: ${{ matrix.python-version }} + python-version: '3.10' - uses: dtolnay/rust-toolchain@stable - name: Build package uses: PyO3/maturin-action@v1 with: target: ${{ matrix.target }} manylinux: auto - args: -i ${{ matrix.python-version }} --release + args: -i 3.10 --release - name: Upload wheels - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: - name: wheels-${{ matrix.runs-on }} + name: wheels-linux-${{ matrix.target }} path: target/wheels pack-windows: @@ -91,50 +87,43 @@ jobs: runs-on: windows-latest strategy: matrix: - python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ] target: [ x64, x86 ] steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 + - uses: actions/checkout@v6 + - uses: actions/setup-python@v6 with: - python-version: ${{ matrix.python-version }} + python-version: '3.10' architecture: ${{ matrix.target }} - uses: dtolnay/rust-toolchain@stable - name: Build package uses: PyO3/maturin-action@v1 with: target: ${{ matrix.target }} - manylinux: auto - args: -i ${{ matrix.python-version }} --release + args: -i 3.10 --release - name: Upload wheels - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: - name: wheels-${{ matrix.runs-on }} + name: wheels-windows-${{ matrix.target }} path: target/wheels pack-macos: needs: [ test ] if: "startsWith(github.ref, 'refs/tags/')" runs-on: macos-latest - strategy: - matrix: - python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ] steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 + - uses: actions/checkout@v6 + - uses: actions/setup-python@v6 with: - python-version: ${{ matrix.python-version }} + python-version: '3.10' - uses: dtolnay/rust-toolchain@stable - name: Build package uses: PyO3/maturin-action@v1 with: - target: ${{ matrix.target }} - manylinux: auto - args: -i ${{ matrix.python-version }} --release --universal2 + args: -i 3.10 --release --target universal2-apple-darwin - name: Upload wheels - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: - name: wheels-${{ matrix.runs-on }} + name: wheels-macos-universal2 path: target/wheels release: @@ -142,15 +131,12 @@ jobs: if: "startsWith(github.ref, 'refs/tags/')" needs: [ pack-sdist, pack-linux, pack-windows, pack-macos ] runs-on: ubuntu-latest + permissions: + contents: read + id-token: write steps: - - uses: actions/download-artifact@v4 - with: - pattern: wheels-* - merge-multiple: true + - uses: actions/download-artifact@v8 + - name: Install uv + uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 - name: Publish to PyPI - uses: messense/maturin-action@v1 - env: - MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} - with: - command: upload - args: --skip-existing * + run: uv publish --trusted-publishing always wheels-*/* sdist/* diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2c96eb1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +target/ +Cargo.lock diff --git a/Cargo.toml b/Cargo.toml index 6f51ecf..02adff5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,5 +10,5 @@ crate-type = ["cdylib"] [dependencies] hashbrown = "0.13.2" # MIT or Apache-2.0 ouroboros = "0.15.6" # MIT or Apache-2.0 -pyo3 = { version = "0.18.2", features = ["extension-module"] } # Apache-2.0 +pyo3 = { version = "0.18.2", features = ["extension-module", "abi3-py310"] } # Apache-2.0 vibrato_rust = { package = "vibrato", version = "0.5.0", default-features = false } # MIT or Apache-2.0 diff --git a/README.md b/README.md index dbd1f2a..34f829f 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ Check the version number as shown below to use compatible models: ```python >>> import vibrato >>> vibrato.VIBRATO_VERSION -'0.5.1' +'0.5.2' ``` diff --git a/docs/source/examples.rst b/docs/source/examples.rst index 5cff841..bfceaae 100644 --- a/docs/source/examples.rst +++ b/docs/source/examples.rst @@ -11,7 +11,7 @@ You can check the version number as shown below to use compatible models: >>> import vibrato >>> vibrato.VIBRATO_VERSION - '0.5.1' + '0.5.2' Examples: diff --git a/pyproject.toml b/pyproject.toml index 7bd8908..d167149 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,8 @@ [build-system] -requires = ["maturin>=0.14,<0.15"] +requires = ["maturin>=1,<2"] build-backend = "maturin" [project] name = "vibrato" +dynamic = ["version"] +requires-python = ">=3.10" diff --git a/src/lib.rs b/src/lib.rs index fbfd459..bca4c96 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -91,6 +91,10 @@ struct TokenIterator { #[pymethods] impl TokenIterator { + fn __iter__(self_: PyRef) -> Py { + self_.into() + } + fn __next__(&mut self, py: Python) -> Option { if self.index < self.len { let index = self.index;