python313Packages.paddlepaddle: 3.0.0 -> 3.2.0 (#456329)

This commit is contained in:
Sandro
2025-12-15 15:58:04 +00:00
committed by GitHub
9 changed files with 273 additions and 91 deletions
@@ -0,0 +1,50 @@
{
lib,
buildPythonPackage,
fetchPypi,
bce-python-sdk,
click,
prettytable,
psutil,
requests,
tqdm,
}:
let
version = "0.3.8";
format = "wheel";
in
buildPythonPackage {
pname = "aistudio-sdk";
inherit version format;
# No source code dist available
src = fetchPypi {
pname = "aistudio_sdk";
inherit version format;
dist = "py3";
python = "py3";
hash = "sha256-v8lq9yQ6wu4zAwFISapAKHF8zlr6Yir4z+Oh1E0ZQdY=";
};
dependencies = [
bce-python-sdk
click
prettytable
psutil
requests
tqdm
];
pythonImportsCheck = [ "aistudio_sdk" ];
meta = {
description = "Python client library for the AIStudio API";
homepage = "https://pypi.org/project/aistudio-sdk";
license = lib.licenses.unfree;
mainProgram = "aistudio";
maintainers = with lib.maintainers; [ kyehn ];
sourceProvenance = with lib.sourceTypes; [ fromSource ];
};
}
@@ -0,0 +1,44 @@
{
lib,
buildPythonPackage,
pythonAtLeast,
fetchPypi,
setuptools,
future,
pycryptodome,
six,
}:
let
version = "0.9.46";
in
buildPythonPackage {
pname = "bce-python-sdk";
inherit version;
pyproject = true;
disabled = pythonAtLeast "3.13";
src = fetchPypi {
pname = "bce_python_sdk";
inherit version;
hash = "sha256-S/AbIubRcszZSqIB+LxvKpjQ2keEFg53z6z8xxwmhr4=";
};
build-system = [ setuptools ];
dependencies = [
future
pycryptodome
six
];
pythonImportsCheck = [ "baidubce" ];
meta = {
description = "Baidu Cloud Engine SDK for python";
homepage = "https://github.com/baidubce/bce-sdk-python";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ kyehn ];
};
}
@@ -0,0 +1,52 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
setuptools,
filelock,
requests,
tqdm,
}:
let
version = "1.31.0";
in
buildPythonPackage {
pname = "modelscope";
inherit version;
pyproject = true;
src = fetchFromGitHub {
owner = "modelscope";
repo = "modelscope";
tag = "v${version}";
hash = "sha256-3o3iI4LGDSsF36jnrUTN3bBaM8XGCw+msIPS3WauMNQ=";
};
postPatch = ''
substituteInPlace setup.py \
--replace-fail "exec(compile(f.read(), version_file, 'exec'))" "ns = {}; exec(compile(f.read(), version_file, 'exec'), ns)" \
--replace-fail "return locals()['__version__']" "return ns['__version__']"
'';
build-system = [ setuptools ];
dependencies = [
filelock
requests
setuptools
tqdm
];
doCheck = false; # need network
pythonImportsCheck = [ "modelscope" ];
meta = {
description = "Bring the notion of Model-as-a-Service to life";
homepage = "https://github.com/modelscope/modelscope";
license = lib.licenses.asl20;
mainProgram = "modelscope";
maintainers = with lib.maintainers; [ kyehn ];
};
}
@@ -1,34 +0,0 @@
{
x86_64-linux = {
platform = "manylinux1_x86_64";
cpu = {
cp312 = "sha256-gafFsQFQsHUh0c0Ukdyh+3b/YhsU2xDomdlZ86d5Neo=";
cp313 = "sha256-j8SGXv02Vu6ZQkEkeSy4imQhUbTVkafW1KXGr9rpWVk=";
};
gpu = {
cp311 = "sha256-KWlGhjg9k1+wlm3Tk/mvMqh9LWZ0yGA1g99bCPlFf0U=";
cp312 = "sha256-KJ2drJWLuwdaYsCj7egh1nQV4j35vT+UgH0qTdxoyHk=";
};
};
aarch64-linux = {
platform = "manylinux2014_aarch64";
cpu = {
cp312 = "sha256-3aqZaosKANvkJp2iHWUFKHfsNpOiLswHucraPs0RaIY=";
cp313 = "sha256-u8TVc7NdJKJi4C1yaW6A9bSu5B9phnGvlXTe6xqD5vc=";
};
};
x86_64-darwin = {
platform = "macosx_10_9_x86_64";
cpu = {
cp312 = "sha256-3P6/sQ3rFaoz0qLWbVoS2d5lRh2KQNJofi+zIhFQ0Lo=";
cp313 = "sha256-UsQB/+Sq5WMWZgozAVpv11XNoj09cKKLE7c9cMvbuMs=";
};
};
aarch64-darwin = {
platform = "macosx_11_0_arm64";
cpu = {
cp312 = "sha256-hnfo1C/2b3T7yjL/Mti2S749Vu0pqS1D3EGPDxaPy2k=";
cp313 = "sha256-nRBR8uII2h1Dna7nyGG8tQJA8JcSSW62Hpzoxhj68vk=";
};
};
}
@@ -3,10 +3,13 @@
lib,
stdenv,
buildPythonPackage,
fetchurl,
fetchPypi,
python,
pythonOlder,
pythonAtLeast,
autoPatchelfHook,
bash,
zlib,
setuptools,
cudaSupport ? config.cudaSupport or false,
@@ -25,27 +28,34 @@
let
pname = "paddlepaddle" + lib.optionalString cudaSupport "-gpu";
version = if cudaSupport then "2.6.2" else "3.0.0";
sources = import ./sources.nix;
version = sources.version;
format = "wheel";
pyShortVersion = "cp${builtins.replaceStrings [ "." ] [ "" ] python.pythonVersion}";
cpuOrGpu = if cudaSupport then "gpu" else "cpu";
allHashAndPlatform = import ./binary-hashes.nix;
hash =
allHashAndPlatform."${stdenv.hostPlatform.system}"."${cpuOrGpu}"."${pyShortVersion}"
or (throw "${pname} has no binary-hashes.nix entry for '${stdenv.hostPlatform.system}.${cpuOrGpu}.${pyShortVersion}' attribute");
platform = allHashAndPlatform."${stdenv.hostPlatform.system}".platform;
src = fetchPypi {
inherit
version
format
hash
platform
;
pname = builtins.replaceStrings [ "-" ] [ "_" ] pname;
dist = pyShortVersion;
python = pyShortVersion;
abi = pyShortVersion;
};
sources."${stdenv.hostPlatform.system}"."${cpuOrGpu}"."${pyShortVersion}"
or (throw "${pname} has no sources.nix entry for '${stdenv.hostPlatform.system}.${cpuOrGpu}.${pyShortVersion}' attribute");
platform = sources."${stdenv.hostPlatform.system}".platform;
src =
if cudaSupport then
(fetchurl {
url = "https://paddle-whl.bj.bcebos.com/stable/cu128/paddlepaddle-gpu/paddlepaddle-${version}-${pyShortVersion}-${pyShortVersion}-linux_x86_64.whl";
inherit hash;
})
else
(fetchPypi {
inherit
version
format
hash
platform
;
pname = "paddlepaddle";
dist = pyShortVersion;
python = pyShortVersion;
abi = pyShortVersion;
});
in
buildPythonPackage {
inherit
@@ -55,13 +65,12 @@ buildPythonPackage {
src
;
disabled =
if cudaSupport then
(pythonOlder "3.11" || pythonAtLeast "3.13")
else
(pythonOlder "3.12" || pythonAtLeast "3.14");
disabled = pythonOlder "3.12" || pythonAtLeast "3.14";
nativeBuildInputs = [ addDriverRunpath ];
nativeBuildInputs = [
addDriverRunpath
]
++ lib.optionals cudaSupport [ autoPatchelfHook ];
dependencies = [
setuptools
@@ -75,40 +84,48 @@ buildPythonPackage {
typing-extensions
];
pythonImportsCheck = [ "paddle" ];
# Segmentation fault in darwin sandbox
pythonImportsCheck = lib.optionals stdenv.hostPlatform.isLinux [ "paddle" ];
# no tests
doCheck = false;
postFixup = lib.optionalString stdenv.hostPlatform.isLinux (
let
libraryPath = lib.makeLibraryPath (
[
zlib
(lib.getLib stdenv.cc.cc)
]
++ lib.optionals cudaSupport (
with cudaPackages;
postFixup =
lib.optionalString stdenv.hostPlatform.isLinux (
let
libraryPath = lib.makeLibraryPath (
[
cudatoolkit.lib
cudatoolkit.out
cudnn
zlib
(lib.getLib stdenv.cc.cc)
]
)
);
in
''
function fixRunPath {
p=$(patchelf --print-rpath $1)
patchelf --set-rpath "$p:${libraryPath}" $1
${lib.optionalString cudaSupport ''
addDriverRunpath $1
''}
}
fixRunPath $out/${python.sitePackages}/paddle/base/libpaddle.so
fixRunPath $out/${python.sitePackages}/paddle/libs/lib*.so
''
);
++ lib.optionals cudaSupport (
with cudaPackages;
[
cudatoolkit.lib
cudatoolkit.out
cudnn
]
)
);
in
''
function fixRunPath {
patchelf --add-rpath ${libraryPath} $1
${lib.optionalString cudaSupport ''
addDriverRunpath $1
''}
}
fixRunPath $out/${python.sitePackages}/paddle/base/libpaddle.so
fixRunPath $out/${python.sitePackages}/paddle/libs/lib*.so
''
)
+ ''
substituteInPlace $out/bin/paddle \
--replace-fail "/bin/bash" "${lib.getExe bash}" \
--replace-fail "python -" "${lib.getExe (python.withPackages (ps: with ps; [ distutils ]))} -"
sed -i '/# Check python lib installed or not./,/^fi$/d' $out/bin/paddle
sed -i 's/^INSTALLED_VERSION=.*/INSTALLED_VERSION="${version}"/' $out/bin/paddle
'';
meta = {
description = "Machine Learning Framework from Industrial Practice";
@@ -120,7 +137,6 @@ buildPythonPackage {
]
++ lib.optionals (!cudaSupport) [
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
@@ -0,0 +1,28 @@
{
version = "3.2.0";
x86_64-linux = {
platform = "manylinux1_x86_64";
cpu = {
cp312 = "sha256-LBf2daJevQZ19wP3uCd36pLbDDYL1Vpcay36rXvD8mA=";
cp313 = "sha256-+irs0GFCQ1D2dwqD3aB5aR9yJGNc/ydurvTj4XRAA50=";
};
gpu = {
cp312 = "sha256-YqxAWSvjhYOQUCiUPtjC3PdRxFeWGm/be8FxOrpaLZo=";
cp313 = "sha256-TdFx5Ut3iOTRg8USL2eIHyRYv8QT4KrLBPdiPkaK+Nc=";
};
};
aarch64-linux = {
platform = "manylinux2014_aarch64";
cpu = {
cp312 = "sha256-TOUUEUr3Zxh1/Ekn6gBa+51dD9d3rrVqEHjSL39Os/s=";
cp313 = "sha256-KqDlAvbdKE7aIcKH0yZFTfomrMqIwjqgrFgdHvmDGMU=";
};
};
aarch64-darwin = {
platform = "macosx_11_0_arm64";
cpu = {
cp312 = "sha256-rDNK9y0bDUnUyTPP1OtC1z7C3HpqryJIxihkPUGbbac=";
cp313 = "sha256-OBhOHqf9e/A4g+ph9FYZuXEtksE60foWk06p4NbT6ZE=";
};
};
}
+21
View File
@@ -0,0 +1,21 @@
#! /usr/bin/env nix-shell
#!nix-shell -i bash -p bash nix-update common-updater-scripts jq
set -eou pipefail
nix-update --system=x86_64-linux --url=https://github.com/PaddlePaddle/Paddle --override-filename=pkgs/development/python-modules/paddlepaddle/sources.nix --use-github-releases python313Packages.paddlepaddle || true
latestVersion=$(nix eval --raw --file . python313Packages.paddlepaddle.version)
systems=$(nix eval --json -f . python313Packages.paddlepaddle.meta.platforms | jq --raw-output '.[]')
for system in $systems; do
for pythonPackages in "python313Packages" "python312Packages"; do
hash=$(nix --extra-experimental-features nix-command hash convert --to sri --hash-algo sha256 $(nix-prefetch-url $(nix eval --raw --file . $pythonPackages.paddlepaddle.src.url --system "$system")))
update-source-version $pythonPackages.paddlepaddle $latestVersion $hash --file=pkgs/development/python-modules/paddlepaddle/sources.nix --system=$system --ignore-same-version --ignore-same-hash
done
done
for pythonPackages in "python313Packages" "python312Packages"; do
hash=$(nix --extra-experimental-features nix-command hash convert --to sri --hash-algo sha256 $(nix-prefetch-url $(nix eval --raw --file . pkgsCuda.$pythonPackages.paddlepaddle.src.url --system x86_64-linux)))
update-source-version pkgsCuda.$pythonPackages.paddlepaddle $latestVersion $hash --file=pkgs/development/python-modules/paddlepaddle/sources.nix --system=x86_64-linux --ignore-same-version --ignore-same-hash
done
@@ -19,6 +19,8 @@
ujson,
distutils,
huggingface-hub,
modelscope,
aistudio-sdk,
nix-update-script,
}:
@@ -63,11 +65,6 @@ buildPythonPackage rec {
build-system = [ setuptools ];
pythonRemoveDeps = [
# unpackaged
"aistudio-sdk"
"modelscope"
];
pythonRelaxDeps = [
"numpy"
"pandas"
@@ -91,6 +88,8 @@ buildPythonPackage rec {
ujson
gputil
huggingface-hub
modelscope
aistudio-sdk
];
passthru.updateScript = nix-update-script { };
+6
View File
@@ -582,6 +582,8 @@ self: super: with self; {
airtouch5py = callPackage ../development/python-modules/airtouch5py { };
aistudio-sdk = callPackage ../development/python-modules/aistudio-sdk { };
ajpy = callPackage ../development/python-modules/ajpy { };
ajsonrpc = callPackage ../development/python-modules/ajsonrpc { };
@@ -1822,6 +1824,8 @@ self: super: with self; {
bcdoc = callPackage ../development/python-modules/bcdoc { };
bce-python-sdk = callPackage ../development/python-modules/bce-python-sdk { };
bcf = callPackage ../development/python-modules/bcf { };
bcg = callPackage ../development/python-modules/bcg { };
@@ -9835,6 +9839,8 @@ self: super: with self; {
modeled = callPackage ../development/python-modules/modeled { };
modelscope = callPackage ../development/python-modules/modelscope { };
modern-colorthief = callPackage ../development/python-modules/modern-colorthief { };
moderngl = callPackage ../development/python-modules/moderngl { };