From: Nicolas Patry Date: Mon, 17 Mar 2025 09:26:58 +0000 (+0100) Subject: Making py311 the default. (#589) X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=80d9a1219c2dd36e70e833683fc6f2eb335a8f87;p=safetensors.git Making py311 the default. (#589) * Making py311 the default. * Fixing release script. * No default features everywhere. --- diff --git a/.github/workflows/python-bench.yml b/.github/workflows/python-bench.yml index 7bd81ec..cbfd62d 100644 --- a/.github/workflows/python-bench.yml +++ b/.github/workflows/python-bench.yml @@ -16,8 +16,6 @@ jobs: benchmark: name: Performance regression check runs-on: ubuntu-latest - env: - MATURIN_PEP517_ARGS: "--features py311,pyo3/extension-module" steps: - uses: actions/checkout@v4 - name: Install Rust diff --git a/.github/workflows/python-release.yml b/.github/workflows/python-release.yml index 9399909..58c8efc 100644 --- a/.github/workflows/python-release.yml +++ b/.github/workflows/python-release.yml @@ -46,7 +46,7 @@ jobs: uses: PyO3/maturin-action@v1 with: target: ${{ matrix.platform.target }} - args: --release --out dist --manifest-path bindings/python/Cargo.toml --features pyo3/extension-module,${{ matrix.pyfeature }} + args: --release --out dist --manifest-path bindings/python/Cargo.toml --features pyo3/extension-module,${{ matrix.pyfeature }} --no-default-features sccache: 'true' manylinux: auto - name: Upload wheels @@ -78,7 +78,7 @@ jobs: uses: PyO3/maturin-action@v1 with: target: ${{ matrix.platform.target }} - args: --release --out dist --manifest-path bindings/python/Cargo.toml --features pyo3/extension-module,${{ matrix.pyfeature }} + args: --release --out dist --manifest-path bindings/python/Cargo.toml --features pyo3/extension-module,${{ matrix.pyfeature }} --no-default-features sccache: 'true' manylinux: musllinux_1_2 - name: Upload wheels @@ -107,7 +107,7 @@ jobs: uses: PyO3/maturin-action@v1 with: target: ${{ matrix.platform.target }} - args: --release --out dist --manifest-path bindings/python/Cargo.toml --features pyo3/extension-module,${{ matrix.pyfeature }} + args: --release --out dist --manifest-path bindings/python/Cargo.toml --features pyo3/extension-module,${{ matrix.pyfeature }} --no-default-features sccache: 'true' - name: Upload wheels uses: actions/upload-artifact@v4 @@ -134,7 +134,7 @@ jobs: uses: PyO3/maturin-action@v1 with: target: ${{ matrix.platform.target }} - args: --release --out dist --manifest-path bindings/python/Cargo.toml --features pyo3/extension-module,${{ matrix.pyfeature }} + args: --release --out dist --manifest-path bindings/python/Cargo.toml --features pyo3/extension-module,${{ matrix.pyfeature }} --no-default-features sccache: 'true' - name: Upload wheels uses: actions/upload-artifact@v4 diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 0c5437c..0b9dd32 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -8,7 +8,7 @@ jobs: name: Check everything builds & tests runs-on: ${{ matrix.os }} env: - MATURIN_PEP517_ARGS: "--features ${{ matrix.version.pyfeature }},pyo3/extension-module" + MATURIN_PEP517_ARGS: "--no-default-features --features ${{ matrix.version.pyfeature }},pyo3/extension-module" strategy: matrix: os: [ubuntu-latest, macos-13, windows-latest] @@ -55,7 +55,7 @@ jobs: - name: Lint with Clippy run: | - cargo clippy --features ${{ matrix.version.pyfeature }} -- -D warnings + cargo clippy --features ${{ matrix.version.pyfeature }} --no-default-features -- -D warnings - name: Run Audit run: cargo audit -D warnings @@ -84,7 +84,7 @@ jobs: - name: Run tests run: | - cargo test --features ${{ matrix.version.pyfeature }} + cargo test --features ${{ matrix.version.pyfeature }} --no-default-features pip install .[testing] pytest -sv tests/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a323e52..1a28594 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -27,8 +27,6 @@ repos: [ "--manifest-path", "bindings/python/Cargo.toml", - "--features", - "py311", "--all-targets", "--", "-Dwarnings", diff --git a/bindings/python/Cargo.toml b/bindings/python/Cargo.toml index fe8bbf4..4052b9d 100644 --- a/bindings/python/Cargo.toml +++ b/bindings/python/Cargo.toml @@ -12,6 +12,7 @@ crate-type = ["cdylib"] [features] py38 = ["pyo3/abi3-py38"] py311 = ["pyo3/abi3-py311"] +default = ["py311"] [dependencies] pyo3 = { version = "0.23", features = ["abi3"] } diff --git a/bindings/python/src/lib.rs b/bindings/python/src/lib.rs index b6a0f49..6a654ad 100644 --- a/bindings/python/src/lib.rs +++ b/bindings/python/src/lib.rs @@ -28,11 +28,9 @@ static FLAX_MODULE: GILOnceCell> = GILOnceCell::new(); static MLX_MODULE: GILOnceCell> = GILOnceCell::new(); #[cfg(not(any(feature = "py38", feature = "py311")))] -compile_error!( - "At least one python version must be enabled, use `maturin develop --features py311,pyo3/extension-module`" -); +compile_error!("At least one python version must be enabled, use `maturin develop` for python 3.11, `maturin develop --features py38,pyo3/extension-module --no-default-features` for python 3.8"); #[cfg(all(feature = "py38", feature = "py311"))] -compile_error!("Only one python version must be enabled"); +compile_error!("Only one python version must be enabled, make sure to deactivate default features for python <3.11"); /// Serializes raw data. /// diff --git a/flake.nix b/flake.nix index a0cba1b..106f129 100644 --- a/flake.nix +++ b/flake.nix @@ -32,7 +32,7 @@ postShellHook = '' unset SOURCE_DATE_EPOCH ''; - LD_LIBRARY_PATH = "$LD_LIBRARY_PATH:${pkgs.stdenv.cc.cc.lib}/lib:${pkgs.zlib}/lib"; + LD_LIBRARY_PATH = "$LD_LIBRARY_PATH:${pkgs.stdenv.cc.cc.lib}/lib:${pkgs.zlib}/lib:/run/opengl-driver/lib"; }; }