From 600c38b3711aa6ea8b9e7c74a07049e4f45ebb10 Mon Sep 17 00:00:00 2001 From: King Phyte Date: Mon, 4 Nov 2024 08:30:25 +0000 Subject: [PATCH] Add support for python 3.13 (#71) --- .github/workflows/ci.yml | 99 +++++++++++++++++----------------- Cargo.lock | 26 ++++----- Cargo.toml | 6 +-- pyproject.toml | 4 +- python/uuid_utils/__init__.pyi | 8 +-- 5 files changed, 69 insertions(+), 74 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 05385e0..f1678b9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,10 +16,10 @@ jobs: name: Check code quality runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: "3.12" - name: Install dependencies run: pip install -r requirements.txt - name: Check code @@ -33,17 +33,17 @@ jobs: strategy: matrix: target: [x86_64, i686] - python-version: ["3.10", "3.11", "3.12"] + python-version: ["3.10", "3.11", "3.12", "3.13"] steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: python-version: "${{ matrix.python-version }}" - name: Build wheels uses: PyO3/maturin-action@v1 with: target: ${{ matrix.target }} - args: --release --out dist -i 3.8 3.9 3.10 3.11 3.12 pypy3.8 pypy3.9 + args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10 sccache: "true" manylinux: auto - name: Install and test @@ -53,9 +53,9 @@ jobs: pip install pytest pytest -v . - name: Upload wheels - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: wheels + name: wheels-linux-${{ strategy.job-index }} path: dist linux-cross: @@ -65,23 +65,23 @@ jobs: matrix: target: [aarch64, armv7, ppc64le] steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: - python-version: "3.11" + python-version: "3.12" - name: Build wheels uses: PyO3/maturin-action@v1 with: rust-toolchain: stable target: ${{ matrix.target }} manylinux: auto - args: --release --out dist -i 3.8 3.9 3.10 3.11 3.12 pypy3.8 pypy3.9 - - uses: uraimo/run-on-arch-action@v2.7.2 + args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10 + - uses: uraimo/run-on-arch-action@v2.8.1 if: matrix.target != 'ppc64' name: Install built wheel with: arch: ${{ matrix.target }} - distro: ubuntu20.04 + distro: ubuntu22.04 githubToken: ${{ github.token }} install: | apt-get update @@ -91,9 +91,9 @@ jobs: pip3 install uuid_utils --no-index --find-links dist/ --force-reinstall pytest -v . - name: Upload wheels - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: wheels + name: wheels-linux-cross-${{ strategy.job-index }} path: dist musllinux: @@ -105,10 +105,10 @@ jobs: - x86_64-unknown-linux-musl - i686-unknown-linux-musl steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: - python-version: "3.11" + python-version: "3.12" architecture: x64 - name: Build wheels uses: PyO3/maturin-action@v1 @@ -116,7 +116,7 @@ jobs: rust-toolchain: stable target: ${{ matrix.target }} manylinux: musllinux_1_2 - args: --release --out dist -i 3.8 3.9 3.10 3.11 3.12 + args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 - name: Install built wheel if: matrix.target == 'x86_64-unknown-linux-musl' uses: addnab/docker-run-action@v3 @@ -129,9 +129,9 @@ jobs: pip3 install uuid_utils --no-index --find-links /io/dist/ --force-reinstall --break-system-packages python3 -c "import uuid_utils" - name: Upload wheels - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: wheels + name: wheels-musllinux-${{ strategy.job-index }} path: dist musllinux-cross: @@ -143,21 +143,21 @@ jobs: - target: aarch64-unknown-linux-musl arch: aarch64 steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: - python-version: "3.11" + python-version: "3.12" - name: Build wheels uses: PyO3/maturin-action@v1 with: rust-toolchain: stable target: ${{ matrix.platform.target }} manylinux: musllinux_1_2 - args: --release --out dist -i 3.8 3.9 3.10 3.11 3.12 + args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 - name: Upload wheels - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: wheels + name: wheels-musllinux-cross-${{ strategy.job-index }} path: dist windows: @@ -167,14 +167,14 @@ jobs: matrix: platform: - target: x64 - interpreter: 3.8 3.9 3.10 3.11 3.12 pypy3.8 pypy3.9 + interpreter: 3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10 - target: x86 - interpreter: 3.8 3.9 3.10 3.11 + interpreter: 3.9 3.10 3.11 3.12 steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: - python-version: "3.11" + python-version: "3.12" architecture: ${{ matrix.platform.target }} - uses: dtolnay/rust-toolchain@stable - name: Build wheels @@ -189,56 +189,56 @@ jobs: pip install pytest pytest -v . - name: Upload wheels - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: wheels + name: wheels-windows-${{ strategy.job-index }} path: dist macos: name: "MacOS" runs-on: macos-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: - python-version: "3.11" + python-version: "3.12" - uses: dtolnay/rust-toolchain@stable - name: Build wheels - x86_64 uses: PyO3/maturin-action@v1 with: target: x86_64 - args: --release --out dist -i 3.8 3.9 3.10 3.11 3.12 pypy3.8 pypy3.9 + args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10 sccache: "true" - name: Build wheels - universal2 uses: PyO3/maturin-action@v1 with: target: universal2-apple-darwin - args: --release --out dist -i 3.8 3.9 3.10 3.11 3.12 pypy3.8 pypy3.9 + args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10 - name: Install and test uuid_utils run: | pip install uuid_utils --no-index --find-links dist --force-reinstall pip install pytest pytest -v . - name: Upload wheels - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: wheels + name: wheels-macos path: dist sdist: name: Source Distribution runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build sdist uses: PyO3/maturin-action@v1 with: command: sdist args: --out dist - name: Upload sdist - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: wheels + name: wheels-sdist path: dist release: @@ -247,9 +247,10 @@ jobs: if: "startsWith(github.ref, 'refs/tags/')" needs: [lint, linux, linux-cross, musllinux, musllinux-cross, windows, macos, sdist] steps: - - uses: actions/download-artifact@v4.1.7 + - uses: actions/download-artifact@v4.1.8 with: - name: wheels + pattern: wheels-* + merge-multiple: true - name: Publish to PyPI uses: PyO3/maturin-action@v1 env: @@ -264,7 +265,7 @@ jobs: if: "startsWith(github.ref, 'refs/tags/')" needs: [release] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build and publish docs run: | pip install -r requirements.txt diff --git a/Cargo.lock b/Cargo.lock index 740ebea..603c7e5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -189,9 +189,9 @@ dependencies = [ [[package]] name = "pyo3" -version = "0.22.2" +version = "0.22.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "831e8e819a138c36e212f3af3fd9eeffed6bf1510a805af35b0edee5ffa59433" +checksum = "3d922163ba1f79c04bc49073ba7b32fd5a8d3b76a87c955921234b8e77333c51" dependencies = [ "cfg-if", "indoc", @@ -207,9 +207,9 @@ dependencies = [ [[package]] name = "pyo3-build-config" -version = "0.22.2" +version = "0.22.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e8730e591b14492a8945cdff32f089250b05f5accecf74aeddf9e8272ce1fa8" +checksum = "bc38c5feeb496c8321091edf3d63e9a6829eab4b863b4a6a65f26f3e9cc6b179" dependencies = [ "once_cell", "python3-dll-a", @@ -218,9 +218,9 @@ dependencies = [ [[package]] name = "pyo3-ffi" -version = "0.22.2" +version = "0.22.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e97e919d2df92eb88ca80a037969f44e5e70356559654962cbb3316d00300c6" +checksum = "94845622d88ae274d2729fcefc850e63d7a3ddff5e3ce11bd88486db9f1d357d" dependencies = [ "libc", "pyo3-build-config", @@ -228,9 +228,9 @@ dependencies = [ [[package]] name = "pyo3-macros" -version = "0.22.2" +version = "0.22.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb57983022ad41f9e683a599f2fd13c3664d7063a3ac5714cae4b7bee7d3f206" +checksum = "e655aad15e09b94ffdb3ce3d217acf652e26bbc37697ef012f5e5e348c716e5e" dependencies = [ "proc-macro2", "pyo3-macros-backend", @@ -240,9 +240,9 @@ dependencies = [ [[package]] name = "pyo3-macros-backend" -version = "0.22.2" +version = "0.22.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec480c0c51ddec81019531705acac51bcdbeae563557c982aa8263bb96880372" +checksum = "ae1e3f09eecd94618f60a455a23def79f79eba4dc561a97324bf9ac8c6df30ce" dependencies = [ "heck", "proc-macro2", @@ -342,9 +342,9 @@ checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce" [[package]] name = "uuid" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" +checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" dependencies = [ "atomic", "getrandom", @@ -355,7 +355,7 @@ dependencies = [ [[package]] name = "uuid-utils" -version = "0.9.0" +version = "0.10.0" dependencies = [ "mac_address", "pyo3", diff --git a/Cargo.toml b/Cargo.toml index b5f7f97..b56e4dc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uuid-utils" -version = "0.9.0" +version = "0.10.0" edition = "2021" [lib] @@ -9,6 +9,6 @@ crate-type = ["cdylib"] [dependencies] mac_address = "1.1.7" -pyo3 = { version = "0.22.2", features = ["extension-module", "generate-import-lib", 'abi3-py38'] } +pyo3 = { version = "0.22.5", features = ["extension-module", "generate-import-lib", 'abi3-py39'] } rand = "0.8.5" -uuid = { version = "1.10.0", features = ["v1", "v3", "v4", "v5", "v6", "v7", "v8", "fast-rng"]} +uuid = { version = "1.11.0", features = ["v1", "v3", "v4", "v5", "v6", "v7", "v8", "fast-rng"]} diff --git a/pyproject.toml b/pyproject.toml index 9a8856f..c6aea54 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,17 +7,17 @@ name = "uuid_utils" description = "Drop-in replacement for Python UUID in Rust" authors = [{ name = "Amin Alaee", email = "me@aminalaee.dev" }] keywords = ["rust", "uuid"] -requires-python = ">=3.8" +requires-python = ">=3.9" classifiers = [ "Development Status :: 3 - Alpha", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Programming Language :: Rust", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", diff --git a/python/uuid_utils/__init__.pyi b/python/uuid_utils/__init__.pyi index 7568cfe..e49fe40 100644 --- a/python/uuid_utils/__init__.pyi +++ b/python/uuid_utils/__init__.pyi @@ -2,7 +2,6 @@ import builtins import sys from enum import Enum -from _typeshed import Unused from typing_extensions import TypeAlias # Because UUID has properties called int and bytes we need to rename these temporarily. @@ -128,12 +127,7 @@ class UUID: def __gt__(self, other: UUID) -> bool: ... def __ge__(self, other: UUID) -> bool: ... -if sys.version_info >= (3, 9): - def getnode() -> int: ... - -else: - def getnode(*, getters: Unused = None) -> int: ... # undocumented - +def getnode() -> int: ... def uuid1(node: int | None = None, clock_seq: int | None = None) -> UUID: """Generate a UUID from a host ID, sequence number, and the current time. If 'node' is not given, getnode() is used to obtain the hardware