1{
2 lib,
3 buildPythonPackage,
4 pythonOlder,
5 fetchFromGitHub,
6 fetchpatch,
7 setuptools,
8 attrs,
9 boto3,
10 cloudpickle,
11 google-pasta,
12 numpy,
13 protobuf,
14 smdebug-rulesconfig,
15 importlib-metadata,
16 packaging,
17 pandas,
18 pathos,
19 schema,
20 pyyaml,
21 jsonschema,
22 platformdirs,
23 tblib,
24 urllib3,
25 requests,
26 docker,
27 tqdm,
28 psutil,
29 scipy,
30 accelerate,
31}:
32
33buildPythonPackage rec {
34 pname = "sagemaker";
35 version = "2.224.1";
36 pyproject = true;
37
38 disabled = pythonOlder "3.8";
39
40 src = fetchFromGitHub {
41 owner = "aws";
42 repo = "sagemaker-python-sdk";
43 rev = "refs/tags/v${version}";
44 hash = "sha256-Kc66sygHGFqMvSY7rACb62wJEJesnN4KDmtYZLIOsqc=";
45 };
46
47 patches = [
48 # Distutils removal, fix build with python 3.12
49 # https://github.com/aws/sagemaker-python-sdk/pull/4544
50 (fetchpatch {
51 url = "https://github.com/aws/sagemaker-python-sdk/commit/84447ba59e544c810aeb842fd058e20d89e3fc74.patch";
52 hash = "sha256-B8Q18ViB7xYy1F5LoL1NvXj2lnFPgt+C9wssSODyAXM=";
53 })
54 (fetchpatch {
55 url = "https://github.com/aws/sagemaker-python-sdk/commit/e9e08a30cb42d4b2d7299c1c4b42d680a8c78110.patch";
56 hash = "sha256-uGPtXSXfeaIvt9kkZZKQDuiZfoRgw3teffuxai1kKlY=";
57 })
58 ];
59
60 build-system = [
61 setuptools
62 ];
63
64 pythonRelaxDeps = [
65 "cloudpickle"
66 "importlib-metadata"
67 ];
68
69 dependencies = [
70 attrs
71 boto3
72 cloudpickle
73 google-pasta
74 numpy
75 protobuf
76 smdebug-rulesconfig
77 importlib-metadata
78 packaging
79 pandas
80 pathos
81 schema
82 pyyaml
83 jsonschema
84 platformdirs
85 tblib
86 urllib3
87 requests
88 docker
89 tqdm
90 psutil
91 ];
92
93 doCheck = false; # many test dependencies are not available in nixpkgs
94
95 pythonImportsCheck = [
96 "sagemaker"
97 "sagemaker.lineage.visualizer"
98 ];
99
100 passthru.optional-dependencies = {
101 local = [
102 urllib3
103 docker
104 pyyaml
105 ];
106 scipy = [ scipy ];
107 huggingface = [ accelerate ];
108 # feature-processor = [ pyspark sagemaker-feature-store-pyspark ]; # not available in nixpkgs
109 };
110
111 meta = with lib; {
112 description = "Library for training and deploying machine learning models on Amazon SageMaker";
113 homepage = "https://github.com/aws/sagemaker-python-sdk/";
114 changelog = "https://github.com/aws/sagemaker-python-sdk/blob/v${version}/CHANGELOG.md";
115 license = licenses.asl20;
116 maintainers = with maintainers; [ nequissimus ];
117 };
118}