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