diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 21ff429..e559cfd 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -7,6 +7,7 @@ on: push: branches: - main + - 'later-version-support-test' tags: - 'v*.*.*' @@ -15,11 +16,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 @@ -41,63 +42,58 @@ jobs: pack-sdist: needs: [ test ] - if: "startsWith(github.ref, 'refs/tags/')" + if: "startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/later-version-support-test'" 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 + - name: Upload sdist uses: actions/upload-artifact@v4 with: - name: wheels-${{ matrix.runs-on }} + name: sdist path: target/wheels pack-linux: needs: [ test ] - if: "startsWith(github.ref, 'refs/tags/')" + if: "startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/later-version-support-test'" 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 with: - name: wheels-${{ matrix.runs-on }} + name: wheels-linux-${{ matrix.target }} path: target/wheels pack-windows: needs: [ test ] - if: "startsWith(github.ref, 'refs/tags/')" + if: "startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/later-version-support-test'" 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 @@ -105,52 +101,47 @@ jobs: 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 with: - name: wheels-${{ matrix.runs-on }} + name: wheels-windows-${{ matrix.target }} path: target/wheels pack-macos: needs: [ test ] - if: "startsWith(github.ref, 'refs/tags/')" + if: "startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/later-version-support-test'" 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 --universal2 - name: Upload wheels uses: actions/upload-artifact@v4 with: - name: wheels-${{ matrix.runs-on }} + name: wheels-macos-universal2 path: target/wheels release: name: Release - if: "startsWith(github.ref, 'refs/tags/')" + if: "startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/later-version-support-test'" 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 - - name: Publish to PyPI - uses: messense/maturin-action@v1 - env: - MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} - with: - command: upload - args: --skip-existing * + - name: Install uv + uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 + - name: Show downloaded artifacts + run: find . -maxdepth 3 -type f | sort 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;